You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
shader: lower quad-local DPP16 and DPP8 f32/move/select ops in pixel_aot - #408
Lower quad-local DPP16 (quad_perm) and DPP8 (dpp8) forms for all 20 currently supported VOP1/VOP2 pixel operations in tools/pixel_aot.py, advancing coverage from 0/101 to 20/101 on DPP16 and 0/101 to 20/101 on DPP8 (+40 forms on both gfx1013 and gfx1030):
Portable SM 6.0 quad swizzling: Swizzles src0 as uint bits (asuint) through QuadReadAcrossX, QuadReadAcrossY, QuadReadAcrossDiagonal, or uniform QuadReadLaneAt (selected via WaveGetLaneIndex() & 3u), keeping subnormal/binary16 bit patterns intact and staying valid across wave widths 4 (WARP) through 64.
Strict fail-closed validation: Accepts quad_perm:[0..3,...] with row_mask:0xf bank_mask:0xf (plus optional bound_ctrl:[01]/fi:[01]) and quad-local dpp8:[p0..p3, p0+4..p3+4] (plus optional fi:[01]). Allows -/|.|/abs() modifiers on DPP16 floating-point ops and rejects them on DPP8, v_mov_b32_dpp, and v_cndmask_b32_dpp. Rejects cross-quad DPP8, row_*/wave_* controls, partial masks, non-VGPR operands, non-vcc select masks, WQM, and vmcnt hazards.
Genuine 4-lane quad draw fixture:DPP_BODY derives per-quad lane ID {0, 1, 2, 3} from interpolated uv.x/uv.y (v8/v9, while v_mov_b32_e32 keeps rejecting v8), tests all 20 forms across 2 constant sets with exact binary16 outputs immune to transcendental ULP differences, and verifies 6 negative mutations (AcrossX vs AcrossY, AcrossY vs AcrossX, cyclic dpp8 rotation, lane broadcast, DPP16 negation, and floor vs ceil).
Verification
Tested on Linux x86_64 (Python 3.13.5, LLVM 19.1.7, Clang 19.1.7) on top of 6549244:
python3 -B tests/pixel_aot_check.py binary llvm-mc-19 llvm-objcopy-19 libLLVM-19.so — passed (controls, negative controls, and llvm-mc -mcpu=gfx1013 assembly→DXBC/XDAT/XBCH/FSSM→disassembly→lowering parity for DPP_BODY and all existing fixtures).
Verified tools/form_coverage.py records 20 DPP16 and 20 DPP8 forms against both docs/coverage/gfx1013.tsv and docs/coverage/rdna2.tsv.
Executed the actual generated HLSL for DPP_BODY and all 6 negative mutations on a 4-lane SIMT 2×2 pixel quad harness compiled as C++20 with clang++-19 -std=c++20 -O2 -Wall -Wextra -Wpedantic -Werror -fsanitize=undefined,address — bit-exact match across all 4 quad lanes on both constant sets and all 6 mutations caught; 0 sanitizer errors.
Windows C++, DXC (dxc -Gis -T ps_6_0), WARP (pixel_aot_warp), and hardware (pixel_aot_hardware) checks were not run locally on Linux; relying on the build-and-test Windows CI job to verify DXC compilation and D3D12 WARP quad readback.
Evidence and follow-up
All new test fixtures in tests/pixel_aot_check.py are original MIT-licensed gfx1013 assembly sequences built from source at test time.
Refreshed #408 onto current main (075413d, preserving all merged VOP3P/SDWA/conversion draw suites and using the shared compile_shader helper); all 4 CI checks pass. Holding off on refreshing #414, #419, #421, #423, and #428 until this base lands.
and subprocess.run(draw, check=True) raises in check_dpp_draw (tests/pixel_aot_check.py:2778, called from check_render at 4818). The HRESULT is E_OUTOFMEMORY, returned by CreateGraphicsPipelineState (tests/pixel_aot_render.cpp:99), so the draw fails before any pixel is compared. I have not narrowed it to a single v_*_dpp line.
Thanks for the hardware measurement @Leyukaka! This matches the exact NVIDIA Blackwell driver exception recorded in #363 for the curve fixture (RTX 5060 Ti driver 32.0.16.2124 refused CreateGraphicsPipelineState with E_OUTOFMEMORY under -denorm preserve on curve, which uses log2/exp2/1.0f / x/mul_legacy, while passing under mode="any" and on WARP/AMD).
When #408 was refreshed onto #363, check_dpp_draw moved from ps_6_0 to compile_shader() (mode="preserve") and DPP_BODY uses those same operations (v_log_f32_dpp, v_exp_f32_dpp, v_rcp_f32_dpp, v_mul_legacy_f32_dpp). In addition, emit_quad_swizzle_u32 was inlining fast-path QuadRead* calls directly into v_mul_legacy_f32_dpp's ternary expression.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
Lower quad-local
DPP16(quad_perm) andDPP8(dpp8) forms for all 20 currently supportedVOP1/VOP2pixel operations intools/pixel_aot.py, advancing coverage from0/101to20/101onDPP16and0/101to20/101onDPP8(+40 forms on bothgfx1013andgfx1030):v_*_dppinstructions (20):v_mov_b32_dpp,v_cvt_f32_f16_dpp,v_cndmask_b32_dpp, 9 unaryf32ops (log,exp,rcp,sqrt,rsq,floor,ceil,fract,trunc), and 8 binary/accumulatef32ops (add,sub,subrev,mul,mul_legacy,min,max,fmac).src0asuintbits (asuint) throughQuadReadAcrossX,QuadReadAcrossY,QuadReadAcrossDiagonal, or uniformQuadReadLaneAt(selected viaWaveGetLaneIndex() & 3u), keeping subnormal/binary16 bit patterns intact and staying valid across wave widths 4 (WARP) through 64.quad_perm:[0..3,...]withrow_mask:0xf bank_mask:0xf(plus optionalbound_ctrl:[01]/fi:[01]) and quad-localdpp8:[p0..p3, p0+4..p3+4](plus optionalfi:[01]). Allows-/|.|/abs()modifiers onDPP16floating-point ops and rejects them onDPP8,v_mov_b32_dpp, andv_cndmask_b32_dpp. Rejects cross-quadDPP8,row_*/wave_*controls, partial masks, non-VGPR operands, non-vccselect masks, WQM, andvmcnthazards.DPP_BODYderives per-quad lane ID{0, 1, 2, 3}from interpolateduv.x/uv.y(v8/v9, whilev_mov_b32_e32keeps rejectingv8), tests all 20 forms across 2 constant sets with exact binary16 outputs immune to transcendental ULP differences, and verifies 6 negative mutations (AcrossXvsAcrossY,AcrossYvsAcrossX, cyclicdpp8rotation, lane broadcast,DPP16negation, andfloorvsceil).Verification
Tested on Linux x86_64 (Python 3.13.5, LLVM 19.1.7, Clang 19.1.7) on top of
6549244:python3 -B tests/pixel_aot_check.py binary llvm-mc-19 llvm-objcopy-19 libLLVM-19.so— passed (controls, negative controls, andllvm-mc -mcpu=gfx1013assembly→DXBC/XDAT/XBCH/FSSM→disassembly→lowering parity forDPP_BODYand all existing fixtures).python3 -B tests/ffx_dispatch_aot_check.py llvm-mc-19 llvm-objcopy-19 libLLVM-19.so— passed.python3 -B tests/script_state_check.py,tests/bcpack_check.py,tests/resource_ranges_check.py,tests/layout_chunks_check.py,tests/docs_links_check.py,tests/bidi_controls_check.py— all passed.tools/form_coverage.pyrecords 20DPP16and 20DPP8forms against bothdocs/coverage/gfx1013.tsvanddocs/coverage/rdna2.tsv.DPP_BODYand all 6 negative mutations on a 4-lane SIMT 2×2 pixel quad harness compiled as C++20 withclang++-19 -std=c++20 -O2 -Wall -Wextra -Wpedantic -Werror -fsanitize=undefined,address— bit-exact match across all 4 quad lanes on both constant sets and all 6 mutations caught; 0 sanitizer errors.dxc -Gis -T ps_6_0), WARP (pixel_aot_warp), and hardware (pixel_aot_hardware) checks were not run locally on Linux; relying on thebuild-and-testWindows CI job to verify DXC compilation and D3D12 WARP quad readback.Evidence and follow-up
tests/pixel_aot_check.pyare original MIT-licensedgfx1013assembly sequences built from source at test time.DPP16/DPP8work: integer/bitwise/shift/conversion/f16v_*_dppforms once their corresponding base ops land or in focused follow-up PRs.Checklist