Shaders: a program's constant table starts after its instructions (GBs of NVIDIA video memory) #2141

Merged
desplmfao merged 2 commits from upstream-pr/2143 into main 2026-11-25 21:54:37 +00:00
desplmfao commented 2026-11-25 05:58:28 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by desplmfao on 2026-11-25T05:58:28Z.


Problem

On NVIDIA under Wine (vkd3d-proton), several GB of video memory went to the driver as soon as pipelines were created, and runs filled the 16 GB of an RTX 5080 while the world loaded. With all of a run's shaders dumped as SPIR-V and compiled natively with VK_KHR_pipeline_executable_properties, six compute shaders stood out by their local memory per thread:

shader local memory per thread × 129,024 resident threads (84 SMs × 48 warps × 32)
0b341b15… (SPIR-V name) 57,168 B ~7.0 GB
c4c847ce… 21,648 B ~2.7 GB
4 more 16.6–18.4 KB ~2.1 GB each
every other of the 2,435 shaders ≤ 256 B ≤ 32 MB

Each holds one large constant uint[] array indexed at runtime. That's the program's constant table from code_dword. vkd3d-proton turns it into a private array, NVIDIA keeps it in local memory, and the driver reserves local memory for the worst shader times all resident threads. Tables of 5–14 KB stayed out of local memory (0–16 B), so the cut-off seems to be around 16 KB. That's from the driver's statistics, not from a documented limit.

Why the tables were that big: code_dword built the table from the lowest code offset any load or descriptor names. A load at a computed offset names offset 0, so the table was the whole program: instructions plus constants, up to 64 KiB.

Change

The program's constants follow its instructions, and a load at a computed offset reads them, not instruction bytes. So the table now starts where the instructions end, unless a load at a fixed offset reads below that, in which case it starts where it did before. A computed index below the table's start is clamped like one past its end. The start is computed in code_table_start.

Measured

Grand Theft Auto VI, Series X 1.0.2.1:

  • Offline, all 26,084 programs: tables of 8 KiB or more go from 35 (25 of them ≥ 16 KiB, up to 64 KiB) to 3 (9.4 KiB each). Programs emitted are unchanged: 14,205 / 2,621 / 8,765.
  • In the game, on an RTX 5080, proton-cachyos 11.0 with vkd3d-proton 3.2.0. "Other" is the game's video memory (nvidia-smi) minus its host textures:
before after
menu: game video memory 8.1–11.3 GB, textures 4.4 GB 5.5 GB, textures 4.6 GB
menu: other 4–7 GB about 0.9 GB
loading the world past 15.5 GB in total, so every run stopped 12.0 GB for the game, 14.1 GB in total
reached the world (2,800 draws/frame) no yes, and it stayed

