Repository navigation
shader: lower gfx1013 array and 3D float image stores - #1649
Conversation
tedin7
left a comment
There was a problem hiding this comment.
Peer review on faa78cd4:
Findings
No P1 or P2 defects found.
tools/compute_store_aot.py:--image-uav-dimension(2d,2d-array,3d) is gated togfx1013R32G32B32A32_FLOATstore bindings;image_storechecks that the instruction'sdim:SQ_RSRC_IMG_*matchesimage_uav_dimension, requiresdmask:0xf, rejectsa16,mip,packed,image_load, andimage_get_resinfofor layered dimensions, requires 3 consecutive address VGPRs (x,y,slice/depth), and emitsuint3(x, y, z)indexing intoRWTexture2DArray<float4>/RWTexture3D<float4>.tests/compute_check.cpp:texture_array_flag(1u << 31) andtexture_volume_flag((1u << 31) | (1u << 30)) are distinct intexture_format_mask;upload_textureand readback iteratetexture_subresources(desc)(MipLevels * DepthOrArraySizefor 2D arrays,MipLevelsfor 3D) andfootprint.Depthslices, matching the Python reference order..github/workflows/windows.yml: addstests/compute_mimg_float_store_layers_check.pywith--binary llvm-mc-15 llvm-objcopy-15 --llvm libLLVM-15.so.1, matching its CLI arguments and the siblingcompute_mimg_float_store_check.pyentry.- Title-neutrality: clean.
Verification
- Linux:
python3 -B tests/compute_mimg_float_store_layers_check.py --binary llvm-mc-19 llvm-objcopy-19 --llvm libLLVM.so.19.1— PASS (exit 0;2d-arrayand3dtranslation controls,llvm-mc-19machine words,libLLVM.so.19.1disassembly, and container CLI roundtrip).
- Win2025 (OS build 26100, MSVC 14.44.35207, WARP;
*_hardwareexcluded):- Debug (
--preset dev):cmake --build --preset dev --target offscreen_check -- -j 6(4.78s),ctest --preset dev -R '^(compute_store_aot_gfx1013_image_store_layers_warp|compute_store_aot_gfx1013_image_store_warp|compute_store_aot_mimg_store_warp|compute_store_aot_mimg_load_warp|compute_store_aot_mimg_mip_warp|compute_store_aot_mimg_packed_warp|compute_store_aot_mimg_resinfo_warp|compute_store_aot_mimg_msaa_warp|compute_store_aot_mimg_atomic_integer_warp|compute_store_aot_mimg_atomic_minmax_warp|compute_store_aot_mimg_atomic_exchange_warp|compute_store_aot_mimg_atomic_counter_warp|compute_store_aot_mimg_store_packed_warp)$' --parallel 4 --no-tests=error --output-on-failure— 13/13 passed (19.78s;compute_store_aot_gfx1013_image_store_layers_warp3.62s). - Release
/O2(--preset release):cmake --build --preset release --target offscreen_check -- -j 6(2.75s),ctest --preset release -R '^(compute_store_aot_gfx1013_image_store_layers_warp|compute_store_aot_gfx1013_image_store_warp|compute_store_aot_mimg_store_warp|compute_store_aot_mimg_load_warp|compute_store_aot_mimg_mip_warp|compute_store_aot_mimg_packed_warp|compute_store_aot_mimg_resinfo_warp|compute_store_aot_mimg_msaa_warp|compute_store_aot_mimg_atomic_integer_warp|compute_store_aot_mimg_atomic_minmax_warp|compute_store_aot_mimg_atomic_exchange_warp|compute_store_aot_mimg_atomic_counter_warp|compute_store_aot_mimg_store_packed_warp)$' --parallel 4 --no-tests=error --output-on-failure— 13/13 passed (20.16s;compute_store_aot_gfx1013_image_store_layers_warp3.61s).
- Debug (
- Local mutation check:
- Temporarily forced
layered = Falseintools/compute_store_aot.py;python3 -B tests/compute_mimg_float_store_layers_check.py --binary llvm-mc-19 llvm-objcopy-19 --llvm libLLVM.so.19.1failed as expected (ValueError: Unsupported image store target, exit 1). Restored cleanly (git status --shortclean).
- Temporarily forced
AI-assisted; commands listed were executed locally.
tedin7
left a comment
There was a problem hiding this comment.
Re-review of head 34d3c61 (comment only, not an approval). My earlier review was at faa78cd, which is an ancestor of this head.
Verdict: 0 P1 / 0 P2.
Since faa78cd only main merges were added (34d3c61 merges main a4d17cf); the PR's own commit cafdbde and its 8 files are unchanged, and my earlier points still hold (dimension gating, texture_array_flag and texture_volume_flag kept distinct in the mask, the windows.yml entry, title neutrality). GitHub CI at this head: the gfx1013 fixture assembly, the platform-independent Python checks and the Windows build and test succeeded; the O2 run was skipped.
What I checked
- Coordinates:
address_wordsgets+ int(layered)and the address isuint3(x, y, coordinates[2]); an undefined slice register fails with "Unverified image coordinates". - DMASK must be
0xf; sparse masks, short addresses, a16, d16,image_store_mip, a layeredimage_load_mipandimage_uav_mipof 1 are rejected. Adim:that does not match the declared view, layered loads, resinfo and packed forms, a gfx1030 array view, a raw-output 3D view and an unknown dimension are rejected. A 2D SRV load with a 2D-array UAV store translates correctly. - There is no format conversion (float RGBA32) and no slice clamping in the translator; D3D12 drops out-of-range UAV writes. The docs should say so (nit).
- I recomputed the reference counts by hand: array 5376 words (4096+1024+256), volume 4672 (4096+512+64), and the swapped-coordinate control gives 128+128+32 = 288 mismatches with the first difference at word 129. All match the test and PR text. The
Texture2DArrayandTexture3DUAV fields and the footprint loops are in the right order. - scan_unsupported_shaders.py only lists mnemonics, so there is nothing to keep in agreement. No assertion is weakened (one error message changed wording and nothing searches the old text). The test checks the translator's generated HLSL against an independent Python reference. No title content.
Run
python3 -B tests/compute_mimg_float_store_layers_check.py --binary llvm-mc-19 llvm-objcopy-19 --llvm libLLVM.so.19.1: exit 0 (both2d-arrayand3d: controls, machine words, disassembly round trip, container CLI).compute_mimg_float_store_check,compute_store_check binary,compute_mimg_msaa_check,compute_entry_layout_check binary, docs_links_check (17 files, 366 links), bidi_controls_check (1299 files) andgit diff --check origin/main...HEAD: exit 0.- llvm-mc-19 on gfx1013 and gfx1030 encodes
image_store ... dim:SQ_RSRC_IMG_2D_ARRAYidentically (28 0f 20 f0 08 0e 06 00).x86_64-w64-mingw32-g++ -std=c++20 -fsyntax-only tests/compute_check.cpp(generated headers stubbed): one error at line 385 in the oldrender_msaa_texturecode, the same error as on main; none in the changed code. - Mutations in tools/compute_store_aot.py (each restored with
git checkout --, final run green). Caught: y and slice swapped in the address; DMASK requirement dropped; layered allowed with an explicit mip; dimension-match check dropped; 3d mapped toRWTexture2DArray; slice register dropped fromaddress_words. NOT caught: removing thenot writeclause of the layered guard (theor mipclause and gfx1013's own target check still reject the tested load, so I judge it equivalent), and removing the non-2d gate at the top oflower()(redundant with the in-instruction layered check for stores; a gfx1030 or raw-output declaration with no store is never tested directly).
Nits
- The PR body still says the PR is the single commit cafdbde and the Windows results are for it; the head is now a merge commit.
- The docs do not say an out-of-range slice or depth write is dropped.
- No test combines a layered store with a separate 2D SRV load, or the gfx1030 plus 2d-array gate directly.
- #1683, #1684, #1675, #1673, #1591, #1580, #1579 and #1566 also touch compute_store_aot.py and/or docs/experiments.md (textual conflict risk only); #1711 is a different pipeline.
Not run: the --draw runs (dxc and D3D12: the array and volume UAV views, upload and readback loops, and the 5376 and 4672 word comparisons). I rely on the PR's Windows results at cafdbde, my earlier WARP run and the green Windows job at this head; I did not run a new GPU or WARP pass at the merged head.
Linux limits: no Windows, WARP, DXC or GPU here; LLVM 19 only (CI pins LLVM 15). Anything that needs them was not run.
AI-assisted; commands listed were executed locally.
|
Thanks @tedin7. These are in
|
tedin7
left a comment
There was a problem hiding this comment.
Review of head a9fb1792d0c728dd078329036909ac2e6f95145d. My earlier reviews were on faa78cd4 and 34d3c61b; since then the PR added only a9fb1792 (a combined-translation control, a gfx1030 refusal control and docs).
Verdict: no P1 and no P2.
Linux limits. Linux x86_64, llvm-mc-19 and llvm-objcopy-19 (CI pins 15), Python 3. No Windows, no DXC, no GPU, and I did not run the pipeline's Windows helper, so the array and volume readbacks (5,376 and 4,672 words, the swapped-coordinate control) and the debug-layer results are the author's GTX 1060 and WARP numbers, not reproduced by me. I read the tests/compute_check.cpp changes instead of running them.
What changed since 34d3c61b.
tests/compute_mimg_float_store_layers_check.py:combined_controls()(called at the start ofmain) checks that a 2Dimage_load_mipfrom the separate SRV followed by a 2D-array store emitsTexture2D<float4>att0andRWTexture2DArray<float4>atu0with the storeoutputData[uint3(tid.x, tid.y, 0x00000001u)], and that array and 3D views are refused on gfx1030.docs/experiments.md: states that the slice or depth coordinate is not clamped, that a D3D12 UAV store outside the view is dropped, and that the console's out-of-range behaviour is not measured. That is the honest wording for the open question I raised.
What I read in the lowering (tools/compute_store_aot.py)
- The dimension regex takes
2D_ARRAY|2D|3Din that order; a store must match--image-uav-dimension; layered loads, resinfo,a16, mip and packed forms are refused; the address is three words (+ int(layered)) emitted asuint3(x, y, slice). The array and volume views are limited to the gfx1013 RGBA32 FLOAT store binding. - Harness (
tests/compute_check.cpp): the selector bits are distinct (texture_array_flagandtexture_volume_flagdiffer in bit 30), the expected word count is 5,376 for four layers and 4,672 for depths 4, 2 and 1 (depth >>= levelfor the volume, which my arithmetic reproduces: 10244 + 2562 + 64*1), the 3D UAV uses{mip, 0, ~0u}, the array UAV covers all slices, and the upload and readback loops walkGetCopyableFootprintsper subresource withfootprint.Depthslices, matching the Python reference order.
What I ran on this head (worktree at the exact SHA; clean after every mutation)
python3 -B tests/compute_mimg_float_store_layers_check.py: passes (combined, 2d-array and 3d controls). With--binary llvm-mc-19 llvm-objcopy-19 --llvm /usr/lib/llvm-19/lib/libLLVM-19.so: both programs match llvm-mc and the container CLI.python3 -B tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so(the CI entry for the translator as a whole): exit 0.git merge-tree --write-tree origin/main HEAD: clean; also clean against #1684.git diff --check origin/main...HEAD,docs_links_check.py(17 files, 366 links),bidi_controls_check.py: clean.- Five mutations of
tools/compute_store_aot.py, each restored, each makes the controls fail: slice and Y swapped in the address; the extra address word dropped; the view-match check removed; the array view declared asRWTexture3D; array and 3D views allowed on gfx1030.
Findings
- P3, observation, not a regression: a layered
image_store ... dim:SQ_RSRC_IMG_2D_ARRAY unormis accepted and the modifier is dropped, exactly as for the 2D form today (the dimension regex has(?: unorm)?). I translated the fixture withunormadded and got the sameuint3store. Ifunormshould be refused for the new forms, that is a separate change; the fixtures do not use it. - P3: the docs name the unclamped slice as unmeasured on the console; a title that stores to an out-of-range layer would be dropped by the desktop UAV, which is a possible silent difference. No code change is needed now.
- Not verified by me: the Windows results above and the CI jobs.
AI-assisted; commands listed were executed locally.
|
Thanks @tedin7. On finding 1 (
If you or the maintainer prefer the profile to refuse On finding 2 (an out-of-range layer is dropped by the desktop UAV): agreed. That's the open question |
|
Status: ready to merge from our side. All review feedback on this PR is either addressed in
CI is green at the head, and the branch merges cleanly with main and with #1684. If you'd like anything else changed or tested, I'll do it. |
…e-1d Keeps this branch's 1D SRV dimension checks and CLI argument with main's gfx1013 image atomic flag, descriptor-format constant and wave-size arguments; the docs, CMake and workflow lists keep both entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged main at
Reruns after the merge:
Status: ready to merge from our side. CI is green at |
…e-1d With R0Y00#2106 (D16 stores) now in the base: the image pattern takes 1D, the layered dimensions and d16; a d16 store to any dimension other than 2D, 1D included, keeps R0Y00#2106's 'Unsupported compute instruction' refusal; the harness keeps the 1D flag (bit 23) and the RGBA16 FLOAT flag (bit 22) with main's per-format texel size and this branch's 1D height. README, docs, CMake and workflow keep both entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged main at
Reruns after the merge:
Status: ready to merge from our side. CI is green at |
tedin7
left a comment
There was a problem hiding this comment.
Review of head b157cf78955e56f4409152843bfa3127f527a830 (merge of main into the branch; code change unchanged in tools/compute_store_aot.py).
Scope read: git diff --stat origin/main...HEAD (8 files, +346/-62), then the lower() image_store path, --image-uav-dimension, the new fixture and check script.
Commands run locally (Linux):
python3 tests/compute_mimg_float_store_layers_check.py-> 2d-array and 3d translation controls passed; combined SRV load + array store and gfx1030 refusal passed.python3 tests/compute_mimg_float_store_check.py-> existing 2D float store controls still pass.python3 tests/docs_links_check.py-> self-test passed, 18 files, 399 links.python3 tests/bidi_controls_check.py-> no bidirectional controls in 1438 files.git diff --check origin/main...HEAD-> clean.gh pr checks 1649: Linux checks, fixture assembly and Windows build/test pass; /O2 and chart jobs skipped. PR is MERGEABLE, title is neutral.
Mutations (both reverted with git checkout -- .):
- Dropped
+ int(layered)fromaddress_words: the checker fails (translation rejects the 3-VGPR store). Killed. - Swapped X/Y in the emitted
uint3(...)address: the checker'sADDRESSassertion fails. Killed.
Findings:
- P1: none.
- P2: none.
- nit:
IMAGE_UAV_TYPESis placed betweenRGBA32_FLOATandRGBA16_FLOAT; moving it after the RGBA16 constant would keep the format constants together. - nit: the comment above
IMAGE_FORMATSnow wraps past the surrounding line width.
Logic notes: D16, A16, _mip, packed and load/resinfo forms are refused for array/3D, and a dimension that differs from the declared UAV is refused. Both match the PR text. I did not run the Windows WARP/GPU job; the PR body reports GTX 1060 and WARP results for an earlier commit, and the head only merges main.
AI-assisted; commands listed were executed locally.
|
Merged current Status: ready to merge from our side. |
tedin7
left a comment
There was a problem hiding this comment.
Re-review of head 47c647856ba4802d40993856ec5c25b23bb36697 (merge of main 681d01f into the branch; PR-owned code in tools/compute_store_aot.py, the new fixture/check and docs is unchanged in substance).
Scope read: git diff --stat origin/main...HEAD (8 files, +346/-62), then the lower() image_store path, --image-uav-dimension, IMAGE_UAV_TYPES, the fixture, the check script, CMake/workflow wiring and docs.
Commands run locally (Linux):
python3 -B tests/compute_mimg_float_store_layers_check.py-> combined SRV load + array store / gfx1030 refusal, 2d-array and 3d translation controls passed.python3 -B tests/compute_mimg_float_store_layers_check.py --binary /usr/bin/llvm-mc-19 /usr/bin/llvm-objcopy-19-> machine words match llvm-mc for 2d-array and 3d.python3 -B tests/compute_mimg_float_store_check.py-> existing 2D float store controls still pass.python3 tests/docs_links_check.py-> 18 files, 407 links, OK.python3 tests/bidi_controls_check.py-> 1484 files, no bidirectional controls.git diff --check origin/main...HEAD-> clean.gh pr checks 1649: Linux checks, fixture assembly and Windows build/test pass; /O2 and chart jobs skipped. MERGEABLE, title neutral.
Mutations (each reverted with git checkout -- .):
- Dropped
+ int(layered)fromaddress_words: checker fails. Killed. - Removed the
dimension != image_uav_dimensionrefusal: checker fails ("Expected rejection ... does not match the 3d UAV view"). Killed. - Swapped Y and slice in the emitted
uint3(...)address: checker fails. Killed. - Dropped the
a16 or mip or packedguard for layered forms: checker fails. Killed. - Disabled the
d16 and layeredguard: checker still passes. Survived (see nit).
Findings:
- P1: none.
- P2: none.
- nit: the explicit
if m["d16"] and layeredrefusal inlower()is redundant. With it disabled, thestore + " d16"controls still reject with the same message, so another check already refuses it. Either keep it as intentional defense or drop it; a control that only this guard can satisfy would pin it. - nit (carried over):
IMAGE_UAV_TYPESsits betweenRGBA32_FLOATandRGBA16_FLOAT; keeping the format constants together reads better.
Not run: the Windows WARP/GPU draw (compute_store_aot_gfx1013_image_store_layers_*). The head only merges main over code already exercised on an earlier commit, and the Windows CI job passes.
AI-assisted; commands listed were executed locally.
|
@Jess-Doit could you rebase this branch onto current GitHub reports head Files that conflict with current
Commands run locally: Once it is rebased and CI is green it will be re-checked right away. AI-assisted; commands listed were executed locally. |
47c6478 to
9ae3d2e
Compare
|
@tedin7 thanks. Rebased onto current The conflicts came from #2136's same-texel UAV loads, which merged into the same places:
How they were resolved:
Tests on Windows 10 build 19045,
Ready to merge from our side. |
Full-mask R32G32B32A32_FLOAT image_store at mip zero into a 2D array or 3D view, declared with --image-uav-dimension 2d-array or 3d, lowers to RWTexture2DArray<float4> or RWTexture3D<float4> at u0, indexed by three consecutive address VGPRs. A 2D image_load_mip from a separate SRV followed by an array store translates to the two views. Wrong view dimensions, sparse masks and gfx1030 array or volume views are refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9ae3d2e to
fab79c8
Compare
|
Rebased onto current The conflict was one line in Tests, run on Windows 10 19045 with GTX 1060 + WARP:
Ready to merge from our side. |
tedin7
left a comment
There was a problem hiding this comment.
Review of head fab79c8 (comment only, no approval).
Checked:
tools/compute_store_aot.py: array and volume forms are accepted only forimage_store, RGBA32 FLOAT, full mask, mip zero. Loads, A16, D16,_mipand packed forms are refused. The instruction dimension must match the declared--image-uav-dimensionview. Unknown dimensions are refused up front.- Sibling checks: 2D paths, the SRV mip-load profile and the D16 store test are unchanged. The new test is added to the CMake list and to the Linux CI list in
windows.yml, next to the sibling image-store tests. - Test:
compute_mimg_float_store_layers_check.pygives static refusal controls, a source-built draw for array and volume, a CPU reference that compares every word (including untouched texels), and a swapped-coordinate negative control. No other open or merged PR covers this slice (#2056 is 1D and is a draft).
Commands run locally:
git diff --check origin/main...HEAD: cleanpython3 tests/docs_links_check.py: passpython3 tests/bidi_controls_check.py: pass- Translation controls of
compute_mimg_float_store_layers_check.py(array and 3D): pass - Mutation: disabling the dimension-match refusal makes the controls fail ("Expected rejection: image_store dimension 2d-array does not match the 3d UAV view"). Reverted afterwards.
Not run here: the D3D12 WARP draw and the LLVM binary check (no LLVM 15 here). The Windows run comes next after updating the branch with main.
AI-assisted; commands listed were executed locally.
|
Win2025 WARP receipt for head a3f0a8e after updating with main. Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
AI-assisted; commands listed were executed locally. |
Refs #1545
Follows #1611 (merged). The change is
cafdbde7, plus merges ofmainand a controls-and-docs commit at the head (a9fb1792).Change
Allow full-mask gfx1013 RGBA32 FLOAT
image_storeto a 2D array or volumeat mip zero.
--image-uav-dimensiondeclares the matching view atu0.The three address VGPRs supply X, Y and slice or depth in order. The caller
supplies unique destination texels. The SRV mip load profile continues to
use a separate 2D read-only texture.
The source-built cases write 64 texels across two slices or depth planes.
The CPU reference compares each word of each slice and mip, including
5,120 untouched words in the array and 4,416 in the volume. The
swapped-coordinate control exchanges Y with slice or depth while holding
the data and reference fixed. Translation controls reject a mismatched UAV
dimension, sparse DMASK, short address, A16, D16 and explicit mip stores.
Verification
Tested
cafdbde7ed044c364719bf78e5a887a7e821f8e9on Windows 10 22H2build 19045.6456 using Windows SDK 10.0.26100.0 DXC and
cs_6_0.The control first differs at mip 0, word 129, with
40110001expected and40110000read. The D3D12 debug layer was enabled and reported zero warningsor errors in the new dispatches. Debug and Release each passed 27 tests,
including all previous compute image, texture and MIMG checks and the docs
link check. Both selections had zero failures and zero capability skips.
After merging #1611's head (
057686c2), an independent Debug rerun on the same host passed 26/26:ctest --preset dev --no-tests=error -R '^compute_store_aot_.*(image|texture|mimg)'. That includescompute_store_aot_gfx1013_image_store_layers_{warp,hardware}.At the head
a9fb1792, after merging main ata4d17cf5, all 28 compute image, texture and MIMG tests passed in Debug on the GTX 1060 and WARP with no skips. The head's controls-and-docs commit was rerun on both adapters as well.Local LLVM 23.1.6 reassembled both programs byte-for-byte, and the
disassembly matched the fixture source. The Ubuntu job uses LLVM 15 for
the binary and container CLI checks.
AI-assisted (Codex).