Repository navigation
Shaders: test that an image read as float and used by an atomic is annotated twice - #226
gingertonik wants to merge 2 commits into
Conversation
A texture UAV read as float and used atomically in the same program got the float handle for its atomic: dxil-spirv then emitted OpAtomicOr on a float texel pointer (invalid SPIR-V), and the NVIDIA compiler crashed in vkCreateComputePipelines when GTA VI entered its world (two programs: c12c1f7296419a5b, 8358f9eef7931421). With the type in the key the atomic gets its own uint handle; all dumped SPIR-V validates.
…notated twice A synthetic compute program loads a 2D image UAV as four floats and then runs image_atomic_umin on it in the same block. The atomic must get its own one-U32 annotation next to the load's four-float one. Test builds record each annotation's property words so the test can read them. Fails on the handle cache keyed on the first property word only; passes with the element type in the key.
…used by an atomic is annotated twice) into the integration Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
|
Thanks @gingertonik for adding a focused regression case for the two resource annotations emitted from one image. I tested commit The targeted test passed (1 passed, 0 failed; 69 filtered). This validates shader IR lowering and annotation generation; it does not compile or execute the shader on a GPU. |
…rol flow; waterfall loops proven) Marvisak#566 is stacked on Marvisak#307, which this tree holds as its first two commits (the tree's resource.rs was identical to ffa6635's). The merge so also brings Marvisak#307's last two commits, 077ec8b and 6285e19. Git found upstream main as the base, which sets Marvisak#307's own lines against themselves; each file was merged with ffa6635 as the base instead. - crates/victory-shader/src/resource.rs: Marvisak#566's, unchanged (the tree had no edits of its own there). - crates/victory-shader/src/emit/lower.rs: no conflict on that base. The tree's lowering is kept (Marvisak#307's waterfall arm of v_readfirstlane before the console-flow form, fetched_index through Marvisak#483's heap guard), with Marvisak#566's Source::LanePhi arms and tests. lane_heap_index joins the indices heap_index and fetched_index return, so each is already guarded. Marvisak#226's annotation test passes the per-lane form to track. - crates/victory-shader/src/structure.rs: both sides' additions kept: MAX_MEMO (Marvisak#288) with MAX_MEET, and in Structured the wave64 stack's execs, others and pairs with Marvisak#566's reach and paired_masks. paired_masks is filled last, since it takes the masks pairs reads. - crates/victory-shader/src/emit/mod.rs: translate keeps Marvisak#309's spill forwarding and Marvisak#223's target, structures first and passes the per-lane form to track as Marvisak#566 does. The threading retry of emit passes its own. The tests' helpers (Marvisak#223's, Marvisak#306's, Marvisak#459's, Marvisak#48's) pass it too. - apps/victory/src/translate.rs: Marvisak#566's arm (Source::LanePhi is no leaf); the tree's fix already counted Fetched as loaded, as 077ec8b does. - docs/architecture.md: no conflict on that base; Marvisak#566's text. - emit/image_tests.rs (Marvisak#160), emit/lane_read_loop_tests.rs (Marvisak#439), sgpr_spill.rs (Marvisak#309, Marvisak#320): track takes the per-lane form. Helpers that return the error keep the order of failures (resources, I/O, then structure). - emit/waterfall_tests.rs (new, Marvisak#566): lower::Parts gets the tree's target, console_cf and per_lane_only; the dispatch fills Marvisak#483's guard dwords. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…isak#306 Marvisak#333 Marvisak#105 Marvisak#288 Marvisak#343 Marvisak#353 Marvisak#326 Marvisak#259 Marvisak#179 Marvisak#176 Marvisak#226 Marvisak#286) Conflicts: - emit/lower.rs: shader-opcodes and shader-tracking each keyed heap handles by the resource properties (a tuple vs two flattened words); the same key, shader-tracking's form and comment kept. Lowered's test-only fields, test imports and tests of both sides kept. - emit/wave.rs: tests of both sides kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Automated triage for the maintainers. Closing because another open pull request covers the same change. See #177. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution. |
Stacked on #177 (its commit
e55eb69is the first commit here). This adds only the test that PR was noted to lack; once #177 merges, the diff is the test alone.What
A synthetic compute program in
emit::lower::tests, in the style of the existing ones: it loads a 2D image UAV from a descriptor table as four float channels (image_load) and then runsimage_atomic_uminon the same image in the same block. The test asserts that the image is annotated twice:(0x1002, 0x409)for the load and(0x1002, 0x105)for the atomic.To let the test read the annotations, test builds record each annotation's two property words in
Shaderand hand them out throughLowered(#[cfg(test)]fields; nothing changes in a normal build).Why
#177 fixes the heap-handle cache handing an atomic the float handle of an earlier load. The expected values come from DXIL's resource properties, not from the code under test: word 0 is the resource kind (Texture2D = 2) with the UAV bit (0x1000); word 1 carries the component type in its low byte (
U32= 5,F32= 9 inDxilConstants.h'sComponentType) and the component count above it. D3D12 allows the Interlocked operations on integer UAVs only, so the atomic's annotation has to be the one-u32form.Tested
Linux x86_64, pinned toolchain, from the repository root:
d2a4bae(without Shaders: key heap handles by element type (atomic on a float-read UAV) #177) the test fails:the atomic's annotation: [(d, ffffffff), (1002, 409)]. The load's annotation is present and the atomic's is missing.e55eb69it passes.cargo test -p victory-shader: 57 passed, 0 failed.cargo fmt --all -- --check: no differences invictory-shader.cargo clippy -p victory-shader --tests: only the existingconstant_colordead-code warning on Linux.cargo xtask policy: 151 files ok. Windows MSVC release cross-build (xwin SDK,lld-link): clean.Synthetic words only; no game data.
AI-assisted (Hermes).