shader: lower image_store on SQ_RSRC_IMG_2D_ARRAY in gfx2hlsl #2736
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2744"
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 triggered02 on 2026-11-26T05:23:25Z.
Lowers the plain
image_storeform ondim:SQ_RSRC_IMG_2D_ARRAY, which adds the full-mask FP32 compute translation. Refs #2742.What changed
tools/startup/gfx2hlsl.py:op_image_storeacceptsSQ_RSRC_IMG_2D_ARRAY— three address registers (x, y, layer),uav(key, 'tex2da'),uint3index — and the stored-image declaration map gainsRWTexture2DArray<float4>. The compute manifest kind follows the UAV kind (tex2dafor arrays, unchangedtex2dfor 2D). Every existing restriction is untouched:dmask:0xfonly, four data VGPRs (packed D16 array stores stay refused), integer coordinates, the EXEC guard,fixed_table_imagefor compute and the existing 2D pixel path. 1D/3D/CUBE keep the verbatim refusal.w0[uint3(v8, v9, v10)] = asfloat(uint4(v14, v15, v16, v17));withRWTexture2DArray<float4> w0 : register(u0);and manifestuav 0 tex2da float table 1 64 channels 4. 2D output is byte-identical to before (w0[uint2(v8, v9)],RWTexture2D,uav 0 tex2d).tests/startup_compute_image_store_check.pygains the array case — layer 1 (middle of a 4-layer, 3-mip array) and layer 3 (last), 16 texels × 4 words per layer with pinned values, verified against a 5,376-word sentinel-prefilled reference (first changed index 1344 / 4032, last 1503 / 4191, remaining 5,312 words untouched), plus refusals for 2-register and 4-register array addresses and for 1D/3D/CUBE. Dispatch cases are wired into the existingstartup_compute_image_store_*test (selector1<<31): layer 1 and 3 → 0 mismatches; omission → 64; one-layer-off → 128.tests/startup_pixel_image_store_check.py: keeps the original pixel-stage array refusal and all 2D controls.docs/experiments.md: one paragraph next to the existing image-store notes.Verified on
38dec200(parentfd033046)Fail-first mutants (temporary, reverted): 2 address registers for arrays →
Unsupported: image_store with 3 address registers: x, y and layer expected;uint2index with the slice dropped →AssertionErroron the emitted-HLSL pin; dim guard widened to accept 1D/3D/CUBE → existing 3D control and the new 1D/3D/CUBE loop both fail.NOT established
tex2da, but the shipped runtime parser still accepts onlyuav … tex2d float table … channels 4and pixel binding rejects arrays — this PR is translation-only.d16array stores (shared path, no fixture), and the GPU dispatch/reassembly cases — those dispatch cases are wired but were not executed locally (no DXC/offscreen_check/llvm-mcin that environment; the test's existing capability-skip convention applies).Refs #2742. Refs #1545. No game data; synthetic ISA bytes and source-built fixtures only.
AI-assisted.
Maintainer retest at
7e5433a8This is the standalone full-mask compute FP32 array emission slice. The startup runtime still needs the array UAV consumer in #2742. Packed D16 and pixel-stage array stores remain refused. Windows Release on WARP and RTX 4060 Laptop passed all 12 compute image-store, packed D16, pixel store and 2D-array CTests, zero skips. Both array cases compare 5,376 words. The omitted-store and wrong-layer controls fail at 64 and 128 words on each adapter. Windows 11 build 26200, debug layer enabled.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-26T05:27:57Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
38dec200faℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T05:28:02Z.
Review: COMMENTED
Review of head
e7fafe57(the PR's own diff is unchanged by the main merge; first read at38dec200).Checked:
op_image_storenow acceptsSQ_RSRC_IMG_2D_ARRAY, requires 3 address registers (x, y, layer), binds the view astex2daand emitsRWTexture2DArray<float4>plusuint3indexing. The manifest line now carries the resource kind (uav N tex2da float ... channels 4). Sibling declaration table and manifest writer are both extended; the pixel path shares the same code.compute_checkfixture path.array = False; bindingtex2dinstead oftex2da.Commands run locally:
python3 tests/startup_compute_image_store_check.pyandtests/startup_pixel_image_store_check.py: passpython3 tests/docs_links_check.py,python3 tests/bidi_controls_check.py,git diff --check origin/main...HEAD: passremote_pycheck.sh --compare origin/main: no failures caused by this PR (the two differing scripts exist only on newer main)No blocking findings. Windows WARP receipt follows separately.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T05:32:22Z.
Review: COMMENTED
Correction to my earlier review of
e7fafe57: CI is red on this head, so this PR is not ready to merge.Failing job: "Assemble and translate gfx1013 fixtures" (run 45761748737).
tests/startup_compute_image_store_check.py --llvm-mc llvm-mc-15stops at line 99 withAssertionError: 1:assemble(llvm_mc, ARRAY_SOURCE.format(layer=layer)) == array_program(layer)is false for layer 1.ARRAY_PROLOGUE,ARRAY_SLICE,ARRAY_DATA,ARRAY_STOREorARRAY_ENDdiffers from what LLVM 15 encodes for the matching line inARRAY_SOURCE. My Linux run did not catch it because it has no llvm-mc, so that comparison was skipped; the earlier "pass" for this check only covered the translator side.image_storeword pair (280f20f0080e0600) and the twov_lshl_add_u32words. Please diff the llvm-mc-15 output against each constant, word by word.Left for the author: fix the bytes, push, and the Windows receipt above stays valid only if the translator is unchanged. Not merging.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-26T05:23:35Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
38dec20ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T05:28:26Z.
Win2025 WARP receipt for head
e7fafe57after updating with main.Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
e7fafe571c22f638a2264ff5d22ff9efc946d5bd:--preset dev):cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check -- -j 2):5.19s(configure2.42s)/O2(--preset release):cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check -- -j 2):1.45s(configure2.56s)tests/startup_compute_image_store_check.pyok (0.8s),tests/startup_pixel_image_store_check.pyok (0.2s)sccache: 3/5 hits; wall21.4sAI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-26T05:41:01Z.
In addition to the LLVM 15 byte mismatch already in review, please keep #2742 open while the emitted array manifest has no startup runtime consumer. For a narrow translator-only PR, use Refs #2742, retain the pixel and packed-half array refusals, and keep emission checks distinct from runtime acceptance. If you want this PR to finish the FP32 compute path, please add the corresponding production manifest/view binding and use that path for the readback. The fixture should bind a nonzero FirstArraySlice, check adjacent untouched slices, and catch a wrong-layer or dropped-EXEC mutation. The standalone offscreen UAV option alone does not validate startup binding.
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-26T05:48:25Z.
Fixed in
42637b0a(test: fix the 2D-array image_store fixture words for llvm-mc-15), on top of38dec200— fast-forward, the translator is unchanged so your WARP receipt still applies.You were right that the check fails at line 99, but the failing words were not
image_storeor thev_lshl_addpair — both are verbatim LLVM-15 words (theimage_storepair280f20f0 080e0600is byte-identical tocompute_mimg_float_store_layers_check.ARRAY_WORDS, whose source line is the same MIMG store). The mismatch was thev14data literal:v_mov_b32_e32 v14, …ff021c7e 00000040(0x40000000)ff021c7e 0000403f(0x3f400000)v_mov_b32_e32 v15, …ff021e7e 00004040(0x40400000)ff021e7e 0000803e(0x3e800000)Root cause:
0x40000000is one of LLVM's inline float constants (2.0, inINLINE_FLOAT_LITERALS), so llvm-mc-15 assemblesv_mov_b32_e32 v14, 0x40000000as the 4-byte inline form0x7e1c02f4rather than the 8-byte literal I had written. Assembled length 80 ≠ the fixture's 84, so the equality failed. The pure-Python decoder prints the same text for both encodings, which is why the local run never saw it.0x40400000(3.0) is not inline, but v15 was moved to another directly-CI-proof literal spelling (0x3e800000= 0.25) so both data moves are covered by fixtures that already runllvm-mc-15in CI.Evidence behind the new bytes (no
llvm-mcon this host, so this is derivation from CI-pinned fixtures plus a disassembler cross-check):compute_mimg_image_uav_load_check.WORDS("Little-endian instruction words from LLVM 15.0.7");8102147e(v10,1) is verbatim fromcompute_mimg_float_store_check.WORDS;8302147e(v10,3) uses the same VOP1 inline-integer field;startup_image_2d_array_check.SAMPLE_WORDS(that test assembles withllvm-mc-15in CI), changing only the VOP1 vdst bits 24:17;s_endpgmare verbatim from the float-store fixture;tools/disasm_rdna2.pydecodes botharray_program(1)andarray_program(3)to 13 instructions whose text equalsARRAY_SOURCEline by line.Also added a local guard:
assert not set(ARRAY_VALUES) & set(G.D.INLINE_FLOAT_LITERALS)so a data word can never silently become an inline constant again without llvm-mc present.ARRAY_VALUESand the dispatch first-mismatch needles follow the new literals (counts unchanged: 64 omitted / 128 one-layer-off).Not established locally: the real
--llvm-mc llvm-mc-15comparison (CI is the confirmation). If CI still fails, the one word not verbatim from an llvm-mc-pinned fixture is8302147e(v10, 3) and that is where I would look next.Checks on
42637b0a:startup_compute_image_store_check0,startup_pixel_image_store_check0,startup_image_2d_array_check0,startup_translator_check0,git diff --check0.Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-26T05:27:57Z.
Code review location:
tools/startup/gfx2hlsl.py; line 6257For a compute shader using
image_store d16withdim:SQ_RSRC_IMG_2D_ARRAY, this broadened guard admits the instruction and the existing D16 path emits a packed two-VGPR conversion as atex2dastore. The repo's gfx1013 store profile rejects D16 on non-2D dimensions (tools/compute_store_aot.py:2863-65;tests/compute_mimg_float_store_d16_check.py:54-57), so this path reports success for a form the project treats as unsupported; keep this combination refused unless it is separately validated.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-26T07:49:47Z.
Review: APPROVED
The enabled form is the full-mask compute FP32 array translator and manifest only. The previously accepted packed D16 array case now refuses before emission, and the original pixel array refusal is restored. All 12 independent Release image store and adjacent CTests passed with no skips on WARP and RTX 4060 Laptop. Each array case matched 5,376 words; omission and wrong layer differed at 64 and 128 words respectively on each adapter. #2742 remains open for the production array binding.
Imported from R0Y00/Xbox2Windows. Originally posted by xiaoqi72665 on 2026-11-26T07:46:17Z.
Hi @triggered02 and @R0Y00 — thanks for the translator work and review guidance. I have a local, AI-assisted runtime follow-up based on
c6f140c, reusing the existing FP32 array lowering rather than duplicating it. It consumes the tex2da compute manifest, preserves the caller's array UAV range, and exercises the production startup slot-67/slot-14 binding and fenced GPU readback. Pixel and packed-half array stores remain refused.On Windows 10 build 19045 (DXC 1.8.2502.11), both WARP (10.0.19041.5794) and RX 7900 XT (32.0.32029.2010) passed: a six-slice RGBA32_FLOAT resource with FirstArraySlice=1, ArraySize=4, relative layers 1 and 3 (physical slices 2 and 4), full and partial EXEC, all 6,144 words compared with zero mismatches in each positive case. Wrong-layer and dropped-EXEC mutants produced the expected 128 and 32 mismatches; an incompatible 2D UAV was refused and its 1,024 words remained unchanged. The new CTests passed on both adapters. Debug layer was unavailable; LLVM 15 assembly verification and integration with current main are still pending. Two existing 2D denied-view reason assertions also failed on the unmodified PR head and the local follow-up; I am checking them against main.
Would you prefer that I provide the incremental patch for this PR, or open a separate dependent runtime PR after the translator changes land? I will preserve the original contribution and avoid a competing implementation. No game data; source-built fixtures only. AI-assisted; the GPU tests above were actually run locally.