shader: lower typed gfx1030 2D image loads #1229
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1236"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-24T04:49:19Z.
Scope
Add the
gfx1030compute profile's first typed MIMG lowering:image_load vD, v[x:y], s[A:A+7] dmask:0x1|0x3|0x7|0xf dim:SQ_RSRC_IMG_2Dwith the
unormflag optional. The lowering is oneTexture2D<uint4>.Load(int3(x, y, 0))fromt0; the DMASK-selected leadingcomponents go to consecutive destination VGPRs in ascending order and then to
the output UAV. The eight descriptor words must come from one tracked
s_load_dwordx8at--image-descriptor; the descriptor load must completebefore the image load, and the result may only be read after
s_waitcnt vmcnt(0).a16,d16,tfe,glc,slc,dlc,r128andthe NSA address spelling are refused, as are non-contiguous DMASKs and
non-2D dimensions. (The packed-address
a16spelling is the stacked #1239.)The 8-dword image resource descriptor (T#) is runtime data. The caller
guarantees through
--image-format R32G32B32A32_UINTthat its 9-bit GFX10format field, type, swizzle mode, resource level and selected destination
selects match a linear, unswizzled, single-layer 2D image. The translator
checks where the eight words were loaded from, not those fields. The test
runner adds one
Texture2DSRV to the existing compute descriptor-tablesignature; a texture cannot be bound as a root descriptor.
Rebase after the typed-buffer merges
mainmerged the D16 typed-buffer store PR (#1207), then the D16 load PR (#1211)and the float-ALU compute-store PR (#1169), while this branch was open. The
branch was rebased twice onto
55a975ab; both times the conflicts were intools/compute_store_aot.pyand the README row list, between the mergedtyped-buffer store/load regexes and this branch's image-load branch. They were
resolved by keeping the merged typed-buffer handling (including the
source_low16tag for an odd trailing D16 load component) and appending theimage_loadbranch after the vector-read loop. The README row and thedocs/experiments.mdsection were re-applied on top of the merged text. Therebased tip is
eb9269c9and the tests below were re-run on it.Validation
Tested
eb9269c958a4413e61674bbf9721bd404408b637on Windows 11 26H2 build26300.9974 with the Intel(R) Arc(TM) B390 GPU (driver 32.0.101.8509) and
Microsoft WARP (Microsoft Basic Render Driver, driver 10.0.26100.9818). The
runner reported
debug_layer=unavailable; the D3D12 debug layer could not beenabled on this machine.
cmake --preset dev -DINTAKE_PYTHON=<dev-python>andcmake --build --preset dev --target offscreen_checkpassed.ctest --preset dev --no-tests=error -R '^(compute_store_aot_mimg_load_|compute_store_aot_mtbuf_load_|compute_store_aot_mtbuf_store_|compute_root_|compute_tables_|offscreen_capability_table_self_test$)' -Vreported 11 passes, 0 failures and 0 skips.
compute_store_aot_mimg_load_warpand
_hardwareeach compare all 320 UAV words for dispatches of 4, 2, 1 and1 groups covering
dmask:0x1,0x3,0x7and0xf, with 0 mismatches.word=0 expected=10000001 actual=10000000.word=300 expected=c5c5c5c4 actual=c5c5c5c5.word=0 expected=10000000 actual=20000001.word=4 expected=10000010 actual=10001000.python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1passed on LLVM 15.0.7 (Ubuntu 22.04 container). It assembles and decodes
each DMASK form, lowers the decoded program through the CLI, and the CLI
output matches the text lowering.
image_load, sotools/form_coverage.py --gaps gfx1030drops the 111 MIMG forms to 110 uncovered and no longerlists plain
image_load.tests/form_coverage_check.py,tests/docs_links_check.py,tests/bidi_controls_check.pyandtests/rdna2_tools_check.pypassed.The GPU measurements execute translated desktop DXIL against CPU references;
they are not native runs of the assembled gfx1030 program. The binding does
not emulate native descriptor bounds, tiling or DCC, and the fixture keeps
every coordinate in range, so out-of-bounds image behavior is not measured.
Reproduce
The new behavior and its hypotheses are described in
docs/experiments.md#gfx1030-2d-image-loads;the README experiment table links the same section.
Shared files
This batch touches
tools/compute_store_aot.py,tests/compute_store_check.py,tests/compute_check.cpp,tests/offscreen_check.cpp,tests/desktop_gpu.h,CMakeLists.txt,README.mdanddocs/experiments.md. The merge simulation against the opentyped-buffer D16 PRs and its result are reported in the review thread.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T04:58:38Z.
Review: COMMENTED
Reviewed
a0842350on Linux (Windows build/tests were not run locally).Diff & edge-case audit
tools/compute_store_aot.py:--image-descriptor/--image-format R32G32B32A32_UINT: validates alignment (% 4), range (< 1 << 20), mutual exclusion with--source-descriptor(both bindt0), and non-overlap within 16 bytes for both 16-byte halves of the 8-dword descriptor.image_loadlowering: restricted tocpu == "gfx1030",dim:SQ_RSRC_IMG_2D(optionalunorm), contiguousdmask(0x1/0x3/0x7/0xf, rejecting0x0and non-contiguous masks), consecutive address VGPRs (y == x + 1), consecutive destination VGPRs (<= 255, none pending inloading), 4-aligned 8-SGPR descriptor (s[base:base+7]) waited vialgkmcnt(0)and verified against("image", 0/1), and known integer coordinate expressions. Loaded components enterloadingand are only readable afters_waitcnt vmcnt(0).a16,d16,tfe,glc,slc,dlc,r128, and NSA addressing are rejected byfullmatch.docs/experiments.md&README.md: document the caller-declaredR32G32B32A32_UINT/ linear / in-bounds assumptions and controls.tests/compute_store_check.py,tests/compute_check.cpp,tests/offscreen_check.cpp,tests/desktop_gpu.h,CMakeLists.txt: add binary round-trip + negative controls +compute_store_aot_mimg_load_{warp,hardware}CTest targets. 100% title-neutral.Linux checks (
a0842350)LLVM_LIB=/usr/lib/llvm-19/lib/libLLVM-19.so tests/compute_store_check.py binary /usr/lib/llvm-19/bin/llvm-mc /usr/lib/llvm-19/bin/llvm-objcopy /usr/lib/llvm-19/lib/libLLVM-19.so: passed (exit 0).docs_links_check.py: passed (16 Markdown files, 281 links).bidi_controls_check.py: passed (1046 files).form_coverage_check.py: passed.git diff --check: clean.offscreen_check/compute_store_aot_mimg_load_{warp,hardware}: not built or run locally.Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-24T04:54:15Z.
Merge simulation against the open typed-buffer D16 PRs
Simulated on top of
a0842350by mergingfork/codex/gfx1030-tbuffer-load-format-d16-upstream(
4e1775cb) and thenfork/codex/gfx1030-tbuffer-store-format-d16-upstream(e5f4acf2) in ascratch worktree. There were two conflicts, both textual adjacency:
README.md: kept the updated typed-buffer-reads row from #1211 and added the image-loads row.tools/compute_store_aot.py: kept the multi-dword address loop and thesource_low16tag for anodd trailing D16 component from the typed-buffer branch, the new
image_loadbranch unchanged,and the D16 store regex/format handling from #1207.
Merged-tree verification:
cmake --preset devandcmake --build --preset dev --target offscreen_checkpassed.ctest --preset dev --no-tests=error -R '^(compute_store_aot_mimg_load_|compute_store_aot_mtbuf_load_|compute_store_aot_mtbuf_store_)' -Vreported 6 passes, 0 failures and 0 skips on WARP and the Intel Arc B390.
ctest --preset dev --no-tests=error -R '^(compute_store_aot_warp$|compute_store_aot_hardware$|compute_root_|compute_tables_)' -Vreported 6 passes, 0 failures and 0 skips.
python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1exited 0 on LLVM 15.0.7 (no assertion or traceback).
Ordering: the behavior does not overlap, since the batches lower different instruction classes; only
the descriptor-binding table, the README row and the
docs/experiments.mdsection are shared. If#1211/#1207 land first, this branch rebases with the same conflict resolutions.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:07:04Z.
Tested on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
a0842350:--preset dev):cmake --preset dev && cmake --build out/build/dev -j 6 --target offscreen_checkctest --test-dir out/build/dev -R "^(compute_store_aot_warp|compute_store_aot_mimg_load_warp)$" --output-on-failure-> 2/2 passed (9.83stotal:compute_store_aot_warp6.22s,compute_store_aot_mimg_load_warp3.57s)/O2(--preset release):cmake --preset release && cmake --build out/build/release -j 6 --target offscreen_checkctest --test-dir out/build/release -R "^(compute_store_aot_warp|compute_store_aot_mimg_load_warp)$" --output-on-failure-> 2/2 passed (9.02stotal:compute_store_aot_warp5.70s,compute_store_aot_mimg_load_warp3.28s)Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-24T05:08:46Z.
Rebased onto
mainat908c34bfafter #1207 (D16 typed-buffer stores) merged. New head:9657c622.The only conflict was in
tools/compute_store_aot.py, between #1207's typed-store regex/format handling and this branch'simage_loadbranch. It was resolved by keeping the merged store branch and appending theimage_loadbranch after the vector-read loop. The README row and thedocs/experiments.mdsection were re-applied on the merged text.Re-verified on the new head, Windows 11 26H2 build 26300.9974, Intel Arc B390 + WARP:
ctest --preset dev --no-tests=error -R '^(compute_store_aot_mimg_load_|compute_store_aot_mtbuf_load_|compute_store_aot_mtbuf_store_|compute_root_|compute_tables_|offscreen_capability_table_self_test$)' -V: 11 passes, 0 failures, 0 skips.python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1on LLVM 15.0.7: exit 0.The earlier merge-simulation comment is superseded by this actual merge.
Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-24T05:15:08Z.
Rebased again onto
mainat55a975ab, after #1207 (D16 typed-buffer stores), #1211 (D16 typed-buffer loads) and #1169 (float ALU in the compute store profile) merged. New head:eb9269c9.Conflicts were in
tools/compute_store_aot.pyand the README row list. Resolved by keeping the merged typed-buffer handling (multi-dword read loop, thesource_low16tag for an odd trailing D16 load component, and the D16 store regex/format handling) and appending theimage_loadbranch after the vector-read loop; the image-loads README row was re-applied on the merged row list.Re-verified on the new head, Windows 11 26H2 build 26300.9974, Intel Arc B390 + WARP:
ctest --preset dev --no-tests=error -R '^(compute_store_aot_mimg_load_|compute_store_aot_mtbuf_load_|compute_store_aot_mtbuf_store_|compute_root_|compute_tables_|offscreen_capability_table_self_test$)' -V: 11 passes, 0 failures, 0 skips.python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1on LLVM 15.0.7: exit 0.