Skip to content

Enable PREFETCH_L1 for RISC-V to improve performance#4643

Open
Polaris-911 wants to merge 1 commit intofacebook:devfrom
Polaris-911:yuqu
Open

Enable PREFETCH_L1 for RISC-V to improve performance#4643
Polaris-911 wants to merge 1 commit intofacebook:devfrom
Polaris-911:yuqu

Conversation

@Polaris-911
Copy link
Copy Markdown
Contributor

Description

This PR enables PREFETCH_L1(match) in zstd_decompress_block.c for the RISC-V architecture.
Similar to AArch64, prefetching the match sequence before copying can bring a slight performance improvement on high-performance RISC-V processors.

Why is it needed?
Currently, this prefetch optimization is only enabled for __aarch64__. By extending the macro to include __riscv, we can take advantage of hardware data prefetching on RISC-V platforms, resulting in better CPU cache utilization during decompression.

Benchmark Results
Tests were performed on a SOPHON SG2044 RISC-V machine using the silesia.tar dataset.
Command: numactl -l -C 12 ./zstd -b1 -e1 ../silesia.tar

Metric Before (MB/s) After (MB/s) Improvement
Compression (Level 1) 85.34 85.58 +0.28%
Decompression 237.01 237.33 +0.14%

@meta-cla meta-cla bot added the CLA Signed label Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant