Todd Lipcon has submitted this change and it was merged. (
http://gerrit.cloudera.org:8080/15635 )
Change subject: rowblock: use BMI instruction set when available for
GetSelectedRows
......................................................................
rowblock: use BMI instruction set when available for GetSelectedRows
This enables a BMI variant of SelectionVector::GetSelectedRows which has
a higher throughput. I disassembled the resulting hot loop as follows:
BMI:
L:
tzcnt %rsi,%rbx
or %r11d,%ebx
mov %bx,(%rdx)
blsr %rsi,%rsi
tzcnt %rsi,%rbx
or %r11d,%ebx
mov %bx,0x2(%rdx)
blsr %rsi,%rsi
tzcnt %rsi,%rbx
or %r11d,%ebx
mov %bx,0x4(%rdx)
add $0x6,%rdx
blsr %rsi,%rsi
add $0xfffffffd,%ecx
jne L
non-BMI:
L:
bsf %rsi,%rax
or %r12d,%eax
mov %ax,(%rdx)
lea -0x1(%rsi),%rax
and %rsi,%rax
bsf %rax,%rsi
or %r12d,%esi
mov %si,0x2(%rdx)
lea -0x1(%rax),%rbx
and %rax,%rbx
bsf %rbx,%rax
or %r12d,%eax
mov %ax,0x4(%rdx)
add $0x6,%rdx
lea -0x1(%rbx),%rsi
and %rbx,%rsi
add $0xfffffffd,%ecx
jne L
... and then used llvm-mca on these assembly files across a few common
architectures to see how many cycles were required for 100 iterations of
the loop. Results are as follows:
haswell non-bmi.s: Total Cycles: 606
haswell bmi.s: Total Cycles: 382
broadwell non-bmi.s: Total Cycles 606
broadwell bmi.s: Total Cycles: 382
skylake non-bmi.s: Total Cycles: 606
skylake bmi.s: Total Cycles: 307
So, on the most recent chips, this should be about a 2x improvement in
this function. This function made up a few percent of overall CPU
consumption in some TSBS workloads, so this patch had some small but
measurable improvement on end-to-end throughput.
Change-Id: I8ec74bc5db07c18d0e36de14a2343f49fc5c2859
Reviewed-on: http://gerrit.cloudera.org:8080/15635
Tested-by: Kudu Jenkins
Reviewed-by: Alexey Serbin <[email protected]>
---
M src/kudu/common/rowblock.cc
1 file changed, 19 insertions(+), 3 deletions(-)
Approvals:
Kudu Jenkins: Verified
Alexey Serbin: Looks good to me, approved
--
To view, visit http://gerrit.cloudera.org:8080/15635
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I8ec74bc5db07c18d0e36de14a2343f49fc5c2859
Gerrit-Change-Number: 15635
Gerrit-PatchSet: 4
Gerrit-Owner: Todd Lipcon <[email protected]>
Gerrit-Reviewer: Alexey Serbin <[email protected]>
Gerrit-Reviewer: Andrew Wong <[email protected]>
Gerrit-Reviewer: Andrew Wong <[email protected]>
Gerrit-Reviewer: Bankim Bhavsar <[email protected]>
Gerrit-Reviewer: Grant Henke <[email protected]>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Todd Lipcon <[email protected]>