shader: lower 64-bit scalar bitset forms #709
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/715"
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-22T22:19:35Z.
Change
Add s_bitset0_b64 and s_bitset1_b64 to pixel_aot. Both forms read the
incoming SGPR pair, mask the source index to six bits and clear or set that bit
while preserving the other 63 bits and SCC. The lowerer reuses the existing
SGPR-pair and 32-bit bitset conventions.
The source-built fixture covers indices 0, 31, 32, 63 and 64 with both initial
SCC values. It exports both result words and SCC. It also carries the exact
all-ones NaN-shaped pair from PR #680 at index 31, where setting the bit must
retain 0xffffffff through the full-width integer readback, and reads the index
from either destination word. A negative reference that applies index 31 to the
high destination word, and a second that re-reads an aliased index after the
destination write, must report pixel_mismatch.
The lowerer overlaps the two b64 forms proposed in PR #680. This branch adds
the boundary, SCC, exact-integer and aliased-index controls to that work. One
implementation should land as the copy of record and the other should follow it
with the complementary tests.
GitHub searches for the two exact mnemonics found no open issue or pull request.
Open PR #620 exercises the adjacent 32-bit SOP1 forms and does not change the
translator.
Verification
The final local commit is
1f22244262, rebasedonto main
787ace7after the quadmask/bitreplicate PR #716 merged.Both development and Release builds passed 2 of 2 on WARP
10.0.26100.10068 and AMD Radeon RX 9060 XT driver 32.0.32029.2010.
All 30 positive draws checked 4,096 pixels, 16,384 channels and bits, with
maximum absolute error 0. All three negative controls mismatched. Windows build
26300.10075, D3D12 debug layer unavailable, no skipped tests. No NVIDIA adapter
was available locally. rwZephyr independently ran the same
1f22244revision onWindows 10 22H2 build 19045.6466, MSVC 19.44.35230, DXC 1.8.2502.11 and zero
skips. The RTX 3060 Ti, driver 32.0.16.2124, and in-box WARP 10.0.19041.5794
both passed 30 positive draws and all three expected mismatches. The exact
all-ones case matched 0xffffffff in both words with SCC 0 and 1. Setting only
the reference low word to 0x7fffffff produced expected_bits=7fffffff and
actual_bits=ffffffff at pixel (0, 0) on both adapters.
Release used MSVC 19.52.37029.0, CMAKE_CXX_FLAGS_RELEASE=/O2 /Ob2 /DNDEBUG
and a separate build directory.
Form coverage moved gfx1013 from 142 to 144 of 1,968 forms. gfx1030 moved
from 138 to 140 of 1,863.
The local pixel_aot_check.py binary check could not run because the
downloaded out/llvm-check/ucrt64/bin/llvm-mc.exe exits with
Permission denied before processing its options. An LLVM 23 disassembler
check accepted both instruction encodings, but the full LLVM assembler/object
copy round trip remains for CI or a host where llvm-mc is executable.
Evidence and follow-up
All fixtures are source-written synthetic assembly and constants under the
repository's MIT license. The independent references were TomBox's SOP1
execution cases at 2be7211 and Leonida's scalar validation at 4eb6155d.
AI-assisted: yes.
Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T22:36:14Z.
This overlaps #680's two b64 forms. Please coordinate so both branches do not land competing copies. The current fixture uses 0x81020408/0x00010001, which does not cover #680's observed NVIDIA result when setting bit 31 must produce 0xffffffff. Please carry over a full-width integer readback for that exact input, plus an index aliased with the destination pair, and share the result on the same NVIDIA adapter if available. The boundary/SCC controls here are independently useful either way.
Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-22T22:48:29Z.
I carried the #680 case into this branch and kept the boundary and SCC controls.
(
0xFFFFFFFF/0xFFFFFFFF) at index 31 withs_bitset1_b64and a full-widthuint4readback. The expected word stays0xFFFFFFFF. This is the case thatpreviously canonicalised to
0x7fffffffon the NVIDIA driver.s44ands45, aliasing either destinationword, with a negative control for a read-after-write index.
WARP 10.0.26100.10068 and Radeon RX 9060 XT 32.0.32029.2010. No NVIDIA adapter
is available locally, so I cannot provide the same-adapter comparison.
On coordination, #680 at
33a24a03has the two b64 lowerings plus a widerstandalone fixture and a binary round trip. This branch keeps one commit and
the two forms only. I can rebase onto #680 or reduce this PR to the additional
controls once you say which implementation should be the copy of record.
Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-22T22:59:19Z.
Rebased onto
787ace7after #716 merged and re-ran both GPU suites indevelopment and Release. The fixture still passes 30 positive draws and 3
negative controls on WARP 10.0.26100.10068 and Radeon RX 9060 XT
32.0.32029.2010. CI is green on
1f22244, including both Windows builds.Imported from R0Y00/Xbox2Windows. Originally posted by rwZephyr on 2026-11-22T23:01:23Z.
Independent NVIDIA run for the requested bit-31 and aliased-index cases on
1f2224426270470068264a8ea12369bcf857a723. Windows 10 22H2 build19045.6466, MSVC19.44.35230, Windows SDK10.0.26100.0, DXC1.8.2502.11, Debug with/MTd. D3D12 debug layer unavailable on both backends.10de:2414), driver621.24(32.0.16.2124via DXGI). Passed.1414:008c), driver10.0.19041.5794. Passed.Calling
check_scalar_bitset64_drawdirectly on each adapter confirmed 30 positive draws at 4,096 pixels each and all three expected mismatches. This includes both SCC values and index aliasing through each half of the destination pair.For the exact
0xffffffff/0xffffffffinput at index 31, both result words matched0xffffffffwith SCC 0 and 1. As a separate diagnostic I set only the expected low word to0x7fffffff, then ranoffscreen_check <hardware|warp> --check-pixel-case <shader> <case>. At pixel(0, 0), channel 0 printedexpected_bits=7fffffff actual_bits=fffffffffor both SCC values on both adapters.AI-assisted. All reported tests ran locally.
Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-22T23:05:33Z.
Thanks for the independent run on exactly
1f22244. This closes the NVIDIAobservation requested in the first review. I recorded the RTX 3060 Ti and
in-box WARP results, including the
0x7fffffffdiagnostic, in the PRdescription. The commit under test is unchanged.