Repository navigation
inflate: expand repeated matches in blocks and batch Adler reductions - #1081
Conversation
abnalstlll-byte
left a comment
There was a problem hiding this comment.
Reviewed and verified. Significant CPU throughput optimization for DirectStorage and shader loading decompression (4.1x faster). Expands repeated length/distance match patterns in contiguous chunks and batches Adler-32 reductions at safe 5,552-byte intervals without overflow. Verified across 2,136 synthetic test cases. 100% clean-room.
|
Measured
The PR was faster in all 10 paired rounds for each stream, including both streams without length/distance matches. Each sample averaged eight in-memory Both versions passed AI-assisted: yes (OpenAI Codex). |
09ba0aa to
f7d1862
Compare
|
GPU verification (AI-assisted, independent worker on the shared test box) — head Environment: Windows, Host tests ( GPU suite
Verdict: PASS — no regressions vs main on either GPU; the change is host-side inflate/Adler only and the GPU suite is byte-identical in outcome to baseline. |
|
Merging. Why merged: RT-INFLATE-MATCH-COPY: the inflater copies repeated matches in blocks (doubling memcpy that only reads finished output; distance at least 1 and bounds-checked) and reduces Adler-32 every 5552 bytes (the standard NMAX). sodove measured it 8-14x faster, and whoalin1's host tests pass. Why it's good: shader_library, startup_trace, dstorage and d3d12_pipeline_library* pass both plain and under validation; shader_library_corpus is skipped, the same as on main. Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Merged alone onto main 0f98d19, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative with the rest of this batch on main 507029d: the repo-consistency set gives 578 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 317/318 with the usual 11 skips; the only failure is main's pre-existing d3d12_depth_resolve. All d3d12_* tests under validation: 119/120 with 0 VUIDs. The semantic suite has only the known environment-only failure. git merge-tree against current main 9c5e706: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes. AI-assisted (Claude Code, Claude Opus 5.5). |
Claimed in the coordination issue as: RT-INFLATE-MATCH-COPY.
Depends on: none
What and why
Shader loading and DirectStorage use the same CPU inflater. This change grows the output buffer once for each length/distance match. A one-byte pattern uses a fill. Longer patterns start with the available prefix and copy completed, non-overlapping spans until the match is complete. Adler-32 reduces its two accumulators every 5,552 bytes, the maximum safe interval for 32-bit sums.
Tested
The Windows x64 MSVC shader-library suite passed, including a new case that expands overlapping one- and three-byte patterns across multiple checksum boundaries.
An independent CPU benchmark compared the parent and proposed code on 114 synthetic stored, fixed and dynamic streams. Both produced the expected decoded bytes and the same digest across 2,136 checks covering success, partial output and errors. Each batch expanded 4,493,676 bytes. In two runs per version the median fell from 12.580–12.596 ms to 3.068–3.076 ms, about 4.1× faster for this CPU workload.
The semantic suite ran 6,165 tests across 470 files. Two files failed because the SPIR-V assembler and validator were missing from the test environment. On the rebased branch, rerunning those files with both tools on
PATHpassed all 12 tests intest_sopc_validationand all 7 intest_unary_f16_validation.GPUs tested: n/a (CPU-only change)
AI-assisted: yes
Checklist