Repository navigation
Conversation
With a16 the address VGPRs were read as one run of 16-bit pairs. The
hardware (and image_addr_dwords, which counts them) gives each extra word
(texel offsets, bias, comparison value) a whole VGPR, pads each direction
of an odd number of gradients to whole VGPRs and begins the coordinates
in a new VGPR. image_address_place now places each address that way, so
a16 biased samples translate (the bias is the f16 in its word's low half)
and a16 gathers with an offset word read their coordinates from the right
VGPR.
image_sample_d_cl lowers to sampleGrad with the clamp that follows the
coordinates.
In a census of the title's shaders these stopped 108 ("a biased image
sample with 16-bit coordinates") and 27 (image_sample_d_cl) programs.
…a reasons
- ds_read_{u,i}{8,16}, ds_write_b{8,16} and their _d16/_d16_hi forms
read and write within their dword: reads shift and zero- or
sign-extend (d16 keeps the VGPR's other half), writes clear then set
their bits with two atomics so lanes writing other bytes of the same
dword keep theirs.
- image_sample_o, image_sample_lz_o and image_sample_l_o pass a constant
offset word as the sample's immediate offsets (each 6-bit offset
within -8..7; a computed word or a wider offset stops the program with
its own reason). image_sample_l(_o) reads its level after the extra
words.
- A buffer descriptor read as data and by s_buffer_load is sized from
its raw SRV. The other ways a scalar memory read as data stops now
have their own reasons, to tell apart the 573 programs a census of
the title stopped with "a scalar memory read as data".
Tests: LDS byte/half reads and writes run on the hardware device (one
wave with LDS takes the console's wave size, which WARP lacks); a new
image_tests module samples a 4x4 texture on hardware and WARP with
offsets, an a16 extra word, and gradients with a clamp.
|
Tested with the title at
Not tested: this PR without #318, AMD GPUs, a release build, image results. (Claude Code, Claude Opus 5.5: ran the title on both builds and compared the logs program by program.) |
|
I ran the shader crate’s unit suite at head Result: 76 passed, 0 failed, 0 ignored. Relevant checks include |
|
Review note on head On #116 fixes this in if name.starts_with("ds_read") && name.contains("_d16") {
regs(d, &mut r)?;
}This PR would need the same, plus a test that writes a known value to the destination first and checks the other half survives. Read-only review, nothing built. AI-assisted (Claude Code); the claim above was checked against this head and |
|
Measured offline against main AI-assisted. |
|
Measured on the full retail shader pack (26,503 containers) with
|
…ffsets, descriptor data # Conflicts: # crates/victory-shader/src/emit/lower.rs # crates/victory-shader/src/emit/mod.rs # crates/victory-shader/src/emit/valu_tests.rs
catminou4
left a comment
There was a problem hiding this comment.
Test-merge with current main (ffe310e) conflicts — needs a rebase. Main moved recently (PR #566 waterfall loops touched lower.rs/resource.rs/valu_tests.rs), so shader PRs opened before it need rebasing. I'll re-review once it merges cleanly.
|
Reviewed It no longer applies to Run here (Windows 11, Rust 1.98.1):
|
|
For the LDS half of this PR, #571 is the better implementation of the same ground: it handles the halfword at byte 3 by straddling into the next dword (64-bit shift on read, 64-bit mask/data on write, past-the-end clamped with reads seeing 0), where this PR documents the straddle as a shortcut that loses the spilling byte. I would land #571 for LDS and rebase this one to keep only the Both PRs share the same question about the |
|
I ran the CI clippy on head b6af8b1 (the branch has no checks):
|
|
Reproduced the flaky release-test crash on That is 2 of 6, same as your report, and The cause is that this branch's base predates the GPU-test serialization. Current /// … two GPU tests at once on WARP can end the test process with an
/// access violation. Other GPU test modules take this lock too.
pub(super) static ONE_AT_A_TIME: std::sync::Mutex<()> = …and The fix is one line after the rebase: have On @pablogonz12's two clippy points: the Nothing changed on your branch from me; this is evidence only. The shader-side substance (LDS sub-dword handling, sample offsets, descriptor-data reasons) I reviewed earlier still stands, and the #571 comparison note from before is unchanged: for the LDS half, #571 is the stronger implementation. |
… offsets, descriptor-data reasons # Conflicts: # crates/victory-shader/src/emit/lower.rs # crates/victory-shader/src/emit/valu_tests.rs
…fer accesses Brings byte and half loads/stores on buffers, flat and global memory, sub-word cbuffer reads, and structured UAVs for 64-bit atomics. Resolutions against the branch: - scalar loads through root descriptors keep Marvisak#294's built-source path; - root view bounds (Marvisak#650) gate the sub-dword and atomic paths too (atomics narrow their active lanes by the bound); - the Marvisak#383 LDS byte path uses lds_ptr and refuses 64-bit LDS atomics; - memory_tests fill root view sizes in user data, as Marvisak#650 requires. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…descriptor data # Conflicts: # crates/victory-shader/src/emit/lower.rs # crates/victory-shader/src/emit/mod.rs # crates/victory-shader/src/emit/valu_tests.rs
Builds on #318 (its commit is the first of the two here); merge that first, or this one instead of it.
What
LDS bytes and halves.
ds_read_{u,i}{8,16},ds_write_b{8,16}and their_d16/_d16_hiforms now lower within their dword:and, thenor), so lanes writing other bytes of the same dword keep theirs.Constant sample offsets.
image_sample_o,image_sample_lz_oandimage_sample_l_opass a constant offset word as the sample's immediate offsets. A computed word, or an offset outside -8..7, stops the program with its own reason.image_sample_l(_o)now reads its level after the extra words (it assumed none).Descriptor data. A buffer descriptor read as data and by
s_buffer_loadis now sized from its raw SRV, as buffer-instruction uses already were. The other paths that returned "a scalar memory read as data" now each have their own reason. The title's census stopped 573 programs with that message, and this tells the causes apart.Adds
BitcodeModule::int_value(an integer constant's value).Census buckets addressed
s_buffer_load+ raw SRV case translates)Testing
lds_byte_and_half_writes_keep_the_rest_of_the_dword/lds_byte_and_half_reads_extend_as_the_console(valu_tests): validated by dxil.dll and run on the hardware device. They need a one-wave group with LDS, which takes the console's wave size, and WARP can't run that, sorun_cases_onlets these choose backends.image_testsmodule: a synthetic program loads a UAV, a 4×4 texture and a sampler from tables and samples it. Validated, then run on hardware and WARP:image_sample_lz_owith a constant offset,image_sample_l_o(level after the offset word),image_sample_l_owith a16: coordinates in the VGPR after the offset word (the Shader: pack a16 image addresses as the hardware does; image_sample_d_cl #318 layout; the oldk / 2read the offset word as u, v),image_sample_d_cl(coordinates after the gradients, then the clamp).cargo test -p victory-shader: 76 pass (hardware: RTX 3060).cargo clippy -p victory-shaderand rustfmt clean.