Repository navigation
Shaders: recover record counts for descriptor-only structured buffers - #329
Raxstreams wants to merge 1 commit into
Conversation
|
Tested
So on this title the PR's case covers one of the programs with this reason. The other 20 load the descriptor in some other way than a static table load at an exact binding offset with a native structured stride, or lack one of the conditions the PR checks. I have not looked at which. Not tested
(Claude Code, Claude Opus 5.5: ran the title on both builds and compared the logs program by program.) |
|
Measured
19 more programs translate (18 pixel, 1 compute); none that translate on AI-assisted. |
|
Follow-up to the overlap question above, from the same logs: the 19 programs this PR makes translate do not translate with #180 ( AI-assisted. |
…Marvisak#329) A program that only reads NUM_RECORDS from a descriptor has no resource use to tell lowering what the descriptor is, so it stopped with "a descriptor read only as data". When the read is statically addressed and PSV0 declares a structured buffer at exactly that table binding, lower it to a structured raw handle and read the count through getDimensions. Only an exact four-dword table binding (table_offset_dwords * 4 equals the scalar offset), no computed address, stride 4..=2048 in multiples of 4, and a matching structured PSV0 declaration qualify. Other data-only descriptor reads keep their previous handling.
Brings in Marvisak#704/Marvisak#193 raw-view stride table and VSH3 cache, Marvisak#329 PSV record counts, and precise copy invalidation. Kept Marvisak#54's host wave range and Marvisak#298's spilled-mask resolution; Parts now carries psv, options and host_waves, and test initializers cover all three.
mercuryVM
left a comment
There was a problem hiding this comment.
Tested 02564c5 on Windows 11, RTX 5070, MSVC: cargo test -p victory-shader -- --test-threads=1 70 passed, and cargo clippy -p victory-shader --all-targets is clean. victory translate --validate --pipelines on the local title executable still reports 12 of 12 programs, so the new path isn't hit there. The PR adds no tests.
The guards are careful: a static table load only, exact table_offset_dwords * 4 match, 4 dwords, SRV or UAV, a stride of 4 to 2048 that's a multiple of 4, and every covering PSV0 declaration structured. That's the right shape, since a wrong guess here mis-annotates a handle. Two requests before approving:
- A test: a synthetic compute program with
s_load_dwordx4of a table entry whoseNUM_RECORDSdword only feeds a compare, with matching PSV0 and nativeused. One case where it lowers toGetDimensionswith the stride annotation, and one where the PSV0 declaration is typed or raw and it still refuses. Nothing in the suite reaches theNonearm today. declares_structured_bufferreads PSV0's resource table with a hard-coded layout (infosize at 0, count and stride at4 + info). That holds for the PSV versions dxc emits today, but a short comment naming the PSV version it assumes would help the next change there.
AI-assisted (Claude Code).
Merge upstream main, retain both shader regression tests, and pass absent PSV metadata in the three synthetic fixtures that construct lowering inputs directly. Refs: Marvisak#136, Marvisak#329, Marvisak#437
|
Automated triage for the maintainers. Needs rebase. This PR does not merge cleanly into current The content has not been reviewed yet; it will be once the branch is rebased onto Generated by Claude Code |
…d only through their descriptor) into the integration Our descriptor data keeps its skewed and twin loads and the runtime stride table of Marvisak#193; the PR's new case (a four-dword structured buffer the program only counts the records of) joins our image-only case in the branch for descriptors nothing else uses. Parts gains psv; the PR's emit-based test helper replaces the hand-built one in valu_tests and names the target. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
Some compute shaders load a four-dword buffer descriptor and test its record count without ever issuing a buffer access. The emitter previously needed a resource instruction to infer the view type and stopped at
a descriptor read only as data.For a static table load at an exact binding offset, the emitter can recover the record count with
GetDimensionswhen the native metadata supplies a valid structured stride and the original PSV0 declarations confirm a structured buffer. Conflicting declarations across register spaces, unknown bindings, and dynamic ranges keep the existing unsupported path.On Windows with an RTX 3080 Ti, the isolated
CS_MinTimestepReduceshader validated and created a D3D12 compute pipeline on this branch, based on upstream main. A synthetic GPU test checks the actual returned counts for buffers with 3 and 11 records and covers conflicting declarations. All 70 shader library tests and the repository asset-policy check passed.This is independent of the SGPR spill work in #298 and #309 and leaves the world-rendering issue open.