Skip to content

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

Open
sodove wants to merge 1 commit into
ProjectLeonida:mainfrom
sodove:perf/rt-inflate-stored
Open

sodove wants to merge 1 commit into
ProjectLeonida:mainfrom
sodove:perf/rt-inflate-stored

Conversation

@sodove

@sodove sodove commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

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 inflate: expand repeated matches in blocks and batch Adler reductions #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.

@Deedlyy

Deedlyy commented Nov 24, 2026

Copy link
Copy Markdown

Recommendation: [MERGE]

Reasoning: The CPU zlib inflater copies DEFLATE stored blocks with one range append instead of byte by byte, keeping the output-limit check and truncated-block behaviour. Small performance change in the DirectStorage/shader-library path, with a test. It's independent of #1081. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with main. Merge once the queued checks are green.

Impact level: 3/10

MoonEyes pushed a commit to MoonEyes/leonida that referenced this pull request Nov 27, 2026
…ose)

- present: VICTORY_COMPOSE=1 lays the Series S interface plane (4K) over the game plane (1080p); without it everything before gameplay is black. Ported from fxceless/victory-gta6 PR ProjectLeonida#1189 (compose.rs; FSR stand-in not ported, use VICTORY_OWN_UPSCALER=1).
- shader cache key includes VICTORY_BVH_MISS.
Measured on an RTX 5070, Series S, half scale: about 20-22 fps, no device loss.
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.

2 participants