Shaders: the constant table after the instructions can be turned off (VICTORY_CODE_TABLE_AFTER=0) #550
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!550
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-550"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@kibagami-nc on GitHub · 2026-11-28 00:39 UTC · original
kibagami-nc:fix/code-table-after-instructions→main· +0 −0 · 0 files · 0 commits · closed without mergingRebuilt on main (
568c5e5d), after #1880. #1880 (brunofgmag) merged the change this PR carried, on by default: a program's constant table starts after its instructions. Both are ports of desplmfao's Marvisak/VIctory#2143. So this PR is now only the way back:VICTORY_CODE_TABLE_AFTER=0starts the table at the lowest offset any load or descriptor names, as before #1880.KEYEDinshader_cache.rs, now 34 entries), so turning it on or off translates again. #807's test that every translator switch is keyed passes.Why a way back
@Machad3x measured the change in an A/B on an RTX 3080 Ti (comment below, 2026-11-28). Setup: 1440p, DLSS Quality, title ray tracing on, 240 s runs into the prison cell.
That was on the main of 2026-11-28, in a batch with other PRs, so it may not hold on today's main. With the switch, anyone who sees a slow card time can check in one run, without a rebuild.
On the other side, the change got DuckersMcQuack's RTX 5090 under Proton past its Xid 13 (#721). Upstream also measured the VRAM peak fall from 15.9 GB to 12.7 GB on an NVIDIA card (#1880).
One candidate for the extra card time: a computed load below the new start reads the table's last dword (the clamp in
code_dword) instead of the code's bytes. A program that uses such a value as a count would loop longer.Change
crates/victory-shader/src/emit/lower.rs:code_table_after()reads the switch.code_dwordtakes main'scode_table_startwhen the switch is on, andlowestwhen it's off.This PR's earlier copy of the
code_table_starttest is gone: main has the same test (the_code_table_starts_after_the_instructions) from #1880.Tests
cargo test -p victory-shader --locked: 395 passed, 8 ignored, on568c5e5d.cargo test -p victory-gpu --locked --lib shader_cache: 4 passed, includingevery_switch_of_the_translator_is_in_the_key.cargo clippy -p victory-shader -p victory-gpu --all-targets: nothing in the changed lines.Tested by others (earlier form, switch on)
VICTORY_CODE_TABLE_AFTER=1. The picture stayed black, which is #721's other problem.@Machad3x on GitHub · 2026-11-28 01:57 UTC · original
Tested in a batch on an RTX 3080 Ti + Ryzen 7 5700X, 1440p, DLSS Quality, title ray tracing on (VICTORY_BVH_BUILDER=1), 240 s runs into the prison cell scene. Batch: #552, #550, #548, #547, #544.
Regression with this PR on the Series X profile: the card time per frame went from 18-19 ms to 76-224 ms (frame 67-70 ms to 153-308 ms). The picture looked the same. A/B: the same batch with only this PR reverted is back to 18-19 ms. The Series S profile with this PR stayed fast (1-5 ms card time), so the cost seems to depend on the resolution or the shaders used at the Series X settings.
One thing a review noticed: a load at a computed offset that reaches into the instructions now reads the clamped last dword instead of the instruction bytes. If a shader uses such a value as a loop count or a size, that could explain the extra card time.
Shaders: the code table starts after the instructions (RTX 5090 Xid 13, GBs of VRAM on other NVIDIA cards)to Shaders: the code table can start after the instructions (VICTORY_CODE_TABLE_AFTER=1, off by default: RTX 5090 Xid 13, GBs of VRAM)@kibagami-nc on GitHub · 2026-11-28 02:07 UTC · original
Thanks @Machad3x for the A/B, that settles it.
With
1ae101bthe shorter table is a switch,VICTORY_CODE_TABLE_AFTER=1, off by default (the same name and default as dkdknight's port). Without it the translation is the same as onmain, so your batch should be back to 18-19 ms on the Series X profile. The switch is in the shader cache's key, so turning it on or off translates again.It stays for the cards the whole-program table hurts (Xid 13 on an RTX 5090, gigabytes of video memory reserved on an RTX 5080). If you find a moment, a Series X run with the switch on and the frame line would tell which part of the frame takes the extra time.
1ae101b44fto8c75b9bdfb8c75b9bdfbto005d06c0e0005d06c0e0toa15140a957github-bot referenced this pull request2026-11-29 02:28:47 +00:00
Shaders: the code table can start after the instructions (VICTORY_CODE_TABLE_AFTER=1, off by default: RTX 5090 Xid 13, GBs of VRAM)to Shaders: the constant table after the instructions can be turned off (VICTORY_CODE_TABLE_AFTER=0)a15140a957toa86b0512ff@trustno1-coder on GitHub · 2026-11-29 08:27 UTC · original
Thank you! An earlier version of this pull request was merged into main with its original commits and is part of v2026.11.29.01, where you are credited. GitHub does not show it as merged because new commits were pushed here after that merge. It stays open so those newer commits can be looked at next.
a86b0512fftoa15140a957@kibagami-nc on GitHub · 2026-11-29 20:34 UTC · original
Closed by GitHub because the branch now points at
a15140a9, which main already has: that earlier head of this PR came in with last night's merges.So main is back to the opt-in form:
VICTORY_CODE_TABLE_AFTER=1turns it on.The later head (
a86b0512, an opt-out on top of #1880's default) no longer applies, so there's nothing left to merge here.For the cards that need it, the switch has to be set:
The v2026.11.29.0x releases have it off by default.
github-bot referenced this pull request2026-11-30 22:19:22 +00:00
Pull request closed