Repository navigation
Conversation
…table a root constant holds The bakes' descriptor dwords survive register shuffles the console compiler interleaves (the three-xor swap keeps every value), and their tables live at a byte a root constant holds. The classifier follows both: an xor chain nets to the term its leaves reduce to, a dword is read through the same place the trace pass falls back to, and the second dword keeps its low half under an xor with none of its bits set. A descriptor the code assembles from its load and constants, or patches after it (a stride cleared, a size recomputed, flags set), is the load's. (Port of the fork's 8e3e231, wave 5, with c77bde8's wiring: the assembled and patched sources hang from classify ahead of `loaded` and behind it, the address tests take the dynamic2 form, and the three-computed-terms refusal folds into the code table. The built descriptor's address falls back to title memory as it stands where it refuses, as the fork's own line has it since before the wave — its test rides on that.)
… the code only patches The console compiler picks descriptors from the heap by an index it computes over a base dword; the records of other programs name that dword the resource heap root, which the host binds to zero, and those programs translated and ran. For the programs whose records miss the name, the gate walks every read of the dword and binds zero where they all reach a heap load the heap machinery recomputes from the load's own operands; a read that goes anywhere else keeps the refusal. A descriptor dword the code recomputes in place (a stride cleared, flag bits set, often through a join the trace followed) reads back only as the patch's input: the walk from the read to the descriptor operands the trace took to the load proves it, and the dword stays undefined, the handle coming from the load's own operands all the same. Both walks stop at a fixed visit count - they run in the bake at game start and must never hang it - and refuse past it. (The descriptor arms live in emit/descriptor_data.rs here, extracted from lower.rs; the walks stay beside `inputs`.) (cherry picked from commit b0650fa)
…uilt from constants The console compiler builds samplers in code (s_movk_i32, s_bfm_b32 and s_bfm_b64 over inline constants) and reads structured buffers whose stride the layout's record does not give. The classifier folds terms computed from constants alone to their values, so such a sampler registers as the constant it is. An access by index through a descriptor whose dwords are the entry's own (recorded exact per access) runs at the host's stride for its heap slot, as a raw one at the element's byte; a descriptor the code recomputed keeps the code's stride and stays refused. Ported from fsr4-upstream ebe95b4 with the follow-up fix ffff8b1 folded in: the table gate keeps records of constant buffer views out (the host's stride table holds nothing for constant buffer slots, so element * stride would collapse to element 0; the console's CBV descriptor strides by its 16-byte rows, which the constant-buffer path below keeps).
…t copy of that memory The console builds a descriptor over an address it computes (an add of two dwords no root parameter gives) and reads its tables through it. The route runs only for the descriptors it names — the source must be Built with resource::MEMORY for the address — and rides on the host-copy machinery the root views lower through: the sum and carry `root_memory` makes of the address and the offset, the copy `memory` serves, and the handle stashed in `root_copy` for the rest of the instruction. The scalar-memory path reads the dwords the load names, and the buffer path hands the byte on to the load, store or atomic it lowers; stores included, an indexed access stays out, for the built descriptor names no stride the translation knows. Upstream's tip folds the encodings it can and refuses the rest, and these are the ones it cannot fold.
…alues The console compiler saves the wave's state at the start through the pair a move writes (s_mov_b32 s143, exec_lo), which reads the mask the wave started with, and reads its VCC and M0 the same way before anything wrote them. No program depends on what the wave was given: VCC and M0 are the code's to set before any read of theirs, so those inputs lower to the values that holds (zero, as the uninitialized registers do) instead of stopping as hardware inputs the host does not give. Entry EXEC stays with upstream's own machinery: a program dispatched with a thread count takes the count's mask there, and both their test and ours hold.
the table gate let an indexed access through a table slot the records do not name run at the host's stride word for that slot; the host writes zero there for constant-buffer views (view_elements decodes only srv/uav buffer views), so element * stride could collapse to element 0 - the missing glyphs the sixteen-byte stride fix removed on the other line. a table-rooted access now needs the record's proof (a stride-0 structured one) to leave the index to the table; the view heap keeps upstream's own gate. the 770 stride-0 structured reads the records name keep the table path, and no shader of the 6531-dump sweep reaches the refused form.
…escriptors and route their reads trustno1-coder#3380 by T1bolus, head 9e5f94e.
|
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. |
Fixes #
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: Shaders: vector buffer loads through a descriptor built around a table in the code #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 Shaders: track s_add_u32 with src_scc in address high halves #2487 (trackings_add_u32withsrc_sccin address high halves — address arithmetic besidethe descriptor assembly that (1) classifies). Same area, no file overlap:
Shaders: five translation fixes from cool_fox and VIctory-NVIDIA-RT (image queries, scalar destinations, CalculateLOD on arrays, partial stores, LDS negated adds) #3064 (five translation fixes: image queries, scalar destinations, CalculateLOD,
partial stores, LDS negated adds) and Shaders: VICTORY_WAVE_VERIFY=check, a report-only checker that proves wave64 forms meet their group barriers #3336 (VICTORY_WAVE_VERIFY, a report-only
wave64 barrier checker). FSR4 topic-adjacent, host-side only: FSR 4 on cards without DLSS: Series X upscaler, upscaler DLL download, docs #3011 (FSR 4 on
cards without DLSS).