Repository navigation
shader: lower s_bfe_u64 and s_bfe_i64 in pixel_aot - #642
Merged
Merged
Conversation
MarlomMedeiros
left a comment
Contributor
There was a problem hiding this comment.
Community review + independent run on a second-vendor adapter, since the reported hardware is a Radeon RX 9060 XT.
Environment
- Commit under test:
e4c1dcf(feature) /6c55a82(branch head, merge with upstream) - Windows 11 build 26300.10075, VS 2026 MSVC 19.52, Ninja, DXC from SDK 10.0.26100
ctest --preset dev --no-tests=error -R '^pixel_aot_blend_scalar_(warp|hardware)$' -V: both passed- Hardware: NVIDIA GeForce RTX 5070 (vendor=10de device=2f04), driver 32.0.16.2135, D3D12 debug layer enabled,
debug_errors=0 debug_warnings=0,pixels=4096 max_absolute_error=0 - WARP: Microsoft Basic Render Driver, driver 10.0.26100.10068
tests/pixel_aot_check.pycontrols,tests/form_coverage_check.py,tests/rdna2_tools_check.pyand the LLVM 15.0.7 binary round-trip all pass one4c1dcf
Review notes
- The
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. - SCC is
(x | y) != 0across both dwords, which the draw verifies through an opposite-seededs_cselectrather than a bare flag check. - Test breadth is good: empty field, zero result, cross-dword negative field, width clamps at both ends, ignored high control bits, sNaN bit preservation, and a Python reference model per case.
- Interaction note for #651 (exec-masked regions, open):
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. - Heads-up: the branch head is a merge commit (
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.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 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.