Shaders: dword 0 of root constants is no address base #93
No reviewers
Labels
No labels
accessibility
bug
crash
documentation
duplicate
enhancement
good first issue
graphics
help wanted
invalid
needs logs
performance
question
rdna2
rdna3
rdna4
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/eikkapine--victory-amd!93
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-93"
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?
@murillojndem on GitHub · 2026-12-01 10:52 UTC · original
amd/root-constant-dword0-is-no-base→main· +221 −4 · 2 files · 1 commits · closed without mergingWhat
Tracer::sumtook dword 0 of every root parameter that a user SGPR holds as an address base. That is right for a table, a root descriptor or a heap, whose dword 0 is the address, but a root constant is a number, so dword 0 of root constants behaved unlike its other dwords:s_add_u32 s6, s2, s0), the sum had two bases, so the address lost the table and no root-indexed view was made. In a compute program a data load there read title memory at the sum; from reading the code, a descriptor loaded there was refused ("a descriptor outside the heaps").Change
resource.rs:sum()takes dword 0 as a base only when the parameter is notRootType::Constants, as upstream does.address()returns "an address from a root parameter that is no address" first for a pointer in root constants (any of their dwords). In a compute program an SMEM load through such a pointer with a computed soffset then reads title memory throughby_address, instead of stopping at "an address with two computed terms". This part is mine; upstream changed only thesum()arm.TRANSLATOR_VERSIONgoes from 4 to 5: a compute program that added dword 0 to a table base and read the dwords there as data translated before, reading title memory at the sum, and now reads through the table.Ported from Marvisak/VIctory@88daba4 (upstream PR 2154, by Fuzeofficial, co-author on the commit).
Tests
New tests in
resource::tests:root_constant_dword_0_offsets_tables_and_root_descriptors: dword 0 as an SMEM soffset, added to a table base, as an offset to a root descriptor (s_load_dwordandglobal_load_dword), and a 64-bit pointer in the constants.root_constant_dword_0_offsets_translate: such a program lowers, reads dword 0 as user data, uses no title memory and passes the DXIL validator.On main
5d91fdeboth fail with "an offset from a root parameter"; with this branch both pass. They run on the CPU (no device).Also run:
victory-shader --libon WARP: 311 passed, 4 failed, 4 ignored (main: 309, 4, 4). The four failures are the same on main: three fail PSV0 validation with the SDK 10.0.22621dxil.dllon this PC, anda_lane_mask_joined_with_a_number_is_read_as_the_number_it_isis a hardware-only test thatVICTORY_WARP=1sends to WARP.victory-shader --libon the RX 7900 XT (and WARP, through the same harness): 312 passed, 3 failed, 4 ignored (main: 310, 3, 4). The three failures are the PSV0 ones.cargo clippy -p victory-shader --all-targets --locked -- -D warnings, with and without--all-features: clean.cargo test -p xtask:repository_passes_policypasses.documented_switches_are_readfails, the same way as on main (VICTORY_NAMEin README.md).Limits
dxil.dlldoes not load.victory-shaderonly. My checkout leaves outcrates/victory-formats/src/bcpack-tables.bin, so I did not build-p victoryor run the workspace clippy.The same change is open as DexNom/VIctory#209.
Generated with Claude Code
Pull request closed