Repository navigation
compute: store UINT4 through a runtime-selected buffer view - #2224
Conversation
tedin7
left a comment
There was a problem hiding this comment.
Review of head 2a955097a655bc6deb0744f20739afb548eb2762 (Linux, local worktree).
Result: no P1, no P2. Two nits.
Checked:
- Title is neutral. The PR is MERGEABLE. CI at this head is green (Linux checks, Windows build and test, gfx1013 fixtures). Only the coverage chart and the /O2 job are skipped.
heap_store_view_hlsl(tools/compute_store_aot.py) follows the intended semantics. The live word at record+16 is required. Format word, channel selectors, 4-byte base and stride alignment,stride >= offset + 16, andindex < countare all checked. The tail bound is computed by division, soindex * stridecannot wrap. The whole 16-byte texel must fit in the declared u0 extent, otherwise nothing is written. That matches the partial-texel behavior described in the PR.- The
lower()argument validation is strict. Mixing withheap_view,stride,output_format,image_outputorformat_wordsis refused. So are a wrong tuple length, a non-multiple-of-4 or out-of-range size, and a non-xyzw store. Slot readiness is also checked. - The CMake, workflow and AGENTS.md wiring are consistent with the sibling
compute_heap_view_check.pyentries. The docs link to the#heap-view-buffer-loadsanchor.
Commands run locally:
python3 tests/docs_links_check.py-> Self-test passed. Checked 18 Markdown files and 413 links.python3 tests/bidi_controls_check.py-> Checked 1506 files: no bidirectional controls.git diff --check origin/main...HEAD-> clean (exit 0).python3 -B tests/compute_heap_store_check.py controls->heap-store controls passed.- Mutation: I replaced the tail-extent guard
if (index > (bytes - view.x - offset - 16u) / stride) return;withif (false) return;. The Linuxcontrolsstill passed. Linux controls do not run the HLSL. That guard is killed only by the WARP/hardwaredrawrun, and the PR reports it covered by the partial-final-texel case. I did not rundrawhere: it needs DXC and the renderer, and no Windows run was queued from this review.
Nits:
tests/compute_heap_store_check.py:49The Linuxcontrolsstring check (store_heap_uint4(params[0].x, tid.x, 4u, uint4(tid.x,) only pins the call site. The HLSL guards are exercised only bydraw. This is fine given the Windows tests, but a short comment saying so would help the next maintainer.docs/experiments.md(new section) The ctest regex namescompute_store_aot_heap_view_store_warp. The hardware variant is registered too. Mention it, or say that it is registered only when a hardware adapter exists.
AI-assisted; commands listed were executed locally.
|
I added the per-index extent mutation from your review in |
Refs #2022, item B. This follows the 32-byte view record from #2174. A gfx1013 compute shader can now select a UINT4 view at dispatch time and write four 32-bit components with one indexed
buffer_store_format_xyzw. The destination is the bound u0. The selected record in t0 determines the base, stride, element count, format and live state.The binding supplies the writable byte extent of u0 separately from the size of t0. WARP caught a partial write at the end of the destination during development. The new check admits the last complete 16-byte texel and leaves every word untouched when only part of the texel fits. The first slice covers the identity 32_32_32_32_UINT format with a dispatch-thread index.
Review follow-up at
a6f41df1Both WARP and hardware passed the twelve cases and detected all eight wrong shaders at this head. Removing the per-index output bound is now an explicit mutation. The final-complete-texel case catches the next thread writing into the sentinel region. The device-free controls and the documentation link check also passed. The full Debug and Release workflow for this head is available here.
Verification at
2a955097on Windows x64python -B tests/compute_heap_store_check.py controlspassed the accepted instruction and binding/refusal controls.python -B tests/compute_heap_store_check.py draw <dxc> <offscreen_check> warpand the same command withhardwareeach matched all 320 output words in twelve cases. Each backend detected seven deliberately wrong shaders. The cases include a released view, a live slot beyond the table, element-count bounds, alternate base and stride, a wrong format, and the partial final texel. Used DXC 1.9.2609 and the source-built renderer.verify_binarycompared source lowering, LLVM-C disassembly lowering and the container CLI's HLSL for equality. The Linux CI entry runspython -B tests/compute_heap_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1.AI-assisted with Codex (GPT-6.2 Astra xhigh).