Shaders: odd-address two-byte typed buffer loads read zero #3572
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!3572
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3572"
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?
@Moon0755 on GitHub · 2026-11-27 18:42 UTC · original
Moon0755:fix/typed-load-odd-align→main· +50 −8 · 2 files · 1 commits · openOn RDNA2 (
gfx1036, measured natively in wave32 and wave64 across all two-byte buffer format codes7..=19in Leonidadocs/design.md), two-byte MUBUF/MTBUF typed format loads at an odd effective byte address behave as out-of-bounds and return0for fetched channels while constant-1 descriptor selectors keep1. Onmain,Lower::format_loadstill shifted out the enclosing dword at odd byte offsets.Changes
crates/victory-shader/src/emit/lower.rs(Lower::format_load,521,074bytes /+511vsmain,3,214bytes below the524,288limit):total == 16, select0for the fetched word when(off & 1) != 0, keeping(0, 0, 0, 1)for channels beyond the format.crates/victory-shader/src/emit/valu_tests.rs:two_byte_tbuffer_loads_at_odd_byte_offsets_read_zerocoveringtbuffer_load_format_x(16_UINT, format11) at byte offsets0..=3(MTBUF encoding verified withllvm-mc -triple=amdgcn -mcpu=gfx1013, LLVM23.1.5).Verification
main): https://github.com/Moon0755/VIctory/actions/runs/46049529068 (failure— 302 passed, 1 failed solely ontwo_byte_tbuffer_loads_at_odd_byte_offsets_read_zero:warp: 16_UINT at byte 1 = 0x00003456, want 0x00000000)devin/ci-typed-load-align): https://github.com/Moon0755/VIctory/actions/runs/46049700459 (success— 303 passed / 0 failed, Clippy + diagnostics Clippy clean,asset policy: 191 files ok)5c71be8):two_byte_tbuffer_loads_at_odd_byte_offsets_read_zero(1/1) andtbuffer(2/2) pass on hardware + WARP; both Clippy configs andcargo xtask policy(191 files ok) clean.offen,idxen, dynamic offsets, odd V# base parity, formats other than16_UINTin the synthetic test,DST_SEL/sNaN,dxil.dll1.7, game files. Synthetic tests only (AI-assisted).— Devin & Neon
@oni-swr on GitHub · 2026-11-27 19:29 UTC · original
Verification of #3572 (head
5c71be8260), independent, WARP only.Environment: Windows 11 Pro 10.0.26200, WARP d3d10warp.dll 10.0.26100.9818 (VICTORY_WARP=1 and VICTORY_D3D12_WARP=1, no physical GPU used), dxil.dll 1.8.2502.11 (SDK 10.0.26100.0), rustc 1.98.1. Base origin/main
63bcca43c6.Command:
cargo test -p victory-shader --lib --locked -j 4 -- --test-threads=1.Baseline: on base, 298 passed / 4 failed / 3 ignored. The 4 failures are WARP lane-emulation tests in
synthetic_tests(a_mask_joined_with_data_at_a_uniform_loop_is_its_number, gathers_at_a_level_match_the_hardware, permutes_mask_high_address_bits_and_divergent_branches, permutes_read_the_lane_named_and_zero_from_lanes_left_out). They fail identically on base, each head and the merge, so they are not caused by either PR.valu_tests.rshunk:two_byte_tbuffer_loads_at_odd_byte_offsets_read_zeroFAILS (16_UINT at byte 1 read 0x3456, want 0) as the PR claims.cargo clippy -p victory-shader --all-targets --locked -- -D warnings: clean (I did not run the whole workspace).Lower::format_load(total < 32), selecting 0 whentotal == 16and the byte address is odd. Correct for what the test asserts. It applies to every 16-bit-total format (16_UINT and also 8_8), and the behaviour is invariant of wave size. Finding (not a blocker): the "console reads zero at an odd address" claim cannot be confirmed without console or hardware reference data; WARP only checks our lowering matches the PR's stated expectation. Note also the test's backend label says "hardware" even when WARP is forced.Verdict: no defect found. AI use: this check was run by Claude Code (Claude Sonnet 5.5).
@kilolimaVI on GitHub · 2026-11-27 19:36 UTC · original
Hardware run, head
5c71be8: Windows 11, Radeon 780M (RDNA3 iGPU), toolchain 1.98.1.two_byte_tbuffer_loads_at_odd_byte_offsets_read_zero: passes, 0/5 failures over 5 runs.cargo test -p victory-shaderon the 780M: 303 passed, 0 failed.AI-assisted (Claude).
@kilolimaVI on GitHub · 2026-11-27 19:57 UTC · original
Before/after on the same 780M: with this PR's test file on main
63bcca4,two_byte_tbuffer_loads_at_odd_byte_offsets_read_zerofails on hardware (16_UINT at byte 1 = 0x00003456, want 0x00000000); with the PR it passes (0/5 failures above). So the bug is real on RDNA3 and this fixes it.AI-assisted (Claude).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.