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#1343
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@dragoso on GitHub · 2026-11-24 17:33 UTC · original
Four open PRs lower the same instructions (
ds_read_{u,i}{8,16}[_d16[_hi]],ds_write_b{8,16}[_d16_hi]). All four are based on mainffe310e. I measured them the same way so review can pick one and close the others. I wrote #116, so I tried to measure all four by the same rules.On a retail dump (
victory translate --validate --list, dxil.dll 10.0.26100)ffe310eds_write_b16, 7 fords_read_u16.ds_read_u16_d16_hi, which #632 refuses on purpose ("an LDS read into half a register").On hardware, one form at a time
I ran #116's
lds_testsagainst each PR's lowering, with the same tests and a per-form filter. This ran on an RTX 5060 Ti and on WARP, 64 lanes. The tests check:_d16/_d16_hikeep the other half of the register;Each PR's own tests (
cargo test -p victory-shader)ffe310e. Its test callsresource::trackwith 3 arguments; main now takes the structure as a 4th.Differences that the numbers don't show
flags::INT64) and a second load. Everyds_write_b16becomes four atomics, aligned or not.inst.readof the destination. That works on main because the IR already records every vector instruction's destination as a read. The extra read #116 adds inir.rsis redundant, and I'll drop it from #116.No game data, shader bytes or shader names are included here. The counts come from a local dump.
AI-assisted (Claude Code).
@matheusfermiano-source on GitHub · 2026-11-24 18:06 UTC · original
Same comparison on two more GPUs, under Proton on Linux: a Radeon 660M (RDNA2) and an RTX 3050 Laptop. The results match the tables above.
Setup. Each PR's head with #116's
lds_tests.rsadded (plus its two lines inemit/mod.rs). Built on Linux with llvm-mingw forx86_64-pc-windows-gnullvm(Rust 1.98.1). Run under Proton Experimental 11.0-20261027b with its vkd3d-proton 3.1.0, one GPU at a time, withdxil.dllfrom DXC 1.9.2609 loaded. Radeon 660M: RADV, Mesa 26.3.1, waves 32..64. RTX 3050 Laptop: NVIDIA 620.73.04.opcodesbyte_and_halfword_readsbyte_and_halfword_writeslanes_share_dwordsvictory-shadersuite, 660M9fbd7e9*8ad9d9f3bd82328e39c10lds_testsresults are the same on both GPUs.emit::tests::stub_pipeline_is_created. It fails onmainhere too, because vkd3d-proton accepts a zeroed DXIL hash (see #1218).lower.rscallsresource::trackwith 3 arguments. I movedstructure::structureabove it and passedSome(&st), asmain's other tests do. Nothing else was changed.So on an AMD GPU as well, #101, #571 and #116 give the same results on these tests, and #632 differs only by refusing the d16 reads. These tests use waves of 32, so they say nothing about native wave64 on RDNA2.
Synthetic tests only, no game files. AI-assisted (Claude Code, Opus 5.5); every run was on this machine.
@MoonYueya on GitHub · 2026-11-24 18:20 UTC · original
Useful comparison — the per-form hardware runs are the part that decides between #101, #571 and #116, which the validated counts alone cannot.
One implementation choice that is orthogonal to which PR you pick, in case it helps settle the write side.
ds_write_b8/ds_write_b16update part of a dword, so a plain store clobbers the neighbouring bytes; andds_read_u8/ds_read_i16and friends read a sub-range and sign-extend for theiforms. We express the partial write as a masked read-modify-write:and the read side as
(slot >> shift) & mask, sign-extended for the signed forms. The atomics are not for concurrency — they are the portable way to say "write these bits, leave the others" on agroupsharedslot without a second pass.Two things we would check in whichever PR wins, because both are easy to get subtly wrong and neither shows up in a validated-program count:
_d16/_d16_himust leave the other half of the destination register untouched. #1343 already notes #632 refusesds_read_u16_d16_hion purpose — that is the right call for a partial implementation, but it means the winning PR needs the "keep the other half" test as a first-class case, not a rounding-up.(AI-assisted write-up, checked against our own LDS lowering.)
Context: failure measurements in #1481.
@wildheathen on GitHub · 2026-11-24 18:59 UTC · original · edited 2026-11-24 19:04 UTC
Independent re-run on an RTX 5080: the tables above hold. I'm not the author of any of the four PRs. Same heads as in this issue: #101
9fbd7e9, #5718ad9d9f, #6323bd8232, #1168e39c10, all on mainffe310e. (#116 has since moved toc853a6a; see the update at the end.)Setup: Windows 11, RTX 5080 (driver 32.0.16.2124, the default D3D12 adapter here) plus WARP, dxil.dll 10.0.26100, Rust 1.98.1 MSVC. Release builds, each in its own target dir.
Retail dump (
victory translate --validate --list)an LDS read into half a register. That is its deliberate_d16_hirefusal.#116's
lds_testsrun against each PR's lowering (RTX 5080, then WARP)lds_tests.rscopied from #116 into each branch, with nothing changed in it.an LDS read into half a register(by design)Totals for
cargo test -p victory-shader, each PR's own tests plus the fourlds_tests: #101 125, #571 128, #632 126 (+1 failure, as above), #116 125.Notes
resource::tracknow takes the structure as a 4th argument. To run it I movedstructure::structure(&p)up and passedSome(&st). That's one line in the test, not in the lowering. With that change #101 behaves like the others. This is also the CI failure on #101.hardware: compute_pipeline failed: The parameter is incorrect(valu_tests.rs:208/:212). The runner's "hardware" device has no GPU behind it. The same tests pass here on the 5080 and on WARP, and main's GPU tests pass on that runner. So this looks like the runner's device refusing these pipelines rather than a lowering bug, but I haven't found which feature it is. #571's 64-bit arithmetic would be my first guess.cargo fmt --checkreports differences on all four, but also on main itself, so that's not on these PRs.That leaves the choice where this issue put it. #571 and, since
c853a6a, #116 handle a halfword straddling two dwords; #571 does it with 64-bit arithmetic and four atomics perds_write_b16. #632 drops_d16_hireads and so misses 2 programs. At8e39c10, #101 and #116 behaved the same on everything measured here; the update below shows where they now differ.No game data, shader bytes or shader names are included; counts come from a local dump.
Update: #116 at
c853a6aEdited after posting: #116 moved to
c853a6awhile I was writing this, and it now handles straddling halfwords too.Re-run at #116
c853a6a, same machine (RTX 5080, then WARP):cargo test -p victory-shader: 125 passed, the fourlds_testsincluded.lower.rsandlds_tests.rs, and adds no process, network or file access.#116's updated
lds_tests(they now cover every byte from 2 to 7, odd and straddling halfwords included), run against each PR's lowering:ds_read_i16at 1+2:0xffff8281, want0xffff9882)0x00000082, want0xffff9882)c853a6aSo on the straddling case, #571 and #116 now agree with the tests' model (which #116 says was measured on RDNA2), and #101 and #632 don't. On the dump none of this changes a count. Whether the title ever issues a straddling halfword is something only a runtime trace would tell.
AI-assisted (Claude Code).
@tumbubu on GitHub · 2026-11-24 22:10 UTC · original
The four byte/halfword LDS PRs on AMD's Windows driver (RDNA3)
These are the same measurements as the hardware table above (RTX 5060 Ti and WARP), now on AMD:
dxil.dllfrom SDK 10.0.26100#116's current
lds_tests(c853a6a) run against each PR's lowering, with the file copied onto each head along with its twomod.rslines. Sincec853a6athe tests also cover a halfword at byte 3, which straddles two dwords:opcodesc853a6a8ad9d9f9fbd7e93bd8232The failures are all on the straddling halfword. The aligned halfword at byte 2 passes on every head.
ds_read_i16at 1+2 (want0xffff9882)ds_write_b16at 30xffff82810x56787f01, want0x78817f010x000000820xfedcba98, want0xfedcba56Each test stops at its first wrong lane, so later forms in the same test are not reached.
With #116's earlier tests (
8e39c10, aligned halfwords only), every PR passed every column on this card. The one exception was #632's d16 reads, which it refuses by design ("an LDS read into half a register"). So the straddling halfword is the only difference between the four PRs, on AMD as on NVIDIA. Whether the console's titles issue such accesses is the question #116's "measured on RDNA2" comment answers. This run only shows which lowerings model them.Each PR's own tests,
cargo test -p victory-shader --locked -- --test-threads=1:mainffe310e. Its test atlower.rs:7471callsresource::trackwith 3 arguments; buildingstfirst and passingSome(&st)as the 4th argument, asmain's other tests do, is enough. With that local fix: 121 passed.lds_testsc853a6aSynthetic tests only, no game files. AI-assisted (Claude Code); every run was on this machine.
@Marvisak on GitHub · 2026-11-25 10:16 UTC · original
Automated triage for the maintainers.
Thanks for the comparison and the hardware runs on NVIDIA, AMD and WARP. Since then,
mainlowers these forms itself (0b35b7f): theds_readandds_writearms of the LDS lowering incrates/victory-shader/src/emit/lower.rshandle_u8/_i8/_u16/_i16,_d16and_d16_hireads (keeping the other half) andb8/b16writes through atomic AND/OR. #101, #571, #632 and #116 have all been closed.What
maindoes not cover is the halfword that straddles two dwords: it reads and writes only the dword holding the address (a comment there takes LDS addresses as aligned to what they access). That is the case where #101 and #632 failed in the runs above. Open PR #1795 carries it with the hardware tests, so review of the remaining part can continue there.Generated by Claude Code