Repository navigation
shader: lower image_store on SQ_RSRC_IMG_2D_ARRAY in gfx2hlsl - #2744
Conversation
op_image_store accepted only dim:SQ_RSRC_IMG_2D. The 2D-array form now takes x, y and the layer as three address registers, binds RWTexture2DArray<float4> (manifest kind tex2da) and stores through uint3(x, y, layer), like the sample and load array forms. The dmask:0xf, four-data-VGPR (two for the compute d16 form), integer-coordinate, EXEC-guard, fixed-table and pixel descriptor paths are unchanged, and 1D, 3D and cube keep the same refusal message. The compute fixture stores at layer 1 (middle of a four-layer array) and layer 3 (its last entry), compares all 5,376 words of every layer and mip, and pins omitted-store (64 words) and one-layer-off (128 words) controls. The pixel fixture checks the descriptor path emits uint3 into a RWTexture2DArray while the 2D form stays RWTexture2D/uint2. Refs R0Y00#2742
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour 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. |
There was a problem hiding this comment.
💡 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
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
tedin7
left a comment
There was a problem hiding this comment.
Review of head e7fafe5 (the PR's own diff is unchanged by the main merge; first read at 38dec20).
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.- Tests: the compute check adds an assembled 2D-array program (layers 1 and 3), HLSL and manifest assertions, and a full reference of the 4-layer, 3-mip array. Only mip 0 of the target layer may change, every other word keeps its sentinel. The pixel check gets the matching extension. The D3D12 readback side lives in the existing
compute_checkfixture path. - Mutations (each made the compute check fail, then reverted): forcing
array = False; bindingtex2dinstead oftex2da. - No other open or merged PR covers the 2D-array store (#1649 and #2155 cover the other forms).
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.
|
Win2025 WARP receipt for head e7fafe5 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. |
tedin7
left a comment
There was a problem hiding this comment.
Correction to my earlier review of e7fafe5: 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.- So at least one hand-written word in
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. - Likely suspects: the
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.
|
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. |
The array fixture's data moves v14 = 0x40000000 and v15 = 0x40400000 did not match llvm-mc-15: 0x40000000 is one of the inline float constants LLVM prints (2.0), so the assembler encodes the four-byte inline form (0x7e1c02f4) instead of the eight-byte literal (0xff021c7e 0x00000040). The assembled program is then 80 bytes, not the fixture's 84, and the array comparison in 'startup_compute_image_store_check.py --llvm-mc llvm-mc-15' fails; only that CI job compares the hand-written words because no llvm-mc is available elsewhere. Use literal data words whose encoding is already pinned against llvm-mc-15: v14 = 0x3f400000 and v15 = 0x3e800000 are the literal moves of tests/startup_image_2d_array_check.py (hand-written v0/v1 heads ff02007e/ff02027e), changed only in the VOP1 vdst field (bits 24:17) to 14 and 15. The prologue, slice moves, v16/v17, image_store and s_endpgm words are unchanged: they are verbatim from compute_mimg_image_uav_load_check.WORDS (LLVM 15.0.7), compute_mimg_float_store_check.WORDS and compute_mimg_float_store_layers ARRAY_WORDS. ARRAY_VALUES and the dispatch first-mismatch needles follow the new words, and a control now asserts that the data words avoid G.D.INLINE_FLOAT_LITERALS so this encoding difference is caught without llvm-mc. Refs R0Y00#2742
|
Fixed in You were right that the check fails at line 99, but the failing words were not
Root cause: Evidence behind the new bytes (no
Also added a local guard: Not established locally: the real Checks on |
|
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. |
R0Y00
left a comment
There was a problem hiding this comment.
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.
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 7e5433a
This 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.