shader: lower s_quadmask_b32 in gfx2hlsl (Part of #1723) #2634
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2642"
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 SimSalabimse on 2026-11-26T00:10:44Z.
Change
Part of #1723: port
s_quadmask_b32frompixel_aotintotools/startup/gfx2hlsl.py.SCC = (D != 0)s_quadmask_b64stays refusedClaim before coding. Base is
main.AI-assisted.
Verification
Commit under test: this PR head (includes
sopk_accummutant-needle pin so the plain-scalar allow-list line is not required to be unique).All passed on Linux (CPU evaluation of the translated text). Windows WARP/hardware draws were not run here; the fixture is device-free.
Windows verification:
Evidence and follow-up
disasm_rdna2/gfx2hlsl.decode; no retail bytes.Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T00:16:13Z.
Review: COMMENTED
Review of head
cd8ac407(comment only, not an approval).What looks right
op_s_quadmask_b32(tools/startup/gfx2hlsl.py): nibble-to-bit fold is correct for immediate, constant-symbol and SGPR sources; SCC = (result != 0) matches the ISA; lane masks and descriptor-bearing SGPRs are refused; the 64-bit form is explicitly left out.What is missing
Commands run locally (Linux, detached worktree on the PR head)
$ != 0flipped to$ == 0-> check FAILED (SGPR + immediate cases)AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-26T00:49:19Z.
Host Windows retest on this PR head:
Passed:
startup_gfx2hlsl_s_quadmask,startup_gfx2hlsl_s_quadmask_dispatch_warp,startup_gfx2hlsl_s_quadmask_dispatch_hardware(3/3).Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T01:36:36Z.
Review: COMMENTED
Review of head
9907580b(the head with the D3D12 WARP readback test I asked for).Checked:
op_s_quadmask_b32matches the ISA rule (bit g of D = nibble g of S0 nonzero, SCC = D != 0). Immediate, tracked-constant and runtime SGPR paths all agree. Lane masks and descriptor-bearing sources are refused; 64-bit form stays out of scope.startup_gfx2hlsl_s_quadmask_check.pyhas a CPU reference, refusal controls, and a real D3D12 UAV dispatch with readback of result, SCC and SCC branch (startup_gfx2hlsl_s_quadmask_dispatch_warp/_hardware, SKIP 77 when no device). Wired into CMake,windows.ymland AGENTS.md.pixel_aot.pyalready has its own quadmask helper, scan_unsupported list and coverage tsv already name the opcode. No other open or merged PR found for this opcode.Commands run locally:
python3 -B tests/startup_gfx2hlsl_s_quadmask_check.py-> all okpython3 tests/docs_links_check.py-> okpython3 tests/bidi_controls_check.py-> okgit diff --check origin/main...HEAD-> cleanNo blocking findings. This is a translation-only change; no game was used. Win2025 dev+release receipt to follow.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T02:36:44Z.
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at head
3f71b94e1(PR head9a65a028+ merge of origin/main, applied as a patch):--preset dev):cmake --build --preset dev --target offscreen_check -- -j 2):104.06s(configure3.73s)ctest --preset dev -R 'startup_gfx2hlsl_s_quadmask' --parallel 2 --no-tests=error --output-on-failure): 3/3 passed (0.74s:startup_gfx2hlsl_s_quadmask0.17s,startup_gfx2hlsl_s_quadmask_dispatch_warp0.33s,startup_gfx2hlsl_s_quadmask_dispatch_hardware0.31s)/O2(--preset release):cmake --build --preset release --target offscreen_check -- -j 2):201.06s(configure4.58s)ctest --preset release -R 'startup_gfx2hlsl_s_quadmask' --parallel 2 --no-tests=error --output-on-failure): 3/3 passed (0.79s:startup_gfx2hlsl_s_quadmask0.22s,startup_gfx2hlsl_s_quadmask_dispatch_warp0.33s,startup_gfx2hlsl_s_quadmask_dispatch_hardware0.32s)tests/mesh_heap_sampler_check.pyok (1.2s),tests/startup_buffer_address_check.pyok (0.8s),tests/startup_buffer_format_word3_table_check.pyok (0.2s),tests/startup_compute_request_offline_check.pyok (0.8s),tests/startup_compute_store_format_xyzw_check.pyok (0.4s),tests/startup_compute_translate_check.pyok (0.4s),tests/startup_flat_param_check.pyok (0.3s),tests/startup_gfx2hlsl_add_sub_co_check.pyok (0.1s),tests/startup_gfx2hlsl_add_sub_co_ci_check.pyok (0.3s),tests/startup_gfx2hlsl_bit_alu_check.pyok (1.3s),tests/startup_gfx2hlsl_capture_check.pyok (1.8s),tests/startup_gfx2hlsl_cmp16_check.pyok (0.5s),tests/startup_gfx2hlsl_compare_dst_check.pyok (0.1s),tests/startup_gfx2hlsl_compute_check.pyok (0.8s),tests/startup_gfx2hlsl_cselect_mask_check.pyok (0.2s),tests/startup_gfx2hlsl_cvt_alu_check.pyok (0.3s),tests/startup_gfx2hlsl_cvt_off_f32_i4_check.pyok (0.4s),tests/startup_gfx2hlsl_cvt_pk_int16_check.pyok (0.5s),tests/startup_gfx2hlsl_f32_lg_check.pyok (2.3s),tests/startup_gfx2hlsl_f32_nan_check.pyok (9.1s),tests/startup_gfx2hlsl_fma_mix_check.pyok (0.2s),tests/startup_gfx2hlsl_getpc_refusal_check.pyok (0.2s),tests/startup_gfx2hlsl_handler_arity_check.pyok (0.2s),tests/startup_gfx2hlsl_image_arity_check.pyok (0.2s),tests/startup_gfx2hlsl_image_get_lod_check.pyok (0.3s),tests/startup_gfx2hlsl_int_med3_check.pyok (0.2s),tests/startup_gfx2hlsl_interp_p2_hi_check.pyok (0.4s),tests/startup_gfx2hlsl_join_symbols_check.pyok (0.4s),tests/startup_gfx2hlsl_loop_constants_check.pyok (0.2s),tests/startup_gfx2hlsl_mask_data_check.pyok (0.2s),tests/startup_gfx2hlsl_mask_overwrite_check.pyok (0.2s),tests/startup_gfx2hlsl_operand_count_check.pyok (0.5s),tests/startup_gfx2hlsl_pack_absdiff_check.pyok (4.7s),tests/startup_gfx2hlsl_pack_b32_f16_check.pyok (0.3s),tests/startup_gfx2hlsl_readfirstlane_recompute_check.pyok (0.2s),tests/startup_gfx2hlsl_readfirstlane_uniform_check.pyok (0.2s),tests/startup_gfx2hlsl_refusals_check.pyok (1.0s),tests/startup_gfx2hlsl_root_check.pyok (1.1s),tests/startup_gfx2hlsl_s_abs_check.pyok (0.2s),tests/startup_gfx2hlsl_s_bitset_check.pyok (0.2s),tests/startup_gfx2hlsl_s_ff1_check.pyok (0.2s),tests/startup_gfx2hlsl_s_flbit_check.pyok (0.2s),tests/startup_gfx2hlsl_s_quadmask_check.pyok (0.2s),tests/startup_gfx2hlsl_sad_check.pyok (0.5s),tests/startup_gfx2hlsl_saveexec_same_reg_check.pyok (0.2s),tests/startup_gfx2hlsl_scalar_arity_check.pyok (0.3s),tests/startup_gfx2hlsl_scalar_brev_fold_check.pyok (0.3s),tests/startup_gfx2hlsl_scalar_m0_check.pyok (0.3s),tests/startup_gfx2hlsl_scalar_table_arity_check.pyok (0.5s),tests/startup_gfx2hlsl_sdwa_cvt_check.pyok (0.4s),tests/startup_gfx2hlsl_sgpr_spill_check.pyok (0.3s),tests/startup_gfx2hlsl_shift64_check.pyok (0.3s),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 (10.7s),tests/startup_gfx2hlsl_sopk_accum_check.pyok (1.6s),tests/startup_gfx2hlsl_sopk_signext_check.pyok (0.2s),tests/startup_gfx2hlsl_swap_check.pyok (0.5s),tests/startup_gfx2hlsl_vopc_sdwa_check.pyok (7.2s),tests/startup_gfx2hlsl_waitcnt_depctr_check.pyok (0.1s),tests/startup_gfx2hlsl_watch_check.pyok (3.1s),tests/startup_image_2d_array_check.pyok (0.3s),tests/startup_image_3d_check.pyok (0.3s),tests/startup_image_gather_lz_check.pyok (1.0s),tests/startup_image_load_d16_check.pyok (1.6s),tests/startup_image_sample_a16_check.pyok (0.4s),tests/startup_image_sample_b_check.pyok (0.4s),tests/startup_image_sample_c_check.pyok (0.3s),tests/startup_image_sample_l_check.pyok (0.3s),tests/startup_image_sample_lod_check.pyok (0.9s),tests/startup_inline_sampler_check.pyok (0.3s),tests/startup_mesh57_depth_only_check.pyok (0.3s),tests/startup_mesh57_loop_refusal_check.pyok (0.3s),tests/startup_mesh57_skeleton_check.pyok (1.8s),tests/startup_run_ps1_check.pyok (17.5s),tests/startup_run_sh_check.pyskipped (0.1s),tests/startup_sampler_heap_check.pyok (0.3s),tests/startup_shader_cache_rekey_check.pyok (4.4s),tests/startup_smem_address_check.pyok (0.3s),tests/startup_stream_fetch_check.pyok (0.4s),tests/startup_stream_interface_check.pyok (0.4s),tests/startup_translator_check.pyok (0.7s)sccache: 207/254 hits; wall417.2sMerged origin/main with no conflicts (foreach/endforeach balanced, 370/370). Linux: tests/startup_gfx2hlsl_s_quadmask_check.py ok.
AI-assisted; commands listed were executed locally.