[PATCH v5 0/3] RISC-V: add multiarch RVV support for memcpy using FMV IFUNC

daichengrong daichengrong@iscas.ac.cn
Mon Feb 17 06:58:12 GMT 2025


Hi,
> Hi,
>
>> From: daichengrong <daichengrong@iscas.ac.cn>
>>
>> This patch introduces vector support for memcpy with IFUNC.
>> The implementation select the RVV optimized memcpy version via dl_hwcap.
> Testing this on our upcoming Ascalon CPU I measure a 3x speedup for
> long lengths,
> and no significant regressions on small lengths. Everything from 16
> bytes onwards is a clear improvement.

Thank you for the details of the test data, which is very helpful for us 
to optimize the implementation.

The k230 board has the same performance as the Ascalon CPU when copying 
short-length data, with no significant improvement.

In V6, we have made special optimizations for data with a length of 
VLEN/8 bytes. The results show that the speed of less than 16 bytes has 
improved on the K230 board.

What is currently uncertain is whether there will be better performance 
on other microarchitecture implementations such as the Ascalon CPU.

In other words, whether different settings of LMUL will affect the 
LOAD/STORE time.

If so, the V6 version is only optimized for microarchitectures such as 
the K230.

We need to directly use the reference implementation of the riscv vector 
spec to implement the memcpy function.

> Tested-by: Anton Blanchard <antonb@tenstorrent.com>
>
> Thanks,
> Anton
>
>> daichengrong (3):
>>    check rvv support in asm at sysdeps/riscv
>>    add hwprobe support for dl_hwcap
>>    add riscv vector support for memcpy
>>
>>   config.h.in                                   |  3 ++
>>   sysdeps/riscv/configure                       | 30 ++++++++++++++++
>>   sysdeps/riscv/configure.ac                    | 20 +++++++++++
>>   sysdeps/riscv/multiarch/memcpy_vector.S       | 35 +++++++++++++++++++
>>   .../unix/sysv/linux/riscv/multiarch/Makefile  |  8 +++++
>>   .../linux/riscv/multiarch/ifunc-impl-list.c   | 13 +++++++
>>   .../unix/sysv/linux/riscv/multiarch/memcpy.c  |  7 ++++
>>   sysdeps/unix/sysv/linux/riscv/sys/hwprobe.h   | 20 +++++++++++
>>   8 files changed, 136 insertions(+)
>>   mode change 100644 => 100755 sysdeps/riscv/configure
>>   create mode 100644 sysdeps/riscv/multiarch/memcpy_vector.S
>>
>> --
>> 2.25.1



More information about the Libc-alpha mailing list