shader: prove uniform compute image_load results uniform for v_readfirstlane_b32 #2834
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2842"
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-26T13:18:04Z.
Refs #2644
Implements T5 from #2644: prove compute
image_loadat uniform coordinates through a uniform read-only descriptor uniform forv_readfirstlane_b32intools/startup/gfx2hlsl.py.Summary of changes
tools/startup/gfx2hlsl.py: AddUNIFORM_IMAGE_LOADS(('image_load',)) andStage.uniform_image_load_regs()soStage.one()andStage.translate()treatimage_loaddestination VGPRs as wave-uniform in compute (kind == 'cs',exec_known, and outsideloads_after_exec_write) when:image_storeorimage_atomic*writes (has_image_writesisFalse, fail-closed iftranslate()did not run),pipe.modified,other_modified,stored_images(),masks, orvarying_s,SQ_RSRC_IMG_2D,SQ_RSRC_IMG_3D,SQ_RSRC_IMG_2D_ARRAY),dmask(non-empty bits[3:0]), modifiers (nod16;a16allowed onSQ_RSRC_IMG_2D), and destination VGPR range matchimage_loadsemantics, anduniform_source.Post-entry
image_loadrecomputes viauniform_load_tempsidentically toUNIFORM_LOADS.tests/startup_gfx2hlsl_readfirstlane_uniform_check.py: Add accepted entry-block cases (2D single/multi-channel, packeda16, 2D-array, self-overwriting coordinates) and negative controls (varying coordinates, modified/overwritten descriptor words,image_storein the dispatch,image_load_mip, non-compute/unknownEXEC/branch target, untouched VGPR, and disablingUNIFORM_IMAGE_LOADS).tests/startup_gfx2hlsl_readfirstlane_load_recompute_check.py: Add post-entry single/two-channelimage_loadrecomputation cases and negative controls (image_storein the dispatch,EXEC-modifying loop back edge, skippedexeczblock, post-load join, and disablingUNIFORM_IMAGE_LOADS).tests/startup_compute_readfirstlane_check.py: Add a compute fixture (IMG_LOAD_WORDS) with a post-entry branch join, two-channelimage_load, andv_readfirstlane_b32over two workgroups (--compute-texture-casebindingt0asR32G32B32A32_FLOATandu0), plus varying-coordinate,image_store-presence,UNIFORM_IMAGE_LOADStoggle, and GPU dispatch controls (dropped-img-x-read,dropped-img-y-read).Verification
682d0b9a(based onupstream/main4992a46e)Microsoft Windows NT 10.0.26200.010.0.26100.0, x64) +out/build/release/offscreen_check.exePure-Python checks
Observed results (all exit code
0):Readfirstlane uniformity checks: 0 failedReadfirstlane recompute checks: 0 failedReadfirstlane load recompute checks: 0 failedCompute readfirstlane one-path, loop-counter, log2/ceil, image_load, waterfall and refusal checks passedChecked 2036 tracked source, script and build/CI files: no bidirectional controls.Checked 27 Markdown files and 542 links.WARP dispatch check
Observed (
adapter=Microsoft Basic Render Driver vendor=1414 device=008c,driver=10.0.26100.9818,debug_layer=enabled):img_load baseline (warp): all 320 words matchcontrol dropped-img-x-read (warp): rejected at word=0 expected=00000100 actual=3f840100control dropped-img-y-read (warp): rejected at word=0 expected=00000100 actual=3f840000debug_errors=0 debug_warnings=0across all runs.Physical GPU dispatch check
Observed (
adapter=AMD Radeon RX 7900 XTX vendor=1002 device=744c,driver=32.0.32029.2010,debug_layer=enabled):img_load baseline (hardware): all 320 words matchcontrol dropped-img-x-read (hardware): rejected at word=0 expected=00000100 actual=3f840100control dropped-img-y-read (hardware): rejected at word=0 expected=00000100 actual=3f840000debug_errors=0 debug_warnings=0across all runs.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T13:24:09Z.
Review: COMMENTED
Review of head
682d0b9a(comment only, no merge).Blocking: CI job "Assemble and translate gfx1013 fixtures" is red because of this PR's own test.
tests/startup_compute_readfirstlane_check.py, inimg_load_controls(theif llvm_mc:block near line 403): the LLVM round-trip assertionbuilt == IMG_LOAD_WORDSfails.s_cbranch_scc0 label_0x28.llvm-mcgets no definition for that label, so it encodes a fixup placeholder instead of the offset. Word 8 comes out as0xbf840a0a. The fixture has0xbf840001, which issopp('s_cbranch_scc0', 1).python3 tests/startup_compute_readfirstlane_check.py --llvm-mc /usr/bin/llvm-mc-19. The only differing word of the 25 is word 8. The CI run with LLVM 15 fails the same way.llvm-mcthe numeric form for that branch (s_cbranch_scc0 1), or emit thelabel_0x28:line before the instruction it targets.check_binaryearlier in the same file already passes this check for its own branch fixtures, so mirror what it does.What I checked and found fine
--llvm-mc, the three touched Python checks pass:startup_compute_readfirstlane_check,startup_gfx2hlsl_readfirstlane_load_recompute_check,startup_gfx2hlsl_readfirstlane_uniform_check.docs_links_check,bidi_controls_checkandgit diff --check origin/main...HEADare clean.uniform_image_load_regseach make the new controls fail as they should: (1) ignoringhas_image_writes, and (2) skipping the per-coordinateuniform_sourcecheck. Both give "accepted, expected a refusal naming 'v_readfirstlane_b32 requires a proven uniform source'".I did not run the new WARP
--dispatchreadback yet because CI is red. I will run it on the next head once the test is fixed.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T13:34:39Z.
Review: COMMENTED
Reviewed head
267f56a1: the llvm-mc branch-label fix resolves the earlier CI failure. Checks run locally: touched Python checks, llvm-mc round trip, git diff --check, two mutations of the new lowering (both fail the new controls). Windows WARP dev and release: 6/6 including startup_compute_readfirstlane_warp, receipt above.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-26T13:28:14Z.
Thanks for catching that, @tedin7.
Fixed in
267f56a1:tests/startup_compute_readfirstlane_check.pynow extractsllvm_decoded_lines(decoded)(shared withllvm_lines()) soimg_load_controls()resolvess_cbranch_scc0 label_0x28tos_cbranch_scc0 1before feedingllvm-mc.Re-verified at
267f56a1(Windows10.0.26200.0):startup_compute_readfirstlane_check.py,startup_gfx2hlsl_readfirstlane_uniform_check.py,startup_gfx2hlsl_readfirstlane_load_recompute_check.py,bidi_controls_check.py,docs_links_check.py, andgit diff --check: all passed.startup_compute_readfirstlane_check.py --dispatch(DXC10.0.26100.0+offscreen_check.exe): all cases and negative controls passed withdebug_errors=0 debug_warnings=0on both WARP (10.0.26100.9818) andAMD Radeon RX 7900 XTX(32.0.32029.2010).Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T13:34:33Z.
Win2025 WARP receipt for head
267f56a1. Real-GPU run not available (RunPod stopped).Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
267f56a199ea0e2ec1c67b6fb0e4adb6945f75d9:--preset dev):cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check -- -j 2):26.41s(configure0.00s)ctest --preset dev -R 'readfirstlane' --parallel 6 --no-tests=error --output-on-failure): 6/6 passed (2.25s:startup_gfx2hlsl_readfirstlane_recompute0.17s,startup_gfx2hlsl_readfirstlane_load_recompute0.18s,startup_gfx2hlsl_readfirstlane_uniform0.20s,startup_compute_readfirstlane0.84s,startup_compute_readfirstlane_warp2.07s,startup_compute_readfirstlane_hardware2.10s)/O2(--preset release):cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check -- -j 2):51.88s(configure0.00s)ctest --preset release -R 'readfirstlane' --parallel 6 --no-tests=error --output-on-failure): 6/6 passed (1.96s:startup_gfx2hlsl_readfirstlane_recompute0.13s,startup_gfx2hlsl_readfirstlane_load_recompute0.15s,startup_gfx2hlsl_readfirstlane_uniform0.18s,startup_compute_readfirstlane0.68s,startup_compute_readfirstlane_warp1.80s,startup_compute_readfirstlane_hardware1.82s)tests/mesh_heap_sampler_check.pyok (0.6s),tests/startup_buffer_address_check.pyok (0.4s),tests/startup_buffer_format_word3_table_check.pyok (0.1s),tests/startup_compute_global_load_check.pyok (0.2s),tests/startup_compute_request_offline_check.pyok (0.5s),tests/startup_compute_store_format_xyzw_check.pyok (0.2s),tests/startup_compute_translate_check.pyok (0.2s),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.1s),tests/startup_gfx2hlsl_bfm_b64_check.pyok (1.1s),tests/startup_gfx2hlsl_bit_alu_check.pyok (0.6s),tests/startup_gfx2hlsl_capture_check.pyok (1.1s),tests/startup_gfx2hlsl_cmp16_check.pyok (0.3s),tests/startup_gfx2hlsl_cmp_class_f16_sdwa_check.pyok (26.6s),tests/startup_gfx2hlsl_compare_dst_check.pyok (0.1s),tests/startup_gfx2hlsl_compute_check.pyok (0.7s),tests/startup_gfx2hlsl_compute_mask_spill_check.pyok (2.2s),tests/startup_gfx2hlsl_compute_spill_check.pyok (1.7s),tests/startup_gfx2hlsl_const_copy_join_check.pyok (0.1s),tests/startup_gfx2hlsl_cselect_mask_check.pyok (0.1s),tests/startup_gfx2hlsl_cvt_alu_check.pyok (0.2s),tests/startup_gfx2hlsl_cvt_off_f32_i4_check.pyok (0.2s),tests/startup_gfx2hlsl_cvt_pk_int16_check.pyok (0.3s),tests/startup_gfx2hlsl_f32_lg_check.pyok (1.1s),tests/startup_gfx2hlsl_f32_nan_check.pyok (4.1s),tests/startup_gfx2hlsl_fma_mix_check.pyok (0.1s),tests/startup_gfx2hlsl_getpc_refusal_check.pyok (0.1s),tests/startup_gfx2hlsl_handler_arity_check.pyok (0.1s),tests/startup_gfx2hlsl_heap_record_check.pyok (0.2s),tests/startup_gfx2hlsl_heap_word_check.pyok (0.2s),tests/startup_gfx2hlsl_image_arity_check.pyok (0.1s),tests/startup_gfx2hlsl_image_get_lod_check.pyok (0.2s),tests/startup_gfx2hlsl_int_med3_check.pyok (0.1s),tests/startup_gfx2hlsl_interp_p2_hi_check.pyok (0.2s),tests/startup_gfx2hlsl_join_symbols_check.pyok (0.2s),tests/startup_gfx2hlsl_loop_constants_check.pyok (0.1s),tests/startup_gfx2hlsl_mask_data_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.1s),tests/startup_gfx2hlsl_pack_b32_f16_check.pyok (0.1s),tests/startup_gfx2hlsl_readfirstlane_load_recompute_check.pyok (0.1s),tests/startup_gfx2hlsl_readfirstlane_recompute_check.pyok (0.1s),tests/startup_gfx2hlsl_readfirstlane_uniform_check.pyok (0.2s),tests/startup_gfx2hlsl_refusals_check.pyok (0.6s),tests/startup_gfx2hlsl_root_check.pyok (0.8s),tests/startup_gfx2hlsl_s_abs_check.pyok (0.1s),tests/startup_gfx2hlsl_s_bitset_check.pyok (0.1s),tests/startup_gfx2hlsl_s_ff0_check.pyok (0.1s),tests/startup_gfx2hlsl_s_ff1_check.pyok (0.1s),tests/startup_gfx2hlsl_s_flbit_check.pyok (0.1s),tests/startup_gfx2hlsl_s_quadmask_b64_check.pyok (0.1s),tests/startup_gfx2hlsl_s_quadmask_check.pyok (0.1s),tests/startup_gfx2hlsl_sad_check.pyok (0.3s),tests/startup_gfx2hlsl_sad_hi_msad_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.2s),tests/startup_gfx2hlsl_scalar_m0_check.pyok (0.1s),tests/startup_gfx2hlsl_scalar_null_check.pyok (0.2s),tests/startup_gfx2hlsl_scalar_table_arity_check.pyok (0.3s),tests/startup_gfx2hlsl_sdwa_cndmask_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.2s),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 (4.8s),tests/startup_gfx2hlsl_sopk_accum_check.pyok (1.1s),tests/startup_gfx2hlsl_sopk_signext_check.pyok (0.1s),tests/startup_gfx2hlsl_spill_branches_check.pyok (0.9s),tests/startup_gfx2hlsl_swap_check.pyok (0.3s),tests/startup_gfx2hlsl_vopc_sdwa_check.pyok (3.8s),tests/startup_gfx2hlsl_waitcnt_depctr_check.pyok (0.1s),tests/startup_gfx2hlsl_watch_check.pyok (2.5s),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.2s),tests/startup_image_sample_b_check.pyok (0.2s),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.5s),tests/startup_inline_sampler_check.pyok (0.1s),tests/startup_mesh57_depth_only_check.pyok (0.2s),tests/startup_mesh57_lane_spill_check.pyok (0.2s),tests/startup_mesh57_loop_check.pyok (0.2s),tests/startup_mesh57_loop_refusal_check.pyok (0.1s),tests/startup_mesh57_skeleton_check.pyok (1.1s),tests/startup_run_ps1_check.pyok (11.7s),tests/startup_run_sh_check.pyskipped (0.1s),tests/startup_sampler_heap_check.pyok (0.1s),tests/startup_shader_cache_rekey_check.pyok (2.2s),tests/startup_smem_address_check.pyok (0.1s),tests/startup_stream_fetch_check.pyok (0.2s),tests/startup_stream_interface_check.pyok (0.2s),tests/startup_translator_check.pyok (0.4s)sccache: 0/6 hits; wall171.7stested:
267f56a1via fetch (pull/2842/head, no patch)Review of
267f56a1: the earlier CI failure (llvm-mc branch label in the image_load fixture) is fixed; the three touched Python checks and the llvm-mc round trip pass, two code mutations make the new controls fail, and a targeted WARP-vs-CPU check of readfirstlane shapes showed 0 mismatches.AI-assisted; commands listed were executed locally.