Commit Graph

186 Commits

Author SHA1 Message Date
d11e39bb39 Merge pull request #599 from LuanFreitas 2026-11-21 20:38:54 -05:00
2452a5b89a Merge pull request #575 from IAmNotSiob 2026-11-21 20:38:53 -05:00
baa6beed3a SHADER-86: match RX 6700 typed buffer decode (repeat, OpFDiv, DST_SEL 1)
Missing channels use c mod n, UNORM/SNORM divide by (2^n-1), and DST_SEL 1 is integer 1 for UINT formats.
2026-11-21 22:23:21 -03:00
b3688332f2 Merge origin/main into fuzz-3-f32-valu (regen_fixtures.py: keep ps_f32_mods and ps_f64_mods)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:22:45 +01:00
6f4bd2a9bb Merge remote-tracking branch 'origin/main' into shader-55-56
# Conflicts:
#	docs/design.md
#	tests/spirv_interp.py
#	tools/rdna2spirv.py
2026-11-22 02:22:31 +01:00
8521b0b465 Merge origin/main into fuzz-3-f32-valu
spirv_mini_interp.py: keep main's _F32 (sNaN bits, #533) and its vector-aware
RoundEven/Floor/Ceil/Trunc; keep this branch's fma_f32, OpFDiv and
Exp2/Log2/Sqrt/InverseSqrt. regen_fixtures.py: both sides' shaders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:21:00 +01:00
16a9d64e1f Merge pull request #577 from NRXM 2026-11-21 20:09:25 -05:00
d73829f87b Merge pull request #568 from Ritolino 2026-11-21 20:09:24 -05:00
b5cc84cac2 Merge pull request #559 from Ritolino 2026-11-21 20:09:22 -05:00
e4212556c3 Merge pull request #553 from NRXM 2026-11-21 20:09:20 -05:00
298a69da7e Merge pull request #551 from eIBart0 2026-11-21 20:09:19 -05:00
81f0bab87c Merge pull request #549 from NRXM 2026-11-21 20:09:19 -05:00
c555b4c2bd Merge pull request #512 from SuarezPM 2026-11-21 20:09:17 -05:00
2720df12a1 Merge origin/main into f64-output-modifiers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	runtime/test/shaders/check.py
#	scripts/run_gpu_tests.py
#	tests/semantic/regen_fixtures.py
2026-11-22 02:07:19 +01:00
b6eda1e60c Translator: flush f16 denormals in the quantized interpolant path
AI-assisted. Addresses IAmNotSiob's review on #512 (he is taking the
arithmetic sites under SHADER-56/#513; f16_roundtrip stays here).

SPIR-V's OpQuantizeToF16 returns +0/-0 when the magnitude is too small for a
normal f16, and it pins no rounding mode. The docstring, the design row and the
test's rule text now say "round to nearest, f16 denormals flushed to signed
zero" and warn against reusing the helper where denormals or a rounding mode
matter.

The mini-interpreter used struct.pack('<e'), which keeps f16 subnormals: it was
more precise than any conforming driver, so a test could pass here and fail on a
GPU. It now flushes after float_to_half, and the test's independent oracle does
the same. A new case pins 1e-6 -> +0.0 and -1e-6 -> -0.0 through a translated
flagged shader (PS input 1e-6 is an f16 subnormal, 6.1e-5 is the smallest
normal); without the interpreter flush that test is red.

