[Bug libc/34334] New: [RISC-V] Vector memset performance issues on Spacemit X100 (K3)
anton at ozlabs dot org via Glibc-bugs <[email protected]> Tue, 30 Jun 2026 10:12:54 +0000
| Newsgroups | gmane.comp.lib.glibc.bugs |
|---|---|
| Message-ID | <[email protected]/bugzilla/> |
https://sourceware.org/bugzilla/show_bug.cgi?id=34334
Bug ID: 34334
Summary: [RISC-V] Vector memset performance issues on Spacemit
X100 (K3)
Product: glibc
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libc
Assignee: unassigned at sourceware dot org
Reporter: anton at ozlabs dot org
CC: drepper.fsp at gmail dot com
Target Milestone: ---
Here are some results for memset on the Spacemit X100. We did suspect that
smaller lmul levels might be preferable on OoO CPUs, and the X100 data confirms
that. The current lmul=8 vector implementation has some quite large regressions
to the scalar implementation for small (< 128B) lengths, and an lmul=2 version
largely fixes that.
On top of this, I did notice some sensitivity to the compiled code. My initial
suspicion is some fetch alignment issues, but I'm not convinced I understand it
completely. From build to build the numbers bounce around a bit even with
explicit alignment of the memset routine. Perhaps the alignment of the
benchmark code itself is significant.
In the data below:
__memset_vector - Current lmul=8 loop
m2 - lmul=2 loop
m2_balign32 - 32 byte aligned function
m2_balign32_loop - 32 byte aligned loop
I'm likely overaligning the loops at 32 bytes, but it's a starting point.
generic_memset __memset_vector m2
m2_balign32 m2_balign32_loop __memset_generic
==========================================================================================================================================
length=1: 6.47 14.12 (-118.2%) 9.10 (-40.72%)
3.66 ( 43.48%) 4.10 ( 36.56%) 8.67 (-34.04%)
length=2: 9.61 14.55 (-51.38%) 9.10 ( 5.29%)
3.65 ( 62.06%) 4.10 ( 57.35%) 11.38 (-18.36%)
length=4: 8.19 14.10 (-72.07%) 9.10 (-11.05%)
3.64 ( 55.56%) 4.10 ( 49.97%) 13.19 (-61.02%)
length=8: 6.83 14.10 (-106.4%) 9.10 (-33.21%)
3.64 ( 46.69%) 4.10 ( 39.99%) 10.92 (-59.86%)
length=16: 8.65 14.10 (-62.96%) 9.10 ( -5.17%)
3.65 ( 57.85%) 4.10 ( 52.62%) 13.19 (-52.50%)
length=32: 11.38 14.10 (-23.92%) 9.10 ( 20.03%)
3.64 ( 67.99%) 4.10 ( 63.97%) 14.56 (-27.94%)
length=64: 8.19 14.10 (-72.07%) 9.10 (-11.05%)
3.65 ( 55.49%) 4.10 ( 49.97%) 11.83 (-44.38%)
length=128: 12.29 14.10 (-14.73%) 10.62 ( 13.58%)
6.38 ( 48.10%) 7.29 ( 40.69%) 14.86 (-20.94%)
length=256: 16.26 14.10 ( 13.29%) 14.10 ( 13.26%)
8.35 ( 48.64%) 7.75 ( 52.33%) 20.89 (-28.50%)
length=512: 29.92 21.85 ( 26.98%) 21.84 ( 27.01%)
18.46 ( 38.29%) 18.46 ( 38.30%) 35.48 (-18.60%)
length=1024: 90.66 89.31 ( 1.49%) 89.40 ( 1.40%)
89.81 ( 0.94%) 88.92 ( 1.92%) 90.26 ( 0.44%)
length=2048: 116.83 102.34 ( 12.40%) 102.87 ( 11.95%)
102.36 ( 12.38%) 102.37 ( 12.38%) 122.75 ( -5.06%)
length=4096: 233.98 219.48 ( 6.20%) 220.03 ( 5.96%)
219.48 ( 6.20%) 220.11 ( 5.93%) 239.11 ( -2.19%)
length=8192: 467.34 462.42 ( 1.05%) 462.23 ( 1.09%)
462.20 ( 1.10%) 462.12 ( 1.12%) 472.60 ( -1.13%)
length=16384: 959.76 947.15 ( 1.31%) 946.98 ( 1.33%)
940.38 ( 2.02%) 800.38 ( 16.61%) 1013.21 ( -5.57%)
length=32768: 1904.87 1708.09 ( 10.33%) 1703.92 ( 10.55%)
1702.82 ( 10.61%) 1702.48 ( 10.62%) 1874.48 ( 1.60%)
length=65536: 3786.95 3484.48 ( 7.99%) 3384.22 ( 10.63%)
3364.85 ( 11.15%) 3339.17 ( 11.82%) 3739.33 ( 1.26%)
length=131072: 7720.54 7153.91 ( 7.34%) 7102.45 ( 8.01%)
7022.39 ( 9.04%) 6962.38 ( 9.82%) 7954.83 ( -3.03%)
--
You are receiving this mail because:
You are on the CC list for the bug.