Shaders: treat RootType::Constants dword 0 as an offset in Tracer::sum #2154
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2154
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2154/head"
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?
@fuzeofficlal on GitHub · 2026-11-25 06:23 UTC · original
fuzeofficlal:fix/shader-root-constant-dword0-offset→main· +248 −1 · 1 files · 1 commits · merged 2026-11-25 21:54 UTCProblem
Tracer::sum(crates/victory-shader/src/resource.rs:670) treatsparam_value(v) == Some((_, 0))as an addressbaseregardless ofRootType. When a shader usesdword 0of aRootType::Constantsparameter (either in an entry SGPR or loaded from spilledUSER_DATA) as a 32-bit byte offset — whereasdword 1, 2, ...work — two cases fail:soffsetorglobal_*vaddroffset fails withErr("an offset from a root parameter").RootType::Table,ResourceHeap, orDescriptorbase vias_add_u32hitsx.base.is_some() && y.base.is_some()and discards the table/descriptor base.Changes
RootType::Constantsfrom theSome((p, 0)) => Sum { base: Some(v), .. }arm inTracer::sum(64-bit pointer pairs(dword 0, dword 1)inRootType::Constantscontinue to route toMEMORYviaTracer::address).root_constant_zero_offsets_tables_and_root_descriptorsandroot_constant_zero_offsets_emit_to_dxilcovering direct and spilleddword 0offsets on descriptor tables and root descriptors alongside 64-bitMEMORYpointer pairs (dxil.dllvalidated).@Dathinel on GitHub · 2026-11-25 06:26 UTC · original
I checked the shared-address case against #139, which changes the same tracer. To reproduce, take its
shared_address_keeps_its_dynamic_term_and_wraps_offsetsfixture and change the layout passed totrackfrom&[TABLE]to:This leaves the table at s8 and makes s9 the first dword of a constants parameter. On
940d32f, with or without #139, tracking succeeds but classifies both reads asMEMORYwith zero offset and no dynamic term. On3a314c8, both resolve to table parameter 0 and retain the SSA value for s9, with offsets0xfffffff4and4after wraparound. The clean merge with #139 (tree7b00ee15) gives the same expected result.This covers the tracker output for those two reads. Cache-hit rates and GPU execution were outside this test. AI-assisted.
@andrewpozdnakov7-jpg on GitHub · 2026-11-25 07:01 UTC · original
I ran your mixed table and root-descriptor fixture through an actual WARP dispatch. On
940d32f69bit fails at translation with "an offset from a root parameter". On3a314c8845DXIL validates, then constant dword 0 selects the expected table entry and offsets the root SRV. At byte offsets 0 and 64 the two output buffers read [103, 0] and [0, 207], respectively.d886064 is a test-only commit on that exact head. It reuses the existing synthetic program. Run the new readback explicitly with root_constant_zero_offsets_dispatch_to_the_selected_buffer --ignored. Strict shader Clippy and staged asset policy passed. The full forced-WARP suite on your head was 246 passed, 3 failed, 4 ignored, with the three failures also present in the main comparison.
@sinan-cmyk on GitHub · 2026-11-25 08:13 UTC · original
Offline measurement on a retail dump
Result: no count change against
main.I merged head
3a314c88ontomain940d32f(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 23,918 onmain, 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 on GitHub · 2026-11-25 11:26 UTC · original
Automated triage for the maintainers.
Merge candidate.
Tracer::sum(crates/victory-shader/src/resource.rs) took dword 0 of any root parameter as an address base, includingRootType::Constants, while dwords 1 and up of the same parameter were treated as dynamic terms. So a 32-bit constant in dword 0 used as an SMEMsoffsetfailed with "an offset from a root parameter". Added to a table or descriptor base, it tripped thex.base.is_some() && y.base.is_some()check, and the real base was lost. The one-line guard makes dword 0 of a constants parameter a dynamic term like the other dwords.I checked that a constants (dword 0, dword 1) pair used as a 64-bit pointer still ends at
MEMORY. With no base,traced_addressreturnswhy_no_base's "an address from a root parameter that is no address", whichTracer::addressmaps toMEMORYas before. The tests cover direct and spilled dword 0 on tables and root descriptors, plus that pointer case.A WARP readback and the #139 fixture check posted in the thread agree. A whole-title offline count shows no validation change, so this is a correctness fix with no measured title effect yet. CI: passing (
check).Generated by Claude Code