shader: lower 32-bit 2D compute image_store and unorm in gfx2hlsl #2391
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2399"
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-25T15:14:43Z.
Summary
Lower 32-bit 2D
image_storein startup compute shaders and accept theunorminteger-coordinate modifier on 2Dimage_storeintools/startup/gfx2hlsl.py.image_store: acceptsdim:SQ_RSRC_IMG_2D,dmask:0xf, four consecutive data VGPRs, two full-width coordinate VGPRs, and an unmodified eight-word image descriptor from a fixed table offset. Emitsasfloat(uint4(...))toRWTexture2D<float4>under the lane's EXEC bit and publishesuav N tex2d float table P O channels 4in the version 2 compute manifest (matching #2300).unormmodifier: accepted onimage_storein both compute and pixel stages, matchingimage_load(MIMGIMAGE_STOREalways addresses unnormalized integer texel coordinatesuint2(x, y)). Partialdmask, non-2D dimensions,a16,tfe,lwe,r128,image_store_mip, modified descriptors, and same-resource load/store aliasing remain refused by name.tests/startup_compute_image_store_check.py(pure-Python controls + WARP and hardware 3-mipR32G32B32A32_FLOATGPU readback reusing#2105's source-built fixture and CPU reference, plus four negative controls), updates the oldrequires d16andunormrefusal assertions intests/startup_compute_image_store_d16_check.pyandtests/startup_pixel_image_store_check.py, and wires the new check intoCMakeLists.txt,.github/workflows/windows.yml,AGENTS.md,docs/experiments.md, anddocs/startup-runtime.md.Refs #2274
Evidence
ea981f1a(based onupstream/maina4900150)10.0.26100.981832.0.32029.2010startup_compute_image_store,startup_compute_image_store_warp,startup_compute_image_store_hardware,startup_compute_image_store_d16,startup_compute_image_store_d16_warp,startup_compute_image_store_d16_hardware,startup_pixel_image_store_controls,startup_pixel_image_store_warp,startup_pixel_image_store_hardware).mismatches=0,debug_errors=0 debug_warnings=0) for full EXEC (unorm) and partial EXEC, and detected all four negative controls (omit store: 64 mismatches, swap R/B: 32 mismatches, swap RG/BA: 64 mismatches, drop EXEC guard: 32 mismatches).Scope
This covers translation and standalone source-built GPU readback for 32-bit 2D
image_store(with and withoutunorm). Slot-67 runtime UAV binding remains tracked in #2274 Part B.Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-25T16:00:34Z.
Approved — solid lowering of 32-bit 2D image_store with unorm. Full test coverage with WARP/hardware readback and negative controls. Manifest version 2 binding correct. No game files.
Imported from R0Y00/Xbox2Windows. Originally posted by Makto94 on 2026-11-25T19:04:16Z.
Hardware run and Windows 11 MSVC build at head
ea981f1a.Environment: Windows 11 Pro build 26300.9974, Debug (
devpreset), MSVC toolset 14.44.35207 (cl 19.44.35230.0), driver 32.0.16.2101. The hardware test printsadapter=NVIDIA GeForce RTX 3070 Ti vendor=10de device=2482andbackend=hardware debug_layer=enabled, withdebug_errors=0 debug_warnings=0in every case. The runs were serial (-j1).Build:
cmake --build --preset devexited 0. This PR changes no C++ source.Tests:
ctest --preset dev --no-tests=error -j1 -R '^startup_compute_image_store(_warp)?$' -V: 2/2 passed (startup_compute_image_store,startup_compute_image_store_warp).ctest --preset dev --no-tests=error -j1 -R '^startup_compute_image_store_hardware$' -V: 1/1 passed. 0 capability skips (77).ctest --preset dev --no-tests=error -j1 -R '^startup_(compute_image_store_d16|pixel_image_store)' -E hardware -V: 4/4 passed (startup_compute_image_store_d16,_d16_warp,startup_pixel_image_store_controls,_warp);ctest --preset dev --no-tests=error -j1 -R '^startup_(compute_image_store_d16|pixel_image_store).*_hardware$' -V: 2/2 passed (startup_pixel_image_store_hardware,startup_compute_image_store_d16_hardware),debug_errors=0 debug_warnings=0in every case, 0 skips (77).The hardware test dispatches 6 cases, each with
groups=2 view_mip=0 compared_words=1344:full EXEC (unorm):mismatches=0.partial EXEC:mismatches=0.Image store readback differs from CPU reference, so the check can fail:omit store(mismatches=64),swap R/B channels(mismatches=32),swap RG/BA pairs(mismatches=64) anddrop EXEC guard(mismatches=32).The WARP run (
adapter=Microsoft Basic Render Driver, driver 10.0.26100.9818) prints the same mismatch counts for all 6 cases, withdebug_errors=0 debug_warnings=0.Not covered by this run: this run is NVIDIA only (the PR body already lists an AMD run); the
compute_store_aot_gfx1013_image_store*tests were not run.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T20:32:10Z.
Review: COMMENTED
Review of head
bdcca315(after updating with main). Comment review, no approval.What I checked:
tools/startup/gfx2hlsl.py: the compute 32-bit path reuses the D16 checks (2D only, dmask 0xf, 4 data VGPRs, 2 full-width coordinate VGPRs, fixed table image, EXEC guard).unormis accepted on image_store in both stages, like image_load. Partial dmask, non-2D, a16/tfe/lwe/r128 and aliasing stay refused by name.requires d16and pixelunormrefusal assertions were updated, and the new check is wired in CMake (CPU and per-adapter),windows.yml(both lists), AGENTS.md and docs.unormfrom the allowed list makes the new check and the pixel check fail (Unsupported: image_store modifier unorm). Swapping channels in the emittedasfloat(uint4(...))makes the new check fail.Commands run locally (Linux, llvm-mc 19):
python3 -B tests/startup_compute_image_store_check.py --llvm-mc llvm-mcPASSpython3 -B tests/startup_compute_image_store_d16_check.py --llvm-mc llvm-mcPASSpython3 -B tests/startup_pixel_image_store_check.py --llvm-mc llvm-mcPASSpython3 tests/docs_links_check.pyPASS,python3 tests/bidi_controls_check.pyPASSgit diff --check origin/main...HEADcleanNot run in this review: the WARP/hardware readback part, which needs Windows. Win2025 receipt follows separately.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T20:42:34Z.
Win2025 WARP receipt for head
bdcca315after updating with main. Targeted run: the new WARP GPU-readback test startup_compute_image_store_warp plus d16 and pixel image_store siblings, 5/5 passed in dev and in release.Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
bdcca3151cc35abe631380f8921ae1f394824dfe:--preset dev):cmake --build --preset dev --target offscreen_check -- -j 2):4.01s(configure0.00s)ctest --preset dev -R '^startup_compute_image_store(_d16)?_warp$|^startup_pixel_image_store' --parallel 2 --no-tests=error --output-on-failure): 5/5 passed (3.22s:startup_pixel_image_store_warp0.79s,startup_pixel_image_store_controls0.18s,startup_compute_image_store_d16_warp1.48s,startup_pixel_image_store_hardware1.08s,startup_compute_image_store_warp1.55s)/O2(--preset release):cmake --build --preset release --target offscreen_check -- -j 2):8.03s(configure0.00s)ctest --preset release -R '^startup_compute_image_store(_d16)?_warp$|^startup_pixel_image_store' --parallel 2 --no-tests=error --output-on-failure): 5/5 passed (3.78s:startup_pixel_image_store_warp1.23s,startup_pixel_image_store_controls0.24s,startup_compute_image_store_d16_warp1.85s,startup_pixel_image_store_hardware0.91s,startup_compute_image_store_warp1.56s)tests/mesh_heap_sampler_check.pyok (0.8s),tests/startup_buffer_address_check.pyok (0.5s),tests/startup_buffer_format_word3_table_check.pyok (0.1s),tests/startup_compute_image_store_check.pyok (0.6s),tests/startup_compute_image_store_d16_check.pyok (0.6s),tests/startup_compute_request_offline_check.pyok (0.5s),tests/startup_compute_translate_check.pyok (0.3s),tests/startup_flat_param_check.pyok (0.1s),tests/startup_gfx2hlsl_add_sub_co_check.pyok (0.1s),tests/startup_gfx2hlsl_add_sub_co_ci_check.pyok (0.2s),tests/startup_gfx2hlsl_bit_alu_check.pyok (0.7s),tests/startup_gfx2hlsl_capture_check.pyok (1.0s),tests/startup_gfx2hlsl_cmp16_check.pyok (0.2s),tests/startup_gfx2hlsl_compare_dst_check.pyok (0.1s),tests/startup_gfx2hlsl_compute_check.pyok (0.4s),tests/startup_gfx2hlsl_cselect_mask_check.pyok (0.1s),tests/startup_gfx2hlsl_cvt_alu_check.pyok (0.1s),tests/startup_gfx2hlsl_cvt_off_f32_i4_check.pyok (0.3s),tests/startup_gfx2hlsl_f32_lg_check.pyok (1.3s),tests/startup_gfx2hlsl_f32_nan_check.pyok (5.3s),tests/startup_gfx2hlsl_getpc_refusal_check.pyok (0.1s),tests/startup_gfx2hlsl_handler_arity_check.pyok (0.1s),tests/startup_gfx2hlsl_image_arity_check.pyok (0.1s),tests/startup_gfx2hlsl_image_get_lod_check.pyok (0.1s),tests/startup_gfx2hlsl_int_med3_check.pyok (0.1s),tests/startup_gfx2hlsl_join_symbols_check.pyok (0.2s),tests/startup_gfx2hlsl_loop_constants_check.pyok (0.1s),tests/startup_gfx2hlsl_mask_overwrite_check.pyok (0.1s),tests/startup_gfx2hlsl_operand_count_check.pyok (0.3s),tests/startup_gfx2hlsl_pack_absdiff_check.pyok (2.5s),tests/startup_gfx2hlsl_readfirstlane_recompute_check.pyok (0.1s),tests/startup_gfx2hlsl_readfirstlane_uniform_check.pyok (0.1s),tests/startup_gfx2hlsl_refusals_check.pyok (0.5s),tests/startup_gfx2hlsl_root_check.pyok (0.7s),tests/startup_gfx2hlsl_sad_check.pyok (0.3s),tests/startup_gfx2hlsl_saveexec_same_reg_check.pyok (0.1s),tests/startup_gfx2hlsl_scalar_arity_check.pyok (0.2s),tests/startup_gfx2hlsl_scalar_brev_fold_check.pyok (0.1s),tests/startup_gfx2hlsl_scalar_m0_check.pyok (0.1s),tests/startup_gfx2hlsl_scalar_table_arity_check.pyok (0.2s),tests/startup_gfx2hlsl_sdwa_cvt_check.pyok (0.2s),tests/startup_gfx2hlsl_sgpr_spill_check.pyok (0.1s),tests/startup_gfx2hlsl_shift64_check.pyok (0.1s),tests/startup_gfx2hlsl_sload_const_offset_check.pyok (0.1s),tests/startup_gfx2hlsl_smem_offset_check.pyok (0.1s),tests/startup_gfx2hlsl_sop2_complement_check.pyok (5.4s),tests/startup_gfx2hlsl_sopk_accum_check.pyok (0.8s),tests/startup_gfx2hlsl_sopk_signext_check.pyok (0.1s),tests/startup_gfx2hlsl_swap_check.pyok (0.3s),tests/startup_gfx2hlsl_vopc_sdwa_check.pyok (4.1s),tests/startup_gfx2hlsl_waitcnt_depctr_check.pyok (0.1s),tests/startup_gfx2hlsl_watch_check.pyok (2.4s),tests/startup_image_2d_array_check.pyok (0.2s),tests/startup_image_3d_check.pyok (0.1s),tests/startup_image_gather_lz_check.pyok (0.5s),tests/startup_image_load_d16_check.pyok (0.8s),tests/startup_image_sample_a16_check.pyok (0.1s),tests/startup_image_sample_b_check.pyok (0.1s),tests/startup_image_sample_c_check.pyok (0.2s),tests/startup_image_sample_l_check.pyok (0.2s),tests/startup_image_sample_lod_check.pyok (0.6s),tests/startup_inline_sampler_check.pyok (0.1s),tests/startup_mesh57_skeleton_check.pyok (0.2s),tests/startup_run_ps1_check.pyok (9.4s),tests/startup_run_sh_check.pyskipped (0.1s),tests/startup_sampler_heap_check.pyok (0.1s),tests/startup_shader_cache_rekey_check.pyok (3.8s),tests/startup_smem_address_check.pyok (0.8s),tests/startup_stream_fetch_check.pyok (0.5s),tests/startup_stream_interface_check.pyok (0.9s),tests/startup_translator_check.pyok (0.6s)sccache: -239/-471 hits; wall74.6sAI-assisted; commands listed were executed locally.