Shaders: classify code-built descriptors and route their reads #3380
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!3380
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3380"
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?
@T1bolus on GitHub · 2026-11-29 22:29 UTC · original
T1bolus:fsr4-pr→main· +1508 −37 · 7 files · 7 commits · closed without mergingFixes #
What it changes
42 compute shaders that the tip refuses start lowering with this series, 1,377
shaders lower with more exact output than before, and no shader of the 6,532
recorded ones that translated before stops translating. The routed classes are
the ones FSR4-style programs are built from, so the series doubles as
groundwork for that path.
Measured on the recorded corpus (6,532 shaders, diffed against the plain tip on
the same corpus):
FSR4-style programs live in: descriptors the code builds around memory,
strides the layout does not declare, a heap base the records do not name.
Wave 6's stride gate accounts for 40 of them per the per-commit sweeps, the
rest come with the memory route.
pixel 147 / vertex 53) — reads that guessed before now follow the machine's
records: the descriptor classification (1), exact strides and samplers folded
from constants (4), the host copy behind code-built descriptors (5), reset
values for VCC/VCC+1/M0 (6).
what it means to change.
no panics; held as an invariant through the series and re-verified across two
corpus versions.
A note on FSR4, kept to what the measurements show: the classes above are the
ones FSR4-style programs are characterized by — descriptors built in code
around memory, descriptor dwords the code only patches, stride-0
constant-buffer slots read through tables, wave64 compute with exact folding.
This series puts exactly those classes on a measured, verified base. It does
not claim the title's own upscaler starts with it; the remaining wave work
decides that, in follow-up PRs.
The series itself, rewritten in this tree's idiom (
descriptor_data.rs, thelower/*modules,root_memory,s.entry) — 7 files, +1508/−37, all insidethe shader emit layer (no host or GPU structure touched):
resource: descriptors the console keeps through xor shuffles and the table a root constant holds— the wave-5 classification:sop2_dword,xor_net/xor_leaves,kept_low,over_place,assembled,patched(viathe
by_addressfallback at the Built pattern), plus the classify wiring(
assembledbeforeloaded,patchedafter it) and 10 tests in thedynamic2form. (644+/17−)clippy: the unused imports and two allow notes the fresh tree needs. (5+/3−)shader: the heap base the records do not name, and a descriptor dword the code only patches—heap_base_only(a nameless heap base reads 0, with the64-visit cap) and
patch_only(a descriptor dword the code only patches readsundefined instead of a missing host value), hooks in
inputs()anddescriptor_data.rs, +4 tests. (268+/6−)resource: the strides the layout does not declare, and the samplers built from constants— wave 6:PURE/pure(26 opcodes folded exactly),const_of(with thes_bfm_b64pairs),exactsite recording, and theindexed-buffer gate that lets
slot_strideconsult the table(
slot_word(src, true)). (340+/12−)lower: an access through a descriptor built in the code reads the host copy of that memory— the memory route in the guard form(
Source::Built { address.param == MEMORY }), reusingmemory()androot_copy; indexed Built{MEMORY} accesses refuse. (110+/2−)lower: the machine registers a program starts with read their reset values— VCC/VCC+1/M0 read 0 before their first write (EXEC stays with
s.entry,which is more precise). (26+/0−)
lower: a stride the table does not hold refuses the indexed read— aTable-root gate now demands the record proof
(
used.is_some_and(|u| u.stride == 0 && u.kind != ResourceType::Cbv)): adynamically indexed read through a Table slot with no record is refused
instead of multiplying the element by the table's 0 — the host writes stride 0
for constant-buffer slots, so the old form read element 0 and drew speckles,
missing glyphs and diagonal lines. The Heap-root branch keeps this tree's own
is_none_orgate. (119+/1−)How it was tested
tracing): RTX 4070 Super host against the Series X dump (v1.0.2.1), 1440p with
DLSS upscaling and DLSS frame generation on (1.00 upscalings per frame in the
logs), ray-tracing passes present (the structure builder stays off, as on the
tip).
element 0 (missing glyphs, speckles, diagonal lines in UI text); compute
programs built around memory refuse; a nameless heap base reads a missing host
value; VCC/VCC+1/M0 read garbage before their first write.
corpus 0 shaders that translated before refuse after and no panics. In game on
the base the waves were written for: 0 dropped-draw regressions against the
pre-wave line, and the UI-text artifact class disappears with (7)'s gate
discipline.
recorded corpus covers wave32 and wave64 programs (the tip's wave64 folding
path included; our exact folding composes with it, verified shader-by-shader
against the tip's own build).
cargo testpassed for the crates it touches: yes — victory-shader 481 green(3 known PSV flakes excluded on this machine), victory-gpu 915 green, clippy
-D warningsgreen.Checked for overlap
touches. Related: #2916 (vector buffer loads through a descriptor built around a
table in the code — the sibling arm of the same
Source::Builtdispatch: theirparam: CODEcase reads the appended table viacode_dword, while (5) herecarries the
param: MEMORYcase onto the host copy with its guard form andrefusal discipline; expect a textual overlap around the Built handling in
lower.rs, so the merge order wants coordinating) and #2487 (trackings_add_u32withsrc_sccin address high halves — address arithmetic besidethe descriptor assembly that (1) classifies). Same area, no file overlap:
#3064 (five translation fixes: image queries, scalar destinations, CalculateLOD,
partial stores, LDS negated adds) and #3336 (VICTORY_WAVE_VERIFY, a report-only
wave64 barrier checker). FSR4 topic-adjacent, host-side only: #3011 (FSR 4 on
cards without DLSS).
@T1bolus on GitHub · 2026-11-30 02:55 UTC · original
Holding this back for now rather than extending it. The in-game verification came through — 0 untranslated shaders, scenes, HUD and menu text render correctly (screenshots verified) — but the series carries a memory price that makes the title unplayable on 32 GB machines: the previously refused programs now translate, and with their sample-mask twins that roughly doubles the pipeline variants the loading phase needs (~2,585 translated shaders against ~1,720 on the tip). On a 31 GB machine the free commit falls under the floor: pipeline creation fails with E_OUTOFMEMORY from cold, and playback stutters while streaming — the tip alone holds 19-20 fps under the same conditions, verified both after a fresh boot and after hours of runs.
The fix is clear and I'm working on it: fold the sample-mask variant into the single translation (mask state as a binding, one PSO instead of two), which takes the added pipelines back near tip level. I'll reopen or follow up once that lands.
Pull request closed