[PR #1410] Optimize FindMatchLengthWithLimit with RISC-V RVV vector instructions #2015

Open
opened 2026-01-29 20:56:57 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/google/brotli/pull/1410
Author: @Dayuxiaoshui
Created: 12/26/2025
Status: 🔄 Open

Base: masterHead: master


📝 Commits (1)

  • 61e1877 Optimize FindMatchLengthWithLimit with RISC-V RVV vector instructions

📊 Changes

1 file changed (+53 additions, -1 deletions)

View changed files

📝 c/enc/find_match_length.h (+53 -1)

📄 Description

Add RISC-V RVV optimized implementation of FindMatchLengthWithLimit function using vector instructions for 16-byte parallel comparison.

Performance improvements:

  • Compression: +2.16% average improvement
  • Decompression: +2.66% average improvement
  • Best case: +7.56% compression improvement on 1MB data

Implementation details:

  • Uses vle8.v to load 16 bytes at once
  • Uses vmseq.vv for parallel vector comparison
  • Uses vfirst.m to quickly find first mismatch position
  • Falls back to 8-byte blocks and byte-by-byte for remaining data

The optimization is enabled when BROTLI_TARGET_RISCV_RVV is defined and runs on 64-bit little-endian targets. The original TZCNT64-based implementation remains available as a fallback.

Tested with GCC 12.3.1, -O3 -march=rv64gcv, 100 iterations.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/google/brotli/pull/1410 **Author:** [@Dayuxiaoshui](https://github.com/Dayuxiaoshui) **Created:** 12/26/2025 **Status:** 🔄 Open **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`61e1877`](https://github.com/google/brotli/commit/61e1877f57d0a109abe7f67022902c759cac2059) Optimize FindMatchLengthWithLimit with RISC-V RVV vector instructions ### 📊 Changes **1 file changed** (+53 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `c/enc/find_match_length.h` (+53 -1) </details> ### 📄 Description Add RISC-V RVV optimized implementation of FindMatchLengthWithLimit function using vector instructions for 16-byte parallel comparison. Performance improvements: - Compression: +2.16% average improvement - Decompression: +2.66% average improvement - Best case: +7.56% compression improvement on 1MB data Implementation details: - Uses vle8.v to load 16 bytes at once - Uses vmseq.vv for parallel vector comparison - Uses vfirst.m to quickly find first mismatch position - Falls back to 8-byte blocks and byte-by-byte for remaining data The optimization is enabled when BROTLI_TARGET_RISCV_RVV is defined and runs on 64-bit little-endian targets. The original TZCNT64-based implementation remains available as a fallback. Tested with GCC 12.3.1, -O3 -march=rv64gcv, 100 iterations. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 20:56:57 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#2015