Skip to content

Benchmarking RVV implementation #9

Description

@camel-cdr

I'm not sure if you have access to RVV hardware, so I thought I'd offer my help in that regard:

C908 encode:

input size: 12582912, output size: 16777216
number of iterations: 10
We report the time in cycles per input byte.
For reference, we present the time needed to copy 12582912 bytes.
rdtsc_overhead set to 7
memcpy                          :     0.515 cycle/op (best)    0.612 cycle/op (avg)
scalar (32 bit)                         ... 0.08162
scalar (64 bit)                         ... 0.07382 (speedup 1.11)
SWAR (64 bit)                           ... 0.07765 (speedup 1.05)
RISC-V RVV (LMUL=1)                     ... 0.07042 (speedup 1.16)
RISC-V RVV (LMUL=8)                     ... 0.05483 (speedup 1.49)
RISC-V Vector (LMUL=4, segmented load)  ... 0.02932 (speedup 2.78)

C908 decode:

scalar                                           ... 0.01204
improved scalar                                  ... 0.01204 (speed-up: 1.00)
RISC-V Vector (pack: gather)                     ... 0.01580 (speed-up: 0.76)
RISC-V Vector (pack: compress)                   ... 0.01399 (speed-up: 0.86)
RISC-V Vector (omit ws; pack: gather)            ... 0.01676 (speed-up: 0.72)
RISC-V Vector (omit ws, pack: compress)          ... 0.01733 (speed-up: 0.69)

C920 encode (without the segmented load one, because I can only compile intrinsics code to xtheadvector, I doubt it would perform well though, compare this and this. I am hopeful that future hardware will perform more similar to the C908):

input size: 100663296, output size: 134217728
number of iterations: 10
We report the time in cycles per input byte.
For reference, we present the time needed to copy 100663296 bytes.
rdtsc_overhead set to 16
memcpy                          :     0.760 cycle/op (best)    0.905 cycle/op (avg)
scalar (32 bit)                         ... 0.56006
scalar (64 bit)                         ... 0.42620 (speedup 1.31)
SWAR (64 bit)                           ... 0.49197 (speedup 1.14)
RISC-V RVV (LMUL=1)                     ... 0.23546 (speedup 2.38)
RISC-V RVV (LMUL=8)                     ... 0.17674 (speedup 3.17)

C920 decode:

scalar                                           ... 0.05389
improved scalar                                  ... 0.05391 (speed-up: 1.00)
RISC-V Vector (pack: gather)                     ... 0.02384 (speed-up: 2.26)
RISC-V Vector (pack: compress)                   ... 0.02149 (speed-up: 2.51)
RISC-V Vector (omit ws; pack: gather)            ... 0.08527 (speed-up: 0.63)
RISC-V Vector (omit ws, pack: compress)          ... 0.08224 (speed-up: 0.66)

Btw, you should add the tail policies to the inline assembly vsetvlis, otherwise it won't compile with clang.

I'll be working on my own implementations, and share them here, so we can figure out what works best.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions