Repository navigation
runtime: bind 1D, 2D-array and 3D texture SRVs for published native compute - #3306
Conversation
…ompute The published compute manifest now carries `srv N tex1d|tex3d|tex2da table R B` for texture SRVs of those dimensions (cube and multisampled ones keep their named refusal). The Dispatch reader takes the name as the slot's dimension; for 1D, 2D-array and 3D it needs the title's described view of that dimension that fits its texture (address_view_fits: same or typeless-family format, mips and slices inside, no LOD clamp), otherwise the Dispatch is refused by name. An accepted tex2d line binds as before. The refusal text for an srv line that is not read now names the new dimensions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EF3hKGcUDvQ6pxjDDMrvbn
|
I merged Conflict and how I resolved it. Only
What I ran. I built the whole tree in ctest --test-dir out/build/<preset> --no-tests=error -j 4 -R '^(startup_compute_.*|native_compute_.*|startup_stream_(check|consumer.*)|direct_compute.*)$' -E '(_hardware$|startup_audio_)'
ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '^(startup_compute_.*)_hardware$'
This needs a review from someone other than me before it can be merged. Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088 and WARP 10.0.26100.9818, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Python 3.12.10. This reply was AI-assisted. |
|
Thanks for this. I reviewed head
Nits (none blocking):
This comment was AI-assisted. |
pigalot
left a comment
There was a problem hiding this comment.
I reviewed e59c5042 on Windows (your change plus b's merge of main). It does what the description says, and the tests are solid, so I'm approving.
Merge of main. git show --remerge-diff e59c5042 shows one conflicted file, src/startup_stubs/d3d12_compute_dispatch.inl. All three hunks keep both sides: the header comment lists the bufhalf output and the new SRV names; the ComputeTranslation slot holds both srv_dimension and half_buffer_bytes; and the reader keeps your SRV line next to main's resheap line, with your SRV catch-all message and main's "an unsupported compute output view". A trial merge over current main (c3204a9c) is clean, and git diff --cached --check reports no problems.
What I checked in the code.
- The writer publishes
tex1d/tex2d/tex3d/tex2dafor image dimensions 0/1/2/5 witharray_count1 only. Cube (3) and the array-count case still get their view-shape refusal. - The reader takes the name with
%15sinto the 16-bytenamebuffer and accepts it only when it maps to an SRV dimension. Any other name,bufincluded, falls through to the later branches as before. - For the three new dimensions, Dispatch requires a recorded description, the manifest's
ViewDimension, andaddress_view_fits.address_view_fitsalso checks the resource's dimension (1D needs a 1D resource withDepthOrArraySize1, and 3D needs a 3D resource), so a view is never created over a resource of another dimension. The 2D path is unchanged.
Testing on the trial merge, ctest --test-dir out/build/<preset> --no-tests=error -R '^(startup_compute.*|native_compile_dxil.*|direct_compute.*|.*compute_manifest.*)$':
devandrelease: 100 of 103 pass in each. The 3 capability skips arestartup_compute_descriptor_scc_warp,startup_compute_dispatch_native_warpandstartup_compute_half_buffer_uav_warp.- The
_hardwarevariants, under a GPU lock with-j 1andX2W_TEST_DEBUG_LAYER=1: 75 of 75 pass in each preset, includingstartup_compute_dispatch_texture_dims_hardware. - Full non-hardware suite in
dev: 2052 of 2052 pass.
Mutants, each rebuilt in dev and run against native_compute_manifest_reasons, startup_compute_dispatch_texture_dims_warp and startup_compute_dispatch_texture_warp:
| Mutant | Result |
|---|---|
writer names dimension 0 tex2d |
killed (native_compute_manifest_reasons) |
| writer drops dimension 2 (3D) | killed (native_compute_manifest_reasons) |
writer ignores array_count |
killed (native_compute_manifest_reasons) |
writer also publishes cube as tex2da |
killed (native_compute_manifest_reasons) |
reader maps tex2da to 2D |
killed (_dims_warp: 288 words differ) |
reader drops tex3d |
killed (_dims_warp: the tex3d control refused as an unknown resource) |
| reader never stores the dimension | killed (_dims_warp and the existing startup_compute_dispatch_texture_warp) |
| no "no recorded view description" check | killed (_dims_warp) |
no ViewDimension check |
killed (_dims_warp: the mismatch control dispatched) |
no address_view_fits check |
killed (_dims_warp: the clamped control dispatched) |
| new branch removed (every SRV treated as 2D) | killed (_dims_warp) |
| packed-format check in the new branch removed | survives |
Non-blocking. The packed-format refusal in the new branch has no case. The 2D path's packed check is marked as a shortcut until its first user, so this matches it. A one-line control with a packed view format on one of the new dimensions would pin it, if you want to add one here or later.
Verdict: approve at e59c5042.
Environment: Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; Python 3.12.10; NVIDIA GeForce RTX 5090, driver 32.0.16.1088, D3D12 debug layer on for the hardware runs; WARP for the _warp tests.
This reply was AI-assisted.
Conflicts resolved by hand: - src/startup_stubs/d3d12_compute_dispatch.inl, translate_compute_natively: main's exact-width typed outputs (R0Y00#3243, exact_texture_uav_channels and slot.channels) are kept beside R0Y00#3049's four-channel float outputs, 2D texture inputs and scalar buffer inputs. Each side keeps its own dimension mapping. A 2D texture input sets slot.srv_dimension, which the dispatch path reads since R0Y00#3306. - tests/startup_stream_consumer.cpp, texture_slot67: main's texture-exact-* modes and R0Y00#3049's native input modes are both volume modes. - docs/startup-runtime.md: R0Y00#3049's list of bound views, with main's sentence on published 1D, 2D-array and 3D texture SRVs. AI-assisted. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
Change
A published native compute manifest (
compile_dxil --requests) can now name 1D, 2D-array and 3D texture SRVs:srv N tex1d|tex2da|tex3d table R B, fortexture_srvwitharray_count1. The stand-in Dispatch binds the title's view for them, or refuses with a named reason.tex2dbehaves as before.Refs #3224 (the texture SRV part I claimed there; typed buffers stay with @Not-Saii).
src/direct_compute_cache.cpp): image_dimension 0/2/5 now publish. Cube (3) and MSAA keep their view-shape refusal from compute: name why a compiled program gets no runtime manifest #3268.d3d12_compute_dispatch.inl): the new dims need a recorded title view description whoseViewDimensionmatches the line, and the view must passaddress_view_fits(same format or typeless parent, mips/slices inside the texture, MinLODClamp 0). Otherwise the dispatch is refused with "has no recorded view description", "view is not " or "view does not fit its texture". This is stricter than the draw path, which binds null on a mismatch; the docs say so.Cube is left for a follow-up: the translator declares cube samples as TextureCubeArray, so the SRV needs a TEXTURECUBE → TEXTURECUBEARRAY view.
Verification
Build of this branch on
main6c5f4ed. Windows 11 26200, RTX 3080 (32.0.16.2124) and WARP, DXC 1.8.2502.11.170/170 passed. The 2 skips (
startup_compute_descriptor_scc_warp,startup_compute_dispatch_native_warp) also skip onmain.New tests:
native_compute_manifest_reasons: exact published lines for 1d, 2d-array and 3d; image_dimension 3 still gets "SRV kind texture_srv cube".startup_compute_dispatch_texture_dims_{warp,hardware}: one program per dim (1D image_sample_lz, 2D-array slice > 0 and 3D z > 0 image_load) writing to a raw UAV. On both adapters 320 words match the texel and 288 written words change. Each control is refused with the output untouched: a view of another dimension, no view description, a view that does not fit, and the manifest line rewritten totex2dor another dim. Debug layer on, no error message.Impact on a local capture (2,689 compute requests, same build, only the writer swapped back to
main): 751 compile in both. Published manifests went from 301 to 350. All 49 new ones carry a new line (51tex2da, 30tex3d, 6tex1d), and the 301 existing manifests are byte-identical. That capture data stays local; the public fixtures are synthetic.Evidence and follow-up
mainbuild of the same capture, 31 programs were blocked only on a cube SRV.address_view_fitskeeps D3D12's casting rule (a view may only reinterpret the format of a typeless resource), so a title view that relies on console-only format casting is refused, not bound.Checklist
AI-assisted.
🤖 Generated with Claude Code
https://claude.ai/code/session_01EF3hKGcUDvQ6pxjDDMrvbn