The run used some other open PRs to get that far on NVIDIA under Wine (#259, #1849, and #177's handle key), but none of them touches this.

Not covered / limits

  • If a program deliberately read its own instruction bytes at a computed offset, it would now read clamped values. I don't know of a compiler that emits that, and a fixed-offset read of the instructions keeps the old start.
  • Windows: NVIDIA's D3D12 driver apparently doesn't keep such arrays per thread (an RTX 4060 report in #1508 has menu video memory near the texture size), so the gain there should be small. The table is still tens of KiB smaller per shader. AMD drivers also put large runtime-indexed arrays in scratch memory, but I haven't measured that.

Tested

  • New test the_code_table_starts_after_the_instructions.
  • cargo test -p victory-shader --lib -- --test-threads 1 on the RTX 5080 under Proton: 242 passed, 6 failed. Plain main gives 241 passed with the same 6 failures (NVIDIA/Wine, see #2037).
  • cargo clippy -p victory-shader --all-targets -- -D warnings: clean.
  • #2084 reads buffer loads from the same code tables through code_dword. Its tables get the same, smaller start.
  • #2112 and #2088 (host memory) and #2082 (Proton docs) are the other parts of getting into the world on this setup.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:5486046020 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2143). Originally posted by [desplmfao](https://github.com/desplmfao) on 2026-11-25T05:58:28Z. --- ## Problem On NVIDIA under Wine (vkd3d-proton), several GB of video memory went to the driver as soon as pipelines were created, and runs filled the 16 GB of an RTX 5080 while the world loaded. With all of a run's shaders dumped as SPIR-V and compiled natively with `VK_KHR_pipeline_executable_properties`, six compute shaders stood out by their **local memory per thread**: | shader | local memory per thread | × 129,024 resident threads (84 SMs × 48 warps × 32) | |---|---|---| | `0b341b15…` (SPIR-V name) | 57,168 B | ~7.0 GB | | `c4c847ce…` | 21,648 B | ~2.7 GB | | 4 more | 16.6–18.4 KB | ~2.1 GB each | | every other of the 2,435 shaders | ≤ 256 B | ≤ 32 MB | Each holds one large constant `uint[]` array indexed at runtime. That's the program's constant table from `code_dword`. vkd3d-proton turns it into a private array, NVIDIA keeps it in local memory, and the driver reserves local memory for the worst shader times all resident threads. Tables of 5–14 KB stayed out of local memory (0–16 B), so the cut-off seems to be around 16 KB. That's from the driver's statistics, not from a documented limit. Why the tables were that big: `code_dword` built the table from the lowest code offset any load or descriptor names. A load at a computed offset names offset 0, so the table was **the whole program**: instructions plus constants, up to 64 KiB. ## Change The program's constants follow its instructions, and a load at a computed offset reads them, not instruction bytes. So the table now starts where the instructions end, unless a load at a **fixed** offset reads below that, in which case it starts where it did before. A computed index below the table's start is clamped like one past its end. The start is computed in `code_table_start`. ## Measured Grand Theft Auto VI, Series X 1.0.2.1: - Offline, all 26,084 programs: tables of 8 KiB or more go from 35 (25 of them ≥ 16 KiB, up to 64 KiB) to 3 (9.4 KiB each). Programs emitted are unchanged: 14,205 / 2,621 / 8,765. - In the game, on an RTX 5080, proton-cachyos 11.0 with vkd3d-proton 3.2.0. "Other" is the game's video memory (nvidia-smi) minus its host textures: | | before | after | |---|---|---| | menu: game video memory | 8.1–11.3 GB, textures 4.4 GB | 5.5 GB, textures 4.6 GB | | menu: other | 4–7 GB | about 0.9 GB | | loading the world | past 15.5 GB in total, so every run stopped | 12.0 GB for the game, 14.1 GB in total | | reached the world (2,800 draws/frame) | no | yes, and it stayed | The run used some other open PRs to get that far on NVIDIA under Wine (#259, #1849, and #177's handle key), but none of them touches this. ## Not covered / limits - If a program deliberately read its own instruction bytes at a computed offset, it would now read clamped values. I don't know of a compiler that emits that, and a fixed-offset read of the instructions keeps the old start. - Windows: NVIDIA's D3D12 driver apparently doesn't keep such arrays per thread (an RTX 4060 report in #1508 has menu video memory near the texture size), so the gain there should be small. The table is still tens of KiB smaller per shader. AMD drivers also put large runtime-indexed arrays in scratch memory, but I haven't measured that. ## Tested - New test `the_code_table_starts_after_the_instructions`. - `cargo test -p victory-shader --lib -- --test-threads 1` on the RTX 5080 under Proton: 242 passed, 6 failed. Plain `main` gives 241 passed with the same 6 failures (NVIDIA/Wine, see #2037). - `cargo clippy -p victory-shader --all-targets -- -D warnings`: clean. ## Related - #2084 reads buffer loads from the same code tables through `code_dword`. Its tables get the same, smaller start. - #2112 and #2088 (host memory) and #2082 (Proton docs) are the other parts of getting into the world on this setup. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
DenRakEiw commented 2026-11-25 06:02:44 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T06:02:44Z.

Review: APPROVED


Verified locally merged onto origin/main (940d32f, Windows 11 x64, Rust 1.98.1 MSVC):

  • cargo test -p victory-shader --lib the_code_table_starts_after_the_instructions — passed
  • cargo clippy -p victory-shader --all-targets — 0 warnings
  • cargo xtask policy — ok (183 files ok)

Clean fix starting the emitted code constant table after the program's instructions rather than at offset 0, avoiding huge wasted constant-buffer/VRAM allocations on NVIDIA. Looks great.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6052603079 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2143#pullrequestreview-6052603079). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-25T06:02:44Z. **Review:** APPROVED --- Verified locally merged onto `origin/main` (`940d32f`, Windows 11 x64, Rust 1.98.1 MSVC): - `cargo test -p victory-shader --lib the_code_table_starts_after_the_instructions` — passed - `cargo clippy -p victory-shader --all-targets` — 0 warnings - `cargo xtask policy` — ok (`183 files ok`) Clean fix starting the emitted code constant table after the program's instructions rather than at offset 0, avoiding huge wasted constant-buffer/VRAM allocations on NVIDIA. Looks great. AI-assisted (Gemini 4 Neon).
catminou4 commented 2026-11-25 06:49:53 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T06:49:53Z.

Review: APPROVED


Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f69b, cargo test -p victory-shader --locked.

145 passed / 0 failed / 2 ignored. Program constant table starts after its instructions — constant-table layout fix.

<!-- greyfinch-sync:Marvisak/VIctory:review:6053075497 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2143#pullrequestreview-6053075497). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T06:49:53Z. **Review:** APPROVED --- Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f69b, `cargo test -p victory-shader --locked`. 145 passed / 0 failed / 2 ignored. Program constant table starts after its instructions — constant-table layout fix.
sinan-cmyk commented 2026-11-25 09:06:15 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by sinan-cmyk on 2026-11-25T08:22:37Z.


Offline measurement on a retail dump

Result: no count change against main.

I merged head 524e2834 onto main 940d32f (clean merge) and ran victory translate --validate --list on shaders.rpf (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with main program by program (25,889 programs). Validated: 23,918 on main, 23,918 with this PR.

No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.

No shader names or data are included, per the asset policy. AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7156948737 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2143#issuecomment-7156948737). Originally posted by [sinan-cmyk](https://github.com/sinan-cmyk) on 2026-11-25T08:22:37Z. --- ### Offline measurement on a retail dump **Result: no count change against `main`.** I merged head 524e2834 onto `main` 940d32f (clean merge) and ran `victory translate --validate --list` on `shaders.rpf` (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with `main` program by program (25,889 programs). Validated: 23,918 on `main`, 23,918 with this PR. No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right. No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
Marvisak commented 2026-11-25 12:03:45 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T11:24:02Z.


Automated triage for the maintainers.

Merge candidate. In crates/victory-shader/src/emit/lower.rs, code_dword used to start the program's constant table at the lowest CODE offset any load or descriptor names. A computed load names offset 0, so the table was the whole program. The new code_table_start starts it at the end of the instructions (the highest machine.offset + 4·words in the IR), unless a fixed-offset load reads below that, in which case the old start is kept.

I checked the edge cases in code_dword. A computed byte below the new start makes byte - base wrap, so it is clamped to the last dword by the existing IUGT select. Fixed-offset reads inside the instructions keep the old behaviour. the_code_table_starts_after_the_instructions covers these cases. The offline count on the title's shaders (no change in emitted programs, 23,918 validated before and after) supports that nothing regresses.

Thanks for a68ae55, which is comment-only: code_table_start's doc comment now says only what the function does. CI: passing on the previous head.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7160995936 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2143#issuecomment-7160995936). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T11:24:02Z. --- <!-- victory-triage v1 head=a68ae559f206d6ebaf96ff8c506bac6e14c1cb2c verdict=merge-candidate at=2026-11-25T13:10:00Z --> Automated triage for the maintainers. **Merge candidate.** In `crates/victory-shader/src/emit/lower.rs`, `code_dword` used to start the program's constant table at the lowest `CODE` offset any load or descriptor names. A computed load names offset 0, so the table was the whole program. The new `code_table_start` starts it at the end of the instructions (the highest `machine.offset + 4·words` in the IR), unless a fixed-offset load reads below that, in which case the old start is kept. I checked the edge cases in `code_dword`. A computed byte below the new start makes `byte - base` wrap, so it is clamped to the last dword by the existing `IUGT` select. Fixed-offset reads inside the instructions keep the old behaviour. `the_code_table_starts_after_the_instructions` covers these cases. The offline count on the title's shaders (no change in emitted programs, 23,918 validated before and after) supports that nothing regresses. Thanks for `a68ae55`, which is comment-only: `code_table_start`'s doc comment now says only what the function does. CI: passing on the previous head. --- _Generated by [Claude Code](https://claude.ai/code)_
desplmfao commented 2026-11-25 12:03:48 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by desplmfao on 2026-11-25T11:30:22Z.


Thanks. I took the optional point in a68ae55: code_table_start's comment now only says what the function does, and the vkd3d-proton/NVIDIA background stays in the description. No code change. Clippy is clean.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7161134365 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2143#issuecomment-7161134365). Originally posted by [desplmfao](https://github.com/desplmfao) on 2026-11-25T11:30:22Z. --- Thanks. I took the optional point in `a68ae55`: `code_table_start`'s comment now only says what the function does, and the vkd3d-proton/NVIDIA background stays in the description. No code change. Clippy is clean.
OctoAlgo commented 2026-11-25 16:09:28 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by OctoAlgo on 2026-11-25T15:55:14Z.


This also fixes NVIDIA RTX 5090 (GB202) GPU faults, so +1 for merging it.

On a 5090 (Linux, Proton, vkd3d-proton, driver 620.73.04) a fork of VIctory with the same code_dword code faulted at every world entry: NVRM Xid 13, "SM Warp Exception: MMU Fault", shader writes to unmapped addresses. The same build ran clean on an RTX 5070 Ti in the same PC. What we found:

  • Nsight Aftermath dumps always named a shader whose NVIDIA compile uses local memory. Refusing every such shader made the 5090 run clean.
  • Refusing only the 12 lighting computes that use 16–18 KB of local memory per thread was enough for a clean run. Their code tables are 4160–4596 dwords because a computed load names offset 0. NVIDIA keeps a constant array of up to 16 KiB in constant memory and copies a bigger one into each thread's local memory, the same mechanism you describe for the 5080. On GB202 that local memory faults; on the 5080 it costs VRAM.
  • Starting the table where the instructions end shrinks those tables to 616–708 bytes, and no executable uses 16 KB or more of local memory any more (the largest compute uses 128 B). That gave two clean 15-minute 5090 runs with all shaders on and the world lit. The lighting matched an unpatched A/B run on the 5070 Ti.
  • This PR, ported onto the fork: clean full 15-minute run on the 5090, frame 3059, 0 Xid, lit (mean luminance of the window scene 0.141, vs. 0.143 with our local switch and 0.003 with the lighting computes refused); the driver reports at most 128 B of local memory per compute and 192 B per pixel shader.

On the edge case of a table base just below the instructions' end: we logged every code-table read in a 15-minute run (1149 reads in 114 programs). None of them is a fixed-offset load inside the instructions. Every s_getpc_b64 + literal base, as the translator computes it, sits at or after the instructions' end (e.g. 16032/16064/16336 for an end at 16024). So code_table_start never clamps a real read there, and every table that was big drops to 154–177 dwords. No extra margin is needed.

(Investigated with an AI coding assistant; all numbers are from runs on this PC.)

<!-- greyfinch-sync:Marvisak/VIctory:comment:7167430537 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2143#issuecomment-7167430537). Originally posted by [OctoAlgo](https://github.com/OctoAlgo) on 2026-11-25T15:55:14Z. --- This also fixes NVIDIA **RTX 5090 (GB202)** GPU faults, so +1 for merging it. On a 5090 (Linux, Proton, vkd3d-proton, driver 620.73.04) a fork of VIctory with the same `code_dword` code faulted at every world entry: NVRM Xid 13, "SM Warp Exception: MMU Fault", shader writes to unmapped addresses. The same build ran clean on an RTX 5070 Ti in the same PC. What we found: - Nsight Aftermath dumps always named a shader whose NVIDIA compile uses local memory. Refusing every such shader made the 5090 run clean. - Refusing only the 12 lighting computes that use **16–18 KB of local memory per thread** was enough for a clean run. Their code tables are 4160–4596 dwords because a computed load names offset 0. NVIDIA keeps a constant array of up to 16 KiB in constant memory and copies a bigger one into each thread's local memory, the same mechanism you describe for the 5080. On GB202 that local memory faults; on the 5080 it costs VRAM. - Starting the table where the instructions end shrinks those tables to 616–708 bytes, and no executable uses 16 KB or more of local memory any more (the largest compute uses 128 B). That gave two clean 15-minute 5090 runs with all shaders on and the world lit. The lighting matched an unpatched A/B run on the 5070 Ti. - This PR, ported onto the fork: clean full 15-minute run on the 5090, frame 3059, 0 Xid, lit (mean luminance of the window scene 0.141, vs. 0.143 with our local switch and 0.003 with the lighting computes refused); the driver reports at most 128 B of local memory per compute and 192 B per pixel shader. On the edge case of a table base just below the instructions' end: we logged every code-table read in a 15-minute run (1149 reads in 114 programs). None of them is a fixed-offset load inside the instructions. Every `s_getpc_b64` + literal base, as the translator computes it, sits at or after the instructions' end (e.g. 16032/16064/16336 for an end at 16024). So `code_table_start` never clamps a real read there, and every table that was big drops to 154–177 dwords. No extra margin is needed. *(Investigated with an AI coding assistant; all numbers are from runs on this PC.)*
upstream-sync closed this pull request 2026-11-25 22:03:27 +00:00
Alm0stSurely commented 2026-11-26 06:03:39 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Alm0stSurely on 2026-11-26T05:14:00Z.


Independent RTX 5080 measurement under GE-Proton 11-6, NVIDIA 620.73.04. I applied the shader change from #2143 to a ZTRX build based on 90b529f8 with local Wine adaptations.

I captured two compute shader translations before and after the change. For each one I replayed the exact DXIL and root-signature metadata from the title in a fresh process, called CreateComputePipelineState once, and held the returned PSO for four seconds. No shader dispatch was issued. The serialized root signature matched across each pair.

Constant table, words GPU memory increase before GPU memory increase after
4,160 → 154 2,052 MiB 4 MiB
4,592 → 158 2,266 MiB 4 MiB

The values are differences between the median of four process GPU-memory samples before creation and four with the PSO held. One run per case. A control that held only the root signature and a third compute shader without this table both measured 0 MiB change before and after.

In my title run the patched build reached the opening credits and exited after about 5 min 15 s with 8,766 MiB of VRAM still free at the last sample with the game process present. The same exception had occurred on the earlier fork. I can confirm the pipeline memory improvement independently. I did not reproduce the in-world result on this run.

AI-assisted with OpenAI Codex (gpt-6.2-astra).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7183300262 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2143#issuecomment-7183300262). Originally posted by [Alm0stSurely](https://github.com/Alm0stSurely) on 2026-11-26T05:14:00Z. --- Independent RTX 5080 measurement under GE-Proton 11-6, NVIDIA 620.73.04. I applied the shader change from #2143 to a ZTRX build based on 90b529f8 with local Wine adaptations. I captured two compute shader translations before and after the change. For each one I replayed the exact DXIL and root-signature metadata from the title in a fresh process, called `CreateComputePipelineState` once, and held the returned PSO for four seconds. No shader dispatch was issued. The serialized root signature matched across each pair. | Constant table, words | GPU memory increase before | GPU memory increase after | | --- | ---: | ---: | | 4,160 → 154 | 2,052 MiB | 4 MiB | | 4,592 → 158 | 2,266 MiB | 4 MiB | The values are differences between the median of four process GPU-memory samples before creation and four with the PSO held. One run per case. A control that held only the root signature and a third compute shader without this table both measured 0 MiB change before and after. In my title run the patched build reached the opening credits and exited after about 5 min 15 s with 8,766 MiB of VRAM still free at the last sample with the game process present. The same exception had occurred on the earlier fork. I can confirm the pipeline memory improvement independently. I did not reproduce the in-world result on this run. AI-assisted with OpenAI Codex (gpt-6.2-astra).
upipibi commented 2026-11-28 04:00:23 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-28T04:00:23Z.


A measured A/B from another tree, where this same change is now off by default (read from their reports; not run here).

trustno1-coder/VIctory-NVIDIA ported this change as its #550 (kibagami-nc). Machad3x ran the A/B there: RTX 3080 Ti, Windows, 1440p, DLSS Quality, the title's ray tracing on, 240 s into the prison cell scene.

  • Series X profile: card time per frame went from 18-19 ms to 76-224 ms (frame 67-70 to 153-308 ms), with the same picture. The same batch with only that PR reverted was back to 18-19 ms.
  • Series S profile: it stayed fast (1-5 ms card time).

Their reading is that a computed load reaching below the new start now gets the table's last dword instead of the instruction bytes it read before. If a program uses that value as a loop count or a size, that would add card time without changing the picture. main does exactly that: code_dword takes byte - base, and a wrapped index is clamped to len - 1 like one past the end (lower.rs:778-787 at 63bcca4). The explanation is unconfirmed; they haven't yet split the frame line to find which pass takes the time.

So the tree now has it behind VICTORY_CODE_TABLE_AFTER=1, off by default, kept for the cards where the whole-program table hurts (the vkd3d-proton local-memory case here, and Xid 13 on an RTX 5090).

On main this is worth one Series X frame line on Windows NVIDIA with and without e04c0781. A diagnostics count of computed code-table reads whose byte falls below the table's start would also show whether any program in that scene takes the clamped value.

AI-assisted (Claude Code, Claude Opus 5.5 read main's code_dword and that tree's #550).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7233591803 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2143#issuecomment-7233591803). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-28T04:00:23Z. --- A measured A/B from another tree, where this same change is now off by default (read from their reports; not run here). trustno1-coder/VIctory-NVIDIA ported this change as its #550 (kibagami-nc). Machad3x ran the A/B there: RTX 3080 Ti, Windows, 1440p, DLSS Quality, the title's ray tracing on, 240 s into the prison cell scene. - **Series X profile:** card time per frame went from 18-19 ms to 76-224 ms (frame 67-70 to 153-308 ms), with the same picture. The same batch with only that PR reverted was back to 18-19 ms. - **Series S profile:** it stayed fast (1-5 ms card time). Their reading is that a computed load reaching below the new start now gets the table's last dword instead of the instruction bytes it read before. If a program uses that value as a loop count or a size, that would add card time without changing the picture. `main` does exactly that: `code_dword` takes `byte - base`, and a wrapped index is clamped to `len - 1` like one past the end (`lower.rs:778-787` at `63bcca4`). The explanation is unconfirmed; they haven't yet split the frame line to find which pass takes the time. So the tree now has it behind `VICTORY_CODE_TABLE_AFTER=1`, off by default, kept for the cards where the whole-program table hurts (the vkd3d-proton local-memory case here, and Xid 13 on an RTX 5090). On `main` this is worth one Series X frame line on Windows NVIDIA with and without `e04c0781`. A diagnostics count of computed code-table reads whose byte falls below the table's start would also show whether any program in that scene takes the clamped value. AI-assisted (Claude Code, Claude Opus 5.5 read main's `code_dword` and that tree's #550).
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
Marvisak/VIctory!2141
No description provided.