Skip to content

⚡ Bolt: Optimize Decompression for Offset 25#381

Merged
404Setup merged 1 commit intomainfrom
bolt-optimize-offset-25-12004466611968664539
Feb 24, 2026
Merged

⚡ Bolt: Optimize Decompression for Offset 25#381
404Setup merged 1 commit intomainfrom
bolt-optimize-offset-25-12004466611968664539

Conversation

@404Setup
Copy link
Copy Markdown
Owner

Optimized decompression for Offset 25 (Shift 7) by parallelizing alignr instructions.

💡 What

Specialized decompress_offset_alignr_cycle for SHIFT = 7 (which corresponds to Offset 25).
Unrolled the loop to write 96 bytes (6 vectors) per iteration.
Broke the serial dependency chain:

  • v_next2 is computed as alignr(v_prev, v_align, 14) instead of depending on v_next1.
  • v_next4 is computed as alignr(v_next1, v_next0, 14) instead of depending on v_next3.
  • v_next5 is computed as alignr(v_next2, v_next1, 14) instead of depending on v_next4.

🎯 Why

The generic implementation of decompress_offset_alignr_cycle uses a serial chain of alignr instructions, where each vector depends on the previous one. This limits throughput due to latency. By calculating intermediate vectors directly from earlier states using larger shift constants, we expose more parallelism to the CPU.

📊 Impact

Benchmark Decompress offset25 shows a throughput improvement of approximately 1.4% (10.07 GiB/s -> 10.23 GiB/s).

🔬 Measurement

Run cargo bench --bench bench_main "Decompress offset25" to verify.
Ensure bench_data/data_offset25.bin is generated using scripts/gen_bench_files.py.


PR created automatically by Jules for task 12004466611968664539 started by @404Setup

Optimized the decompression hot path for Offset 25 by specializing `decompress_offset_alignr_cycle` for `SHIFT=7`.
The loop was unrolled to a stride of 96 bytes (6 vectors).
The serial dependency chain of `alignr` instructions was optimized by computing vectors `v_next2`, `v_next4`, and `v_next5` using accumulated shift constants (e.g., using shift 14 on `v_prev` and `v_align` directly instead of relying on `v_next1`). This reduces the dependency depth and increases instruction-level parallelism.

Performance Impact:
- Throughput for `Decompress offset25` improved by ~1.4% (from ~10.07 GiB/s to ~10.23 GiB/s).
- Verified correctness with `cargo test`.

Co-authored-by: 404Setup <[email protected]>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@404Setup 404Setup merged commit 183fc18 into main Feb 24, 2026
1 check passed
@404Setup 404Setup deleted the bolt-optimize-offset-25-12004466611968664539 branch February 24, 2026 13:31
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