Skip to content

RISC-V: Optimize decompression with branchless AdvanceToNextTagRVOptimized +13.7%#234

Open
anthony-zy wants to merge 1 commit intogoogle:mainfrom
anthony-zy:rv_extractoffset
Open

RISC-V: Optimize decompression with branchless AdvanceToNextTagRVOptimized +13.7%#234
anthony-zy wants to merge 1 commit intogoogle:mainfrom
anthony-zy:rv_extractoffset

Conversation

@anthony-zy
Copy link
Copy Markdown
Contributor

PR Title

Optimize decompression for RISC-V with branchless tag advancement


Summary

Introduces AdvanceToNextTagRVOptimized, a branchless helper for the decompression hot path. By replacing conditional branches with ternary selections, it allows the compiler to generate efficient branchless sequences (e.g., using RISC-V Zicond extension czero.eqz/czero.nez).

This optimization significantly reduces branch misprediction penalties on RISC-V architectures like the Spacemit(R) X60.

Performance

Tested with lzbench on Spacemit(R) X60:

  • Before: 233 MB/s
  • After: 265 MB/s
  • Improvement: +13.7%

Verification

  • Environment: Spacemit(R) X60 (RISC-V)
  • Benchmark tool: lzbench
  • Passed all existing Snappy unit tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant