shader: prove v_log_f32 and v_ceil_f32 results uniform for v_readfirstlane_b32 #2830
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2838"
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-26T12:48:54Z.
Refs #2644
Implements T4 from #2644: prove
v_log_f32andv_ceil_f32of wave-uniform sources uniform forv_readfirstlane_b32intools/startup/gfx2hlsl.py.Summary of changes
tools/startup/gfx2hlsl.py: Add'v_log_f32'and'v_ceil_f32'toUNIFORM_VALU. Both are unaryVEC_Farithmetic ops (log2({0})andceil({0})), so adding them inherits input modifier stripping (-,|...|), allowed output modifiers (clamp,mul:2,mul:4,div:2), varying-source refusal, lane-mask data-operand refusal, anduniform_exprrecomputation past control-flow joins.tests/startup_gfx2hlsl_readfirstlane_uniform_check.py: Add accepted cases (base-2 logarithm,clamped log2 of abs scalar,ceiling,scaled ceiling of negated scalar,log2 then ceil chain) and refused negative controls (varying source and lane-mask source withEARLIERdiagnostics).tests/startup_gfx2hlsl_readfirstlane_recompute_check.py: Add'log2 then ceil after a join'recompute check past a branch join.tests/startup_compute_readfirstlane_check.py: Add a compute fixture (log_ceil_baseline) computing uniformlog2andceilvalues across 2 workgroups beforev_readfirstlane_b32, negative-control refusals (v_log_f32/v_ceil_f32withv0, and dropping'v_log_f32'or'v_ceil_f32'fromUNIFORM_VALU), and GPU dispatch controls (dropped-log2-read,dropped-ceil-read).Verification
171ca7de(based onupstream/main174f963d)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, waterfall and refusal checks passedChecked 2033 tracked source, script and build/CI files: no bidirectional controls.Checked 27 Markdown files and 541 links.WARP dispatch check
Observed (
adapter=Microsoft Basic Render Driver vendor=1414 device=008c,driver=10.0.26100.9818,debug_layer=enabled):log_ceil baseline (warp): all 320 words matchcontrol dropped-log2-read (warp): rejected at word=0 expected=00000403 actual=00000003control dropped-ceil-read (warp): rejected at word=0 expected=00000403 actual=00000400debug_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):log_ceil baseline (hardware): all 320 words matchcontrol dropped-log2-read (hardware): rejected at word=0 expected=00000403 actual=00000003control dropped-ceil-read (hardware): rejected at word=0 expected=00000403 actual=00000400debug_errors=0 debug_warnings=0across all runs.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T12:57:56Z.
Review: COMMENTED
Review of head
171ca7deagainst main (comment only).Result: sound, no blocking findings.
v_log_f32andv_ceil_f32use only local arithmetic on their own source, so a uniform input gives a uniform output. Adding them toUNIFORM_VALUis correct. Varying sources and lane-mask sources are still refused (new REFUSED cases cover both).v_readfirstlane_b32, runs it as a D3D12 dispatch, and compares every output word with the CPU reference. Two negative controls (dropped log2 read, dropped ceil read) fail with the expected word.Commands executed locally:
python3 tests/startup_compute_readfirstlane_check.py,tests/startup_gfx2hlsl_readfirstlane_uniform_check.py,tests/startup_gfx2hlsl_readfirstlane_recompute_check.py: all pass.python3 tests/docs_links_check.py,python3 tests/bidi_controls_check.py,git diff --check origin/main...HEAD: clean.v_log_f32fromUNIFORM_VALUmakes all three tests fail (restored afterwards).Real-GPU run not available (hardware pool stopped).
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T12:57:57Z.
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
171ca7decd2dc3581c762e5f7d2819d25dd85ffb:--preset dev):cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check -- -j 2):26.41s(configure1.89s)ctest --preset dev -R 'readfirstlane' --parallel 2 --no-tests=error --output-on-failure): 6/6 passed (2.41s:startup_compute_readfirstlane_hardware1.64s,startup_compute_readfirstlane_warp1.64s,startup_gfx2hlsl_readfirstlane_uniform0.14s,startup_gfx2hlsl_readfirstlane_recompute0.11s,startup_gfx2hlsl_readfirstlane_load_recompute0.11s,startup_compute_readfirstlane0.63s)/O2(--preset release):cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check -- -j 2):47.47s(configure2.03s)ctest --preset release -R 'readfirstlane' --parallel 2 --no-tests=error --output-on-failure): 6/6 passed (2.09s:startup_compute_readfirstlane_warp1.39s,startup_compute_readfirstlane_hardware1.40s,startup_gfx2hlsl_readfirstlane_uniform0.13s,startup_gfx2hlsl_readfirstlane_recompute0.10s,startup_gfx2hlsl_readfirstlane_load_recompute0.10s,startup_compute_readfirstlane0.55s)tests/mesh_heap_sampler_check.pyok (1.4s),tests/startup_buffer_address_check.pyok (1.0s),tests/startup_buffer_format_word3_table_check.pyok (0.2s),tests/startup_compute_global_load_check.pyok (0.4s),tests/startup_compute_request_offline_check.pyok (1.0s),tests/startup_compute_store_format_xyzw_check.pyok (0.5s),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.2s),tests/startup_gfx2hlsl_add_sub_co_ci_check.pyok (0.3s),tests/startup_gfx2hlsl_bfm_b64_check.pyok (2.3s),tests/startup_gfx2hlsl_bit_alu_check.pyok (1.4s),tests/startup_gfx2hlsl_capture_check.pyok (2.2s),tests/startup_gfx2hlsl_cmp16_check.pyok (0.6s),tests/startup_gfx2hlsl_cmp_class_f16_sdwa_check.pyok (30.2s),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.2s),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.0s),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.1s),tests/startup_gfx2hlsl_refusals_check.pyok (0.5s),tests/startup_gfx2hlsl_root_check.pyok (0.7s),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.1s),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.0s),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.0s),tests/startup_run_ps1_check.pyok (11.9s),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; wall185.3sWin2025 WARP receipt for head
171ca7de.AI-assisted; commands listed were executed locally.