shader: lower s_bfe_u64 and s_bfe_i64 in pixel_aot #636
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/642"
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 lambirou on 2026-11-22T17:14:05Z.
Change
Lower the signed and unsigned 64-bit scalar bitfield extracts in
pixel_aot, extending the scalar BFE profile from #279. The selector supplies a six-bit offset and a seven-bit width. A zero width returns zero, fields stop at bit 63, ands_bfe_i64extends the sign of the extracted field. SCC reflects whether either result dword is nonzero.The lowering reuses the two-dword shifts and accepts aligned numeric SGPR pairs, including when the destination aliases a source. Both the data and field selector can use the supported scalar immediates.
Verification
Tested
e4c1dcfonmainatb03f754. Windows 11 build 26300, WARP10.0.26100.10068, AMD Radeon RX 9060 XT driver32.0.32029.2010, D3D12 debug layer unavailable.All 12 CTest checks passed, including 11 WARP tests and the scalar draw on Radeon, with zero skips. The Python checks and LLVM 23.1.5 round-trip passed.
Evidence
The source-built MIT fixture compares both result dwords and SCC against a Python reference through an integer render target. Eleven inputs per form exercise empty fields, a field crossing the dword boundary, a high-word-only result, widths of 64 and 127, ignored selector bits, and a raw signaling NaN bit pattern. SCC starts at the opposite of the expected result. Each shader must report a mismatch against the other form's cross-dword reference. Operand tests cover invalid pairs, EXEC operands, and pending scalar loads.
The focused pre-rebase measurement at base
1947e97gained two SOP2 forms, from 139 to 141 of 1,968 in gfx1013 and from 135 to 137 of 1,863 in the gfx1030 reference. The coverage test checks both new forms in both references.Checklist
AI-assisted implementation and test preparation. The reported Xbox2Windows checks were run locally.
Imported from R0Y00/Xbox2Windows. Originally posted by MarlomMedeiros on 2026-11-22T18:05:47Z.
Review: COMMENTED
Community review + independent run on a second-vendor adapter, since the reported hardware is a Radeon RX 9060 XT.
Environment
e4c1dcf(feature) /6c55a82(branch head, merge with upstream)ctest --preset dev --no-tests=error -R '^pixel_aot_blend_scalar_(warp|hardware)$' -V: both passeddebug_errors=0 debug_warnings=0,pixels=4096 max_absolute_error=0tests/pixel_aot_check.pycontrols,tests/form_coverage_check.py,tests/rdna2_tools_check.pyand the LLVM 15.0.7 binary round-trip all pass one4c1dcfReview notes
s_bfe64helper is the classic left-align extraction:aligned = src << (64 - width - offset)then>> (64 - width)arithmetically for i64 and logically for u64. Field clampmin(width, 64 - offset)implements the ISA's "field stops at bit 63" andwidth == 0returns zero. The six-bit offset and seven-bit width match the packed selector.(x | y) != 0across both dwords, which the draw verifies through an opposite-seededs_cselectrather than a bare flag check.s_bfe_u64/s_bfe_i64currently sit in therejected_formsassertion there. Whichever PR merges second updates that list — trivial either way. Inside a masked region these stays_*ops, correctly denied.6c55a82); if upstream prefers linear history a rebase may be requested, and the diff againstb03f754is clean.No blockers found.
AI-assisted: yes. All reported checks ran locally on the adapter and driver listed.