shader: lower packed-address gfx1030 2D image loads #1232
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1239"
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:57:39Z.
Scope
Stacked on #1236. Add the packed-address
a16spelling of the same typed 2D image load:image_load vD, vP, s[A:A+7] dmask:0x1|0x3|0x7|0xf dim:SQ_RSRC_IMG_2D unorm a16.One address VGPR holds both coordinates, x in bits [15:0] and y in bits [31:16]; the lowering
extracts them into the same
Texture2D<uint4>.Load(int3(x, y, 0))fromt0and writes theDMASK-selected components to consecutive destination VGPRs.
d16,tfe,glc,slc,dlc,r128and the NSA register list stay refused, and the two address families are mutually exclusive:the
a16flag with a two-dword address, or a packed address without the flag, is rejected.mainmerged the D16 typed-buffer store PR (#1207), then the D16 load PR (#1211) and the float-ALUcompute-store PR (#1169), while this branch was open. Both commits were rebased onto
55a975ab: the#1236 commit became
eb9269c9(its conflicts were resolved in #1236) and thea16commit becamea8be8889. Review the deltaa8be8889for thea16-specific changes; after #1236 lands, rebasethis branch on
mainbefore marking it ready.Validation
Tested
a8be88895c5073bf6c043a961d9039eb1f4096b2(parenteb9269c9) on 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.cmake --preset devandcmake --build --preset dev --target offscreen_checkpassed.ctest --preset dev --no-tests=error -R '^compute_store_aot_mimg_load_' -Vreported 2 passes(WARP and hardware), 0 failures and 0 skips. Each backend now compares all 320 UAV words for eight
cases:
dmask:0x1,0x3,0x7and0xfin both the two-dword and the packeda16addressfamily, 0 mismatches.
>> 16uchanged to>> 0u):word=4 expected=10000010 actual=10001010.word=0 expected=10000001 actual=10000000(flippedwritten word),
word=300 expected=c5c5c5c4 actual=c5c5c5c5(flipped untouched word),word=0 expected=10000000 actual=20000001(component order) andword=4 expected=10000010 actual=10001000(two-dword coordinate order).ctest --preset dev --no-tests=error -R '^(compute_store_aot_mtbuf_load_|compute_store_aot_mtbuf_store_|compute_root_|compute_tables_|offscreen_capability_table_self_test$)' -Vreported 9 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 (Ubuntu 22.04 container). It assembles and decodes all eight forms,
including LLVM's
... unorm a16spelling and the one-register address, and the CLI lowering ofthe decoded program matches the text lowering.
image_load;tools/form_coverage.py --jsoncounts onegfx1030 form from this run.
tests/docs_links_check.py,tests/bidi_controls_check.pyandtests/form_coverage_check.pypassed.The GPU measurements execute translated desktop DXIL against CPU references; they are not native
runs of the assembled gfx1030 program. Descriptor fields remain a caller guarantee as in #1236; this
PR only changes how the address VGPRs are formed.
Reproduce
The updated description is in
docs/experiments.md#gfx1030-2d-image-loads.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:04:16Z.
Review: COMMENTED
Reviewed commit
6fc4be5a(stacked on#1236/a0842350; Linux host — Windowsoffscreen_checkbuild andcompute_store_aot_mimg_load_*GPU tests were not executed locally).Code & Edge-Case Audit
tools/compute_store_aot.py:image_loadlowering enforces mutual exclusivity betweena16and the two-dword address (a16 != (packed is not None)),cpu == "gfx1030",guard_span is None, contiguousdmask == (1 << count) - 1(1 <= count <= 4,last == first + count - 1, rejectingdmask:0x0),high == base + 7,base % 4 == 0, completeds_load_dwordx8at--image-descriptor, ands_waitcnt vmcnt(0)before reading destination VGPRs.a16coordinate extraction emitsint3(asint(word & 0xffffu), asint(word >> 16u), 0): becausewordis an HLSLuint,& 0xffffuand>> 16uperform unsigned extraction beforeasint(...), avoiding sign-extension of bit 15 or bit 31.--image-descriptorvalidates alignment and non-overlap against existing descriptor bindings and--source-descriptor.tests/compute_store_check.py,tests/compute_check.cpp,tests/offscreen_check.cpp,docs/experiments.md,README.md:AGENTS.mdcompliant).mainonce#1236lands.Checks Run (Linux / Python / LLVM-19)
git diff --check origin/main...HEAD: pass (0 issues)/root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py: pass (16 Markdown files, 281 links)/root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py: pass (1046 files)/root/.local/share/x2w-rev-venv/bin/python -B tests/form_coverage_check.py: passLLVM_LIB=/usr/lib/llvm-19/lib/libLLVM-19.so /root/.local/share/x2w-rev-venv/bin/python -B tests/compute_store_check.py binary /usr/bin/llvm-mc-19 /usr/bin/llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so: pass (exit 0; allmimg_loadandmimg_load_a16forms assembled/decoded and CLI-lowered, plusmimg_load_controls/mimg_a16_controls)ctest -R '^compute_store_aot_mimg_load_': not run locally.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:17:37Z.
Review: COMMENTED
Retest of commit
ceaf2185(rebased ontomain908c34bf+#12369657c622; delta from6fc4be5ais rebase-only with identicala16lowering/test diff; Linux host — Windowsoffscreen_checkbuild andcompute_store_aot_mimg_load_*GPU tests were not executed locally).Delta & Audit (
6fc4be5a..ceaf2185)diff -ubetween6fc4be5aandceaf2185shows zero functional changes to thea16implementation or tests (only blob hashes and line offsets from rebasing ontomain).AGENTS.mdcompliant).Checks Run (Linux / Python / LLVM-19)
git diff --check origin/main...HEAD: pass (0 issues)/root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py: pass (16 Markdown files, 281 links)/root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py: pass (1050 files)/root/.local/share/x2w-rev-venv/bin/python -B tests/form_coverage_check.py: passLLVM_LIB=/usr/lib/llvm-19/lib/libLLVM-19.so /root/.local/share/x2w-rev-venv/bin/python -B tests/compute_store_check.py binary /usr/bin/llvm-mc-19 /usr/bin/llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so: pass (exit 0)ctest -R '^compute_store_aot_mimg_load_': not run locally.Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-24T05:08:48Z.
Rebased as a stacked branch after
mainmerged #1207. The #1236 commit is now9657c622(its conflict was resolved in #1236) and thea16commit isceaf2185;mainis908c34bf.The
a16-specific delta is still the final commit (ceaf2185). 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_' -V: 2 passes, 0 failures, 0 skips (eight dmask/address-family cases, 320 UAV words each).ctest --preset dev --no-tests=error -R '^(compute_store_aot_mtbuf_load_|compute_store_aot_mtbuf_store_|compute_root_|compute_tables_|offscreen_capability_table_self_test$)' -V: 9 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.This PR stays stacked on #1236 until that lands.
Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-24T05:15:13Z.
Rebased again after
mainmerged #1211 (D16 typed-buffer loads) and #1169 (float ALU in the compute store profile). New heads onmain55a975ab: #1236 commiteb9269c9,a16commita8be8889.Re-verified on
a8be8889, Windows 11 26H2 build 26300.9974, Intel Arc B390 + WARP:ctest --preset dev --no-tests=error -R '^compute_store_aot_mimg_load_' -V: 2 passes, 0 failures, 0 skips (eight dmask/address-family cases, 320 UAV words each).ctest --preset dev --no-tests=error -R '^(compute_store_aot_mtbuf_load_|compute_store_aot_mtbuf_store_|compute_root_|compute_tables_|offscreen_capability_table_self_test$)' -V: 9 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
a16-specific delta remains the final commit (a8be8889).Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:21:15Z.
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
a8be88895c5073bf6c043a961d9039eb1f4096b2:--preset dev):cmake --build --preset dev --target offscreen_check -- -j 6):3.56s(configure1.78s)ctest --preset dev -R '^(compute_store_aot_mimg_load_warp|compute_store_aot_warp)$' --parallel 4 --no-tests=error --output-on-failure): 2/2 passed (7.18s:compute_store_aot_mimg_load_warp4.67s,compute_store_aot_warp7.07s)/O2(--preset release):cmake --build --preset release --target offscreen_check -- -j 6):1.01s(configure1.83s)ctest --preset release -R '^(compute_store_aot_mimg_load_warp|compute_store_aot_warp)$' --parallel 4 --no-tests=error --output-on-failure): 2/2 passed (6.11s:compute_store_aot_mimg_load_warp4.30s,compute_store_aot_warp6.03s)