Shaders: ds_wrap_rtn_b32 reads both of its data operands #2789
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!2789
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2789"
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?
@lcg007xd-c on GitHub · 2026-11-25 20:27 UTC · original
lcg007xd-c:gfx10/ds-wrap-two-data→main· +15 −1 · 2 files · 1 commits · openWhat this fixes
ds_wrap_rtn_b32computestmp >= DATA0 ? tmp - DATA0 : tmp + DATA1(RDNA2 ISA), so it reads two data VGPRs. The decoder gave it only one: DATA1 was neither printed in SP3 text nor reported as a register read.I found it while diffing about 15.5k encodings with valid operands, covering every opcode of every encoding, between
gfx10::decodeandllvm-mc --disassemble -mcpu=gfx1030. Outside known aliases and already-claimed items, this was one of the few remaining disagreements.The change
fields.rs:ds_wrap_rtn_b32joins the two-data branch withcmpst/mskor. The lowering doesn't handle this opcode yet, so nothing that translates today changes.Tested (Linux, Rust 1.98.1)
gfx10::sp3::tests::ds_wrap_reads_both_data_operands, checked against llvm-mc's text. It fails without the change (v6missing) and passes with it.cargo test -p victory-shader --lib: 159 passed, 0 failed, 2 ignored. Building the shader tests on Linux needs #2766.cargo clippy -p victory-shader --all-targets --target x86_64-pc-windows-msvc -- -D warnings: clean.rustfmt --checkon both files: clean.🤖 Generated with Claude Code
@kotekompotek on GitHub · 2026-11-25 20:37 UTC · original
Matches the ISA: ds_wrap_rtn_b32 wraps lane indices as (tid + DATA1 - DATA0), so both data operands are live reads. The llvm-mc encoding in the test confirms DATA0/DATA1 map to v4/v6.
@fuzeofficlal on GitHub · 2026-11-25 20:46 UTC · original
Reviewed and verified
d80aedfcon Windows 11 againstmain(13f91ca).name == "ds_wrap_rtn_b32"to the 2-data-operand branch infields.rs:314-320matches RDNA2 ISA (DATA0andDATA1), producing the expectedds_wrap_rtn_b32 v8, v2, v4, v6 offset:16disassembly and recording both VGPR source reads inir.rs, while leavingds_inc_*/ds_dec_*at 1 data operand.cargo test --locked -p victory-shader --lib -- gfx10::: 17/17 passed (includingds_wrap_reads_both_data_operands);ir::: 9/9 passed.cargo clippy --locked -p victory-shader --all-targets -- -D warnings(default &--features host): 0 warnings;cargo xtask policy: 184 files ok; cleangit merge-treevs13f91caand#2783.@oni-swr on GitHub · 2026-11-25 20:58 UTC · original
WARP/CPU verification of head
d80aedfc43bb539b4e0b95d682864fe5dde873b2Environment: Windows 11 x64, rustc/cargo 1.98.1, WARP/CPU only (VICTORY_WARP=1, VICTORY_D3D12_WARP=1), no physical GPU, no game files. DXIL validation with Windows SDK 10.0.26100.0 x64 dxil.dll 1.8.2502.11. PR head merged cleanly onto origin/main
13f91caee2.Tests (
cargo test --no-fail-fast -p victory-shader)origin/mainbaseline: 267 passed, 3 failed, 3 ignored.gfx10::sp3::tests::ds_wrap_reads_both_data_operands).origin/main, unrelated (a_mask_joined_with_data_at_a_uniform_loop_is_its_number,gathers_at_a_level_match_the_hardware,permutes_read_the_lane_named_and_zero_from_lanes_left_out; they compare against hardware lane results and fail on WARP).Negative control: with the
ds_wrap_rtn_b32clause disabled, the new test fails (ds_wrap_rtn_b32 v8, v2, v4 offset:16instead of... v2, v4, v6 ...).Lint:
cargo clippy --all-targets -- -D warningsclean.cargo fmt --check: no new hunks (891 on main, 891 with the PR). Note:cargo fmt --checkis already red onorigin/mainhere (891 hunks, none from these PRs), so I compared per-file hunk counts against that baseline.Review: read the full diff. The change is minimal and the test matches the described operand semantics (DATA0 subtracted, DATA1 added). No game files, dumps, shader names, or retail hashes.
AI disclosure: this verification was done by Claude Code (Claude Sonnet 5.5).
@Marvisak on GitHub · 2026-11-25 23:21 UTC · original
Automated triage for the maintainers.
This PR adds
ds_wrap_rtn_b32to the two-data-operand branch inInstructionfield decoding (crates/victory-shader/src/gfx10/fields.rs), so DATA1 is printed and reported as a VGPR read. This matches the RDNA2 ISA (the result uses both DATA and DATA2) and llvm-mc's gfx1030 disassembly quoted in the newds_wrap_reads_both_data_operandstest. The opcode is not lowered yet, so nothing that translates today changes. CI passes.This is a recommendation for a maintainer to look, not an approval.
Generated by Claude Code
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.