Repository navigation
startup: bind pixel-stage UAVs from the title's descriptor table - #2448
Conversation
tedin7
left a comment
There was a problem hiding this comment.
Review of head e1d5a99 (Linux-side read, no Windows run by me).
What I checked
- Manifest:
x2w-manifest 2is accepted and everyuavline is either bound (uav N tex2d table P O) or refused by name at load time. Raw/buffer views, qualifiers, extra fields, out-of-order index and more than 8 views all keep the old "translation not used" behavior. - Binding (
resolve_pixel_uavs): all refusals happen before any view or state change is recorded. Slot 19 (UAV) is required, mip/plane/array/MSAA/format/typed-store support are checked, and a texture that is also a render target, depth target or SRV of the same draw is refused. Indirect draws with UAVs are refused. - Root signature: the SRV range and the UAV range share one table, with the UAV range offset by the SRV count.
sampler_root_parameter(views)and the draw-time descriptor math usesrvs + uavsconsistently. Existing callers ofcreate_translated_rootkeep the defaultuavs = 0, so their layout is unchanged. bound_targets/bound_depthare copied from the same local array the existing trace code copies (8 entries), so no new out-of-range read.- Test:
tests/startup_pixel_uav_check.py+tests/startup_pixel_uav.cppdraw through the real runtime on D3D12 and read back every word of four textures (both mips), so it guards the stored texel, the untouched words, each named refusal, and the exec on/off cases with a control. It is wired into CTest per backend and added to the existingstartup_stream_consumerbinary rather than a new one. - Overlap: #2155 (merged) added the lowering; this is the runtime half of the same item. No open PR touches the same code (#2399 is compute-only).
- Scope: runtime + docs + tests, no .github/launcher/hooks.
Commands run (Linux, in a review worktree at the head SHA)
git diff --check origin/main...HEAD: cleanpython3 tests/docs_links_check.py: passed (19 files, 465 links)python3 tests/bidi_controls_check.py: passed (1727 files)
Not verified by me
- The new test needs Windows/WARP, so I could not run it or mutate the runtime code here. The PR's CI shows "Build and test on Windows" SUCCESS on this head; the author posted no separate Win2025 results comment, and the /O2 job was skipped.
- The branch is 24 commits behind main; I did not update it (that would change the head SHA).
No blocking findings.
AI-assisted; commands listed were executed locally.
|
Hardware run and Windows 11 MSVC build at head Environment: Windows 11 Pro build 26300.9974, Debug ( Build: Tests:
The hardware test prints
The WARP run ( On the PR so far: the review of Not covered by this run: NVIDIA only (RTX 3070 Ti); no AMD or Intel GPU; no Release build; the wider |
Refs R0Y00#1996 (item F). load_translation reads the 'uav N tex2d table P O' line that gfx2hlsl.py writes for a pixel-stage image_store instead of dropping the translation. The translated root signature gets a UAV range after the SRVs in its view table, and each draw makes the view from the unordered-access view the title created at that table entry, on mip 0 of a 2D texture. Version 2 manifests (the ones with uav lines) are read again; each uav line is bound or refused by name, and the raw buffer line of the vertex-stage stores (R0Y00#2059) stays refused. Refused by name, nothing bound in place of the view: other line forms (including a view qualifier or a channels field, as in the compute line) when the manifest is loaded; at draw time no table, an entry outside the table, an entry without a view, a view that is not a UAV, a resource without ALLOW_UNORDERED_ACCESS, other resource or view dimensions, mips and planes, integer, sRGB and non-colour formats, no typed UAV store, and a texture that is also an SRV, a render target or the depth texture of the draw. These checks run before any view of the draw is written. Indirect draws refuse a translation with a uav line. tests/startup_pixel_uav_check.py draws the source-built program of R0Y00#2155 through the runtime and reads back every word of four sentinel textures. AI-assisted.
e1d5a99 to
1247a28
Compare
|
@denn0x, a heads-up on overlap with your draft #2603, checked by diffing both heads (#2448 Both PRs bind pixel-stage
One thing that may matter for #2603 itself: at #2448 is small (10 files), has a hardware run from @Makto94 on the previous head
No rush, just say which you prefer. AI-assisted. |
|
Update for the conflict with main (head a9f01aa). What I added:
Commands executed:
AI-assisted; commands listed were executed locally. |
Refs #1996 (item F). Follow-up of #2155; also the "Pixel-stage UAV binding" line of #2274.
Change
The runtime now binds the image a translated pixel program stores to. Before this,
load_translationdropped every translation with auavline: first with "pixel-stage UAVs are not bound yet", and since #2059 by refusing everyx2w-manifest 2manifest and everyuavline.load_translationreadsuav N tex2d table P O, the linetools/startup/gfx2hlsl.pywrites for a pixel-stageimage_store. Only that form is read: a view qualifier (float,uint,sint) or achannelsfield, as in the compute line on main (uav N tex2d float table P O channels 4), is refused.uavline is either bound or refused by name, so the vertex-stage buffer line (uav N raw table P O) still keeps its translation from being used and no store is skipped silently. Other manifest versions stay refused. The offline vertex-store note indocs/experiments.mdnow says this instead of "refuses version 2 manifests".u0..after the SRVs in its view table (create_translated_rootandsampler_root_parameterintranslated_sampler_bindings.h, both already on main, take the view count).UNORDERED_ACCESSfor the draw.d3d12_draw.inl(read_pixel_uav_line,pixel_uav_view,resolve_pixel_uavs); no new shared header.Passkeeps the last accepted render and depth targets (bound_targets,bound_depth) so the draw can compare them; the existingtrace_targetsare filled only while the red-producer diagnostic is on.Refused by name, with nothing bound in place of the view:
uav N raw table P O, the vertex-stage store of shader: lower buffer_store_dwordx3 in gfx2hlsl (Part of #1723) #2059, or the olderuav N table P O), a view qualifier, another source, an extra field such aschannels, a view index out of order, more than eight views;ALLOW_UNORDERED_ACCESS, an array, 3D, 1D or multisampled resource, a view of another dimension, mip or plane, an integer, sRGB or non-colour format, a format without typed UAV store on the device, and a texture that is also an SRV, a render target or the depth texture of the same draw. These checks run before any view of the draw is written or any texture changes state.uavline, counted in the startup: wire per-reason refusal census into translated indirect draws #2333 census asunsupported_resource_or_entry.Out of scope: compute UAVs (#2274 B) and barriers between draws that write and read the same texture.
Verification
Commit
1247a2895onfbe249f68(rebased; the previous head wase1d5a997bonb442b57fb).git merge-treewith today's main (f02ebd669) is clean. Windows 11 (10.0.26200), MSVC 14.44, NVIDIA GeForce RTX 3070 driver 32.0.16.2101, and WARP 10.0.26100.9818, debug layer on.startup_pixel_uav_warpandstartup_pixel_uav_hardwarepassed (2/2) in each of two runs on1247a2895: 21 cases and the exec guard control on each adapter, debug layer on with 0 errors in every case (42 of 42 per run);a.buffer-lineis refused by name on both adapters. The previous heade1d5a997bpassed the same way, and @Makto94 ran it on an RTX 3070 Ti.1247a2895,ctest --preset dev --no-tests=error -R "^startup_(stream_|draw|pixel_|indirect|sampler|image_|formatted|clear_uav|list_uav|gfx2hlsl_buffer_store|d16_srv|frame_copy|mrt|joined|root_|view_|memory_srv|mubuf)": 214 tests, 0 failed, 1 skipped with its existing capability reason (startup_view_heap_warp), 623 s. This includesstartup_joined_table_pointer_*(shader: preserve proven 32-bit graphics table offsets across forward joins #2507, whoseX2W_TEST_JOINED_TABLEflag met ours instartup_stream_consumer.cpp), formatted buffers and views, indirect draws, ClearUAV, UAV barriers andstartup_gfx2hlsl_buffer_store(shader: lower buffer_store_dwordx3 in gfx2hlsl (Part of #1723) #2059).^startup_suite on the first rebase of this change (294178042, on8ecaa8ec9, same code): 897 tests, 0 failed, 9 skipped with their existing capability reasons, 2057 s. It was not repeated on1247a2895, whose base adds 16 commits; those that touch the same files (startup: handle vertex fetch with invalid input layout in gfx2hlsl (Part of #1723) #2002 vertex fetch without elements, startup: implement command-list slot 14 Dispatch (Part of #870) #1974/startup: implement command-list slots 37 and 39 root constants and views (Part of #870) #1975 compute slots, runtime: create committed resources through device slot 76 #2648 slot 76) do not touch the translated root signature, the view table or the UAV binding, and the subset above covers the draw path.What the 21 cases check (
tests/startup_pixel_uav_check.py, each case its own process):ALLOW_UNORDERED_ACCESS, aR32G32B32A32_UINTview, a view of mip 1, a one-slice 2D-array view, an entry outside the bound table, no table, the texture also bound as an SRV, the texture also bound as the draw's render target (a fifth texture with both flags, bound through list slot 50), and seven other manifest lines (including the compute form withfloatandchannels 4).v_cmpxvariants from startup: lower pixel-stage image_store to a typed UAV store #2155 through the runtime. Exec on writes the texel; exec off leaves it.Negative controls:
texel_mismatch texture A mip 0 texel (1, 2) word 0: got 3f800000, expected c0000024on both adapters.ALLOW_UNORDERED_ACCESScheck removed:no-uafails, the debug layer reports IDs 340 and 524 and the device is removed (0x887a0001);targetfails, the debug layer reports ID 538 (the render target is inUNORDERED_ACCESSat the draw).b442b57fbadded the manifest-version andrawline handling described above (covered by thea.buffer-linecase), and the rebase ontofbe249f68changed only conflict context (docs wording from the compute image store, and the environment-variable list instartup_stream_consumer.cpp).target), and the log showsstores to an image (uav 0 tex2d table 0 0); pixel-stage UAVs are not bound yet, translation not used.X2W_PIXEL_UAV_NO_DEBUG=1, as on a machine without it) the cases still run and reportdebug layer: absent; the zero-error requirement applies only when the layer is on.Evidence and follow-up
tests/startup_pixel_image_store_check.py, no bytes from any retail software). I assembled its source and the twov_cmpxvariants with clang 15.0.7 (--target=amdgcn-amd-amdhsa -mcpu=gfx1013) and extracted.textwith llvm-objcopy 15: all three match the recorded words (64, 68 and 68 bytes). That is the reassembly startup: lower pixel-stage image_store to a typed UAV store #2155 could not run; it is not part of the CI test.tests/startup_pixel_uav.cpp(astartup_stream_consumermode) creates the textures through device slot 127, the views through slots 18, 19 and 20 and the table through list slot 36, so the draw goes through the same path as a title.uavline. On mainop_image_storeaccepts only pixel and compute stages, and compute writes its own manifest (stage cs,uav N tex2d float … channels 4, not read byload_translation), so in a graphics manifest only the pixel stage writes atex2dline; a vertex-stage store is always arawline (op_buffer_store_vs), which is refused here. The view table is visible to all stages, so the binding does not depend on the stage either. If a later change lets another graphics stage store to an image, the manifest should carry the stage.retire_hold-ed like a sampled one, becauseretire_classifyalready keeps every resource withALLOW_UNORDERED_ACCESS(which this binding requires) out of the retire class.tex2dline and refuses itsuav N raw table P Oline by name, so those stores still never run; thea.buffer-linecase checks that refusal on both adapters. The draft Integrate mesh translation, D3D12 rendering and memory handling #2603 binds the same pixeluavline ind3d12_draw.inlin another layout; the overlap is described in a comment on this PR.ALLOW_UNORDERED_ACCESSdecides how often this binds), indirect draws with auavline (refused, no fixture), resources the runtime creates by title address (refused by name, no fixture), and a UAV of the bound depth texture (refused by name with the render-target check, no fixture).Checklist
AI-assisted.