Existing 1.1 -> 1.099609375 pin and the opcode pin are unchanged.
2026-11-21 22:04:36 -03:00
7463b94180 Merge remote-tracking branch 'origin/main' into salu-sext-flbit 2026-11-21 22:02:52 -03:00
320531ec67 Merge remote-tracking branch 'origin/main' into valu-add-nc-clamp
# Conflicts:
#	docs/design.md
2026-11-21 22:02:29 -03:00
829ba98078 Merge remote-tracking branch 'origin/main' into valu-lerp-u8 2026-11-21 22:01:59 -03:00
a4996c7ab4 Merge origin/main into f64-output-modifiers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:55:11 +01:00
5c8cc4fade Part 3: f16 FMAs round once, to f16 (SHADER-55)
v_fma_f16, v_fmac_f16 and v_pk_fma_f16 used GLSL Fma (rounded to f32) and then narrowed, a double rounding;
an RX 6700 matches a correctly rounded f16 FMA in 12,612/12,612 cases (#374). fma_f16_odd: exact f32 product,
TwoSum, round-to-odd at f32, then f16_bits. Design row for f16 rounding.
2026-11-22 01:53:21 +01:00
8b5ef5f62a Part 2: narrow f16 ALU results with integer ops, not PackHalf2x16 (SHADER-56, #513)
Drivers fold PackHalf2x16 -> UnpackHalf2x16 to a no-op, so a following f16 op saw the unrounded f32 (#513:
v_pk_add_f16 -> v_pk_mul_f16 1 ulp off under --wave64-emulate on NVIDIA; v_cvt_pkrtz_f16_f32 rounding to
nearest on llvmpipe). Gen.f16_bits converts with integer ops (RTE, or RTZ with +-65504 for pkrtz) and is used
by f16_out, v_cvt_f16_f32, v_pk_*_f16, f16 sin/cos, v_interp_p2_f16, v_fma_mix* and f16_rtz.
tests/spirv_interp.py gains OpU{Less,Greater}ThanEqual and OpFUnordNotEqual.
2026-11-22 01:53:21 +01:00
3dee137e53 Merge pull request #546 from Luiz Neves 2026-11-21 19:53:12 -05:00
e4375b49dc Merge pull request #544 from Luiz Neves 2026-11-21 19:53:12 -05:00
b3c2623554 Merge pull request #541 from SirAmong 2026-11-21 19:53:11 -05:00
014e6e05ca Merge pull request #533 from bbareth 2026-11-21 19:53:10 -05:00
25fea32be6 Merge pull request #529 from Jaws 2026-11-21 19:53:09 -05:00
97fda697a6 Merge pull request #515 from VictorJulianiR 2026-11-21 19:53:06 -05:00
887d10e2b3 Merge pull request #514 from Diego Casares 2026-11-21 19:53:06 -05:00
55de32c87e Merge pull request #512 from SuarezPM 2026-11-21 19:53:06 -05:00
93d16099f3 Translator: v_lerp_u8
v_lerp_u8 raised Unsupported. Per byte it gives (S0.b + S1.b + bit 0 of
S2.b) >> 1, the unsigned average rounded by S2 (RDNA ISA pseudocode). clamp
is rejected, not guessed.

tests/semantic/test_alu_lerp_u8.py checks it against a plain-Python
reference.
2026-11-21 21:52:45 -03:00
e26f484501 test(semantic): value and SCC tests for 32-bit scalar inverted logic ops 2026-11-22 01:49:46 +01:00
9a2db9245d test(semantic): value tests for v_cvt_f32_i32, v_cvt_f32_u32, v_cvt_f32_ubyte0..3 2026-11-22 01:47:01 +01:00
3f70816217 Translator: v_add_nc_i32 / v_sub_nc_i32, and integer clamp on the _nc adds
v_add_nc_i32 and v_sub_nc_i32 raised Unsupported. The VOP3 clamp bit on
v_add_nc_u32 / v_sub_nc_u32 / v_subrev_nc_u32 was silently ignored, so a
saturating add came out wrapped. On GFX9+ an integer add/sub with clamp
saturates (LLVM selects uaddsat/usubsat and saddsat/ssubsat to these ops):
unsigned to [0, 0xFFFFFFFF], signed to [INT_MIN, INT_MAX].

tests/semantic/test_alu_add_nc_clamp.py checks all five ops with and without
clamp against a plain-Python reference; docs/design.md gets a contract row.
2026-11-21 21:44:11 -03:00
02f255b646 Merge pull request #507 from Diego Casares 2026-11-21 19:43:50 -05:00
a039a18588 Merge pull request #506 from Diego Casares 2026-11-21 19:43:50 -05:00
4b436a48a8 Merge pull request #496 from Tomgamer 2026-11-21 19:43:46 -05:00
a1d76845ee Merge pull request #454 from Luiz Neves 2026-11-21 19:43:40 -05:00
a7d325b6e6 Merge pull request #392 from Luiz Neves 2026-11-21 19:43:26 -05:00
bcd38863f5 Merge pull request #268 from shelbykb2 2026-11-21 19:43:16 -05:00
e0d18483e8 Translator: s_sext_i32_i8, s_sext_i32_i16, s_flbit_i32
All three raised Unsupported. s_sext_i32_i8/i16 sign-extend the low byte /
half (OpBitFieldSExtract); s_flbit_i32 is the scalar form of v_ffbh_i32 and
shares its code. None writes SCC.

tests/semantic/test_salu_sext_flbit.py checks all three against a
plain-Python reference, with SCC kept from 0 and 1.
2026-11-21 21:42:38 -03:00
726570a67c Translator: v_mad_u64_u32 and v_mad_i64_i32
Both raised Unsupported. {sdst, D} = S0 * S1 + S2 as a 65-bit result (RDNA ISA
pseudocode): a 32 x 32 -> 64-bit product, unsigned or signed, plus the 64-bit
S2, built from OpUMulExtended/OpSMulExtended and an OpIAddCarry chain. sdst
gets bit 64 as a lane mask: the carry out for u64, the sign of the exact sum
for i64. clamp is rejected.

tests/semantic/test_alu_mad64.py checks D and the sdst bit against a
plain-Python reference, a null sdst, an inline accumulator, and the carry
feeding v_add_co_ci_u32; docs/design.md gets a contract row.
2026-11-21 21:41:24 -03:00
8ad2ed54ad rdna2spirv: pack v_pk_*_f16 and f16_out with integer IEEE-754 RTE (SHADER-70)
Closes #513
2026-11-22 00:41:06 +00:00
7a86a2e814 Translator: v_sad_u8, v_sad_hi_u8, v_sad_u16, v_sad_u32, v_msad_u8
All five raised Unsupported. They add the sum of absolute differences of the
sources' bytes / halves / words to S2 (unsigned, wrapping at 32 bits), as in
the RDNA ISA pseudocode; v_sad_hi_u8 shifts the byte sum left by 16 and
v_msad_u8 skips the bytes where S1's byte is 0. clamp is rejected, not
guessed.

tests/semantic/test_alu_sad.py checks all five against a plain-Python
reference. test_translate.py and test_f16_op_sel.py used v_sad_u8 as their
example of an unsupported instruction; they now use v_mqsad_u32_u8.
2026-11-21 21:36:31 -03:00
737735aecb Translator: v_movrelsd_2_b32 with separate M0 source/destination fields
VGPR[D + M0[25:16]] = VGPR[S0 + M0[9:0]] (RDNA2 ISA VOP1 opcode 72; same
fields in the RDNA3 ISA). It raised Unsupported before (noted in #496).

- tools/rdna2spirv.py: masks M0 per side on the existing movrel path.
- tests/semantic/test_alu_movrelsd_2.py: 7 hand-computed cases through the
  translator and the interpreter, including ignored M0 bits set, the _e32
  spelling and a check that it differs from v_movrelsd_b32.
- runtime/test/shaders/cs_movrelsd_2.asm: GPU test (wave32 dump) with the
  ISA's own example; registered in check.py and run_gpu_tests.py.
- docs/design.md: contract row for the v_movrel* forms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 19:34:25 -05:00
3fe9203fc6 tests/semantic: OpBitcast keeps signalling-NaN bits in the mini interpreter (TEST-67)
bits_f32/f32_bits went through struct's binary32 <-> double conversion,
which quiets a signalling NaN (sets bit 22). Any word in
0x7f800001..0x7fbfffff or 0xff800001..0xffbfffff that passed through a
float (an OpBitcast round trip, or an integer exported through a float
output) came back changed, although OpBitcast is bit-exact in SPIR-V.
About 0.4% of random words hit it, so seeded tests failed by chance:
test_alu_shift_b64's v_ashrrev_i64 case and test_mem_diff's s_load
family both fail on main.

A float made by OpBitcast is now a float subclass that keeps its exact
pattern; copies, composites, selects, variables and outputs pass it on,
and arithmetic returns a plain float, which drops it (SPIR-V leaves NaN
result bits open). Tests cover four sNaN words through every pass-through
path, OpIsNan/OpFOrdEqual on one, and that arithmetic still gives a NaN.

Fixes #509.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:31:20 +01:00
bc7c389be9 Translator: quantize 16-bit interpolant reads with OpQuantizeToF16
AI-assisted. Follow-up to merged #274, per Vonsek RTX 5080 review on it.
Pack/Unpack round-trip is folded to a no-op (expected 0x3f802000, observed 0x3f801800, not f16); emit one OpQuantizeToF16, teach mini-interp, pin value and opcode in tests.
2026-11-21 21:26:12 -03:00
fb8343e74a Merge origin/main into test-movrel-values
tests/semantic/README.md: keep all three new bullets, and drop the conflict markers that
main itself carries from the #421 merge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:25:57 +01:00
f9fb9f02a8 Translator: load mid-dword buffer_load_format elements from every dword they span
need used to be ceil(size/4) and only the first dword was shifted, so a
4-byte format at byte 3 (or an 8-byte format at byte 6) took its tail
from dword 0. Load ceil((byte_shift + size) / 4) dwords and shift the
whole window so the packed stream starts at the element. Found by the
FUZZ-5 fuzzer; left open in #234.
2026-11-21 16:25:42 -08:00
d999bb9709 Merge pull request #421 from shelbykb2
# Conflicts:
#	tests/semantic/README.md
#	tests/test_shader_checks.py
2026-11-21 19:19:04 -05:00
c3541916cf test(semantic): add value tests for cube-map VALU ops 2026-11-22 01:18:12 +01:00