[PR #1189] inflate: copy DEFLATE stored blocks in bulk (RT-INFLATE-STORED-COPY) #1220

Open
opened 2026-11-26 20:20:30 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1189
Author: @sodove
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: perf/rt-inflate-stored


📝 Commits (1)

  • 152c644 inflate: append aligned stored block payloads in bulk

📊 Changes

2 files changed (+21 additions, -6 deletions)

View changed files

📝 runtime/src/shader_library.h (+10 -5)
📝 runtime/test/shader_library_test.cpp (+11 -1)

📄 Description

Claimed in the coordination issue as: RT-INFLATE-STORED-COPY (claim).

Depends on: none. Applies independently alongside #1081, which changes match expansion and Adler-32.

What changed

The CPU zlib inflater used by the DirectStorage request handler and shader-library extraction appended each byte of an aligned DEFLATE stored block separately. It now takes the available input as a span and appends that range in one operation. The declared length is still checked against the output limit before copying. A truncated block still contributes its available prefix before reporting a data error.

Measured on the runtime queue

Windows 11 x64, Ryzen 5 9600X, MSVC 19.44 /O2. Synthetic zlib requests each produced 4 MiB. The indicated percentage of output came from stored blocks containing pseudorandom bytes. A compressed tail kept every request within the shim’s source/destination size contract.

Source and share from stored blocks main 6293c1c4f → this PR (ms/request) #1081 09ba0aa85 → both (ms/request)
Memory, 0% (control) 18.08 → 18.24 2.16 → 2.12
Memory, 50% 18.13 → 15.23 4.20 → 2.52
Memory, 95% 18.63 → 12.37 6.53 → 2.78
File, 95%, warm OS cache 20.82 → 13.89 7.73 → 3.57

Each figure is the median of ten paired rounds with alternating run order. Timed the actual queue from enqueue through submission and its completion event, eight requests per sample after a warm-up batch. Every request returned S_OK and its full destination matched outside the timer. The mixed cases improved in all ten pairs. Changes on the 0% control were within 2% in either direction. The retail block mix, game startup time and FPS were not measured.

Tested

  • Built gta6rt.exe in RelWithDebInfo on native Windows. CTest passed shader_library and dstorage (329 checks in the latter). The shader-library suite also passed on Linux x86-64 with GCC 15.2.
  • Extended the existing mixed-block test across all eight alignments to check the exact output prefix and error classification. A control that rejected a short block before appending its prefix failed the new assertion.
  • 710 additional synthetic boundary, output-limit and checksum checks passed on each of the four variants, including empty and 65,535-byte blocks.
  • Full semantic suite passed (6,168 tests, 470 files). The two changed paths passed the game-data check. git merge-tree applies this PR and #1081 cleanly.

GPUs tested: n/a (CPU and DirectStorage queue). Only synthetic input used.

AI-assisted: yes (OpenAI Codex).

Checklist

  • Based on current main and merges cleanly.
  • One topic.
  • Source and synthetic tests only.
  • No translator rule changed.

🔄 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/ubiquitarianism/leonida/pull/1189 **Author:** [@sodove](https://github.com/sodove) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `perf/rt-inflate-stored` --- ### 📝 Commits (1) - [`152c644`](https://github.com/ubiquitarianism/leonida/commit/152c64442b84de96d2bf4e5b9d300377eac402fd) inflate: append aligned stored block payloads in bulk ### 📊 Changes **2 files changed** (+21 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `runtime/src/shader_library.h` (+10 -5) 📝 `runtime/test/shader_library_test.cpp` (+11 -1) </details> ### 📄 Description Claimed in the coordination issue as: RT-INFLATE-STORED-COPY ([claim](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7142471707)). Depends on: none. Applies independently alongside #1081, which changes match expansion and Adler-32. ### What changed The CPU zlib inflater used by the DirectStorage request handler and shader-library extraction appended each byte of an aligned DEFLATE stored block separately. It now takes the available input as a span and appends that range in one operation. The declared length is still checked against the output limit before copying. A truncated block still contributes its available prefix before reporting a data error. ### Measured on the runtime queue Windows 11 x64, Ryzen 5 9600X, MSVC 19.44 `/O2`. Synthetic zlib requests each produced 4 MiB. The indicated percentage of output came from stored blocks containing pseudorandom bytes. A compressed tail kept every request within the shim’s source/destination size contract. | Source and share from stored blocks | main `6293c1c4f` → this PR (ms/request) | #1081 `09ba0aa85` → both (ms/request) | |---|---:|---:| | Memory, 0% (control) | 18.08 → 18.24 | 2.16 → 2.12 | | Memory, 50% | 18.13 → 15.23 | 4.20 → 2.52 | | Memory, 95% | 18.63 → 12.37 | 6.53 → 2.78 | | File, 95%, warm OS cache | 20.82 → 13.89 | 7.73 → 3.57 | Each figure is the median of ten paired rounds with alternating run order. Timed the actual queue from enqueue through submission and its completion event, eight requests per sample after a warm-up batch. Every request returned `S_OK` and its full destination matched outside the timer. The mixed cases improved in all ten pairs. Changes on the 0% control were within 2% in either direction. The retail block mix, game startup time and FPS were not measured. ### Tested - Built `gta6rt.exe` in RelWithDebInfo on native Windows. CTest passed `shader_library` and `dstorage` (329 checks in the latter). The shader-library suite also passed on Linux x86-64 with GCC 15.2. - Extended the existing mixed-block test across all eight alignments to check the exact output prefix and error classification. A control that rejected a short block before appending its prefix failed the new assertion. - 710 additional synthetic boundary, output-limit and checksum checks passed on each of the four variants, including empty and 65,535-byte blocks. - Full semantic suite passed (6,168 tests, 470 files). The two changed paths passed the game-data check. `git merge-tree` applies this PR and #1081 cleanly. GPUs tested: n/a (CPU and DirectStorage queue). Only synthetic input used. AI-assisted: yes (OpenAI Codex). ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic. - [x] Source and synthetic tests only. - [x] No translator rule changed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#1220
No description provided.