Commit Graph

153 Commits

Author SHA1 Message Date
a66a71ffd3 Merge pull request #3318 from pmilewsskiedu-gif 2026-11-22 15:16:55 -05:00
608f33552d Merge pull request #3273 from AwkGrep256 2026-11-22 15:16:23 -05:00
3f2fc71fea Merge pull request #3191 from Weslley Couto
# Conflicts:
#	docs/design.md
2026-11-22 15:15:35 -05:00
1363748aeb Merge pull request #3061 from Vonsek
# Conflicts:
#	docs/shader_validation.md
2026-11-22 15:14:29 -05:00
ea09a5934b Merge pull request #2988 from Shrey Ratna 2026-11-22 15:13:51 -05:00
bb3bbeebe0 Merge pull request #2843 from Koro4e
# Conflicts:
#	docs/d3d12_vulkan.md
2026-11-22 15:12:32 -05:00
825fc61a07 Merge pull request #2749 from jaybeebabageyus 2026-11-22 15:11:35 -05:00
c82fbe37d1 Shader: flush legacy f32 multiply operands and results in default MODE
Match RDNA2 mode-0 denormal semantics and legacy zero override; flush product before output scaling and normalize modifier zeros. Add synthetic semantic/GPU fixtures and documentation. AI-assisted (GPT-6).
2026-11-22 15:03:13 -05:00
adefa18b13 tools: ps_oracle.py runs on Linux AMD GPUs (RADV backend)
RADV returns VK_KHR_pipeline_binary data as one binary per stage
(radv_shader_serialize), not the AMD Windows driver's single PAL ELF, so
ps_oracle exited 77 on every Linux AMD GPU. Find the pixel stage, its
code, sizes, num_vgprs/num_sgprs and rsrc1 by values that must agree
(radv_shader_info's size changes between Mesa versions), replace the
code and raise the VGPR counts. GFX10 only (GFX11+ is refused with
"unsupported architecture"); --set stays PAL-only.

Checked on gfx1036 (RADV RAPHAEL_MENDOCINO, Mesa 26.3.1); an RX 9070 XT
(RADV GFX1201) is refused with exit 77.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 22:45:59 +03:00
35a33bb29d Merge remote-tracking branch 'upstream/main' into shader-340-rdna1-denorm
# Conflicts:
#	docs/design.md
2026-11-22 16:45:30 -03:00
533d5533a6 SHADER-340: measure RDNA1 mad/mac denormal flush and flush before omod 2026-11-22 16:34:15 -03:00
4c414d1216 tools: ps_oracle.py runs hand-written RDNA2 pixel-shader ISA on AMD GPUs
hw_oracle launches compute kernels only. vk_harness can now write a
pipeline's VK_KHR_pipeline_binary data and build a pipeline from it
(VKH_BINARY_OUT / VKH_BINARY_IN). ps_oracle.py puts assembled ISA in
place of _amdgpu_ps_main in the driver's PAL ELF, raises the pixel
stage's register counts in the msgpack metadata, optionally changes
other metadata entries, and draws with it, reading every pixel's mrt0
words back.

Checked on gfx1036 (driver 26.10.1): v_interp of a varying and the
parameter words P0 / P10 come back as expected. Tests in
tests/test_ps_oracle.py, docs in docs/shader_validation.md.

AI-assisted.
2026-11-22 20:15:34 +01:00
820e9bc877 image_fuzz: accept the driver's one-ulp UNORM8 conversion in the translator oracle
The translated image_load fetches a UNORM texel through a float view, so the 8-bit -> float conversion is
the driver's. RDNA2 returns the correctly rounded c / 255; llvmpipe multiplies by an f32 1/255, one ulp
above it for 126 of the 256 byte values (27: 0x3dd8d8da, not 0x3dd8d8d9). The comparison was bit exact
and a run stops at its first mismatch, so on llvmpipe every run ended at its first R8G8B8A8_UNORM case
and the other formats never ran.

The translator oracle now accepts one ulp on a UNORM8 texel component, never on another format or on the
sentinels of registers dmask leaves unwritten, and the summary counts how many components needed it.
--oracle hw stays bit exact.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:01:57 +00:00
337f714c06 docs: drop stray duplicate fma_mix result rows
Two rows were appended after the prose with no table header; the same results are already in the table above.
2026-11-22 19:28:12 +01:00
3d293c2c82 Merge pull request #2551 from nonverifiedperson
# Conflicts:
#	docs/design.md
2026-11-22 13:16:07 -05:00
1c21007cea Merge pull request #2514 from Vonsek 2026-11-22 13:15:51 -05:00
eefaba67db Merge pull request #2431 from Vonsek 2026-11-22 13:15:16 -05:00
309915ac6f Merge pull request #2421 from Bora Sevim
# Conflicts:
#	docs/design.md
2026-11-22 13:15:13 -05:00
87f5e0dbf4 Merge pull request #2410 from d7ommy
# Conflicts:
#	docs/design.md
#	docs/shader_validation.md
2026-11-22 13:15:07 -05:00
6245dd09cf Merge pull request #2371 from Vonsek 2026-11-22 13:14:19 -05:00
c4ccf4b45a Merge pull request #2336 from Vonsek 2026-11-22 13:13:58 -05:00
e64bebf1c3 tools: sad_diff.py, a differential fuzzer for the SAD family
Seven opcodes (v_sad_u8, v_sad_hi_u8, v_sad_u16, v_sad_u32, v_msad_u8,
v_qsad_pk_u16_u8, v_mqsad_pk_u16_u8) against an ISA-written reference and
the translated SPIR-V in spirv_mini_interp, four exported words, bit for
bit. A 785-program sweep covers every source-kind combination (the 64-bit
constant rule pinned both ways), random seeded programs widen the values.
12,810 programs across six seeds match with zero mismatches and zero
skips; two translator mutations make 36/60 and 17/60 programs fail.
clamp, op_sel/neg/abs, v_mqsad_u32_u8 (#1926/#2163) and null as a 64-bit
quad source (#2650) are out of scope, on purpose.
2026-11-22 19:08:55 +01:00
c15761b8cc SHADER-430: measure the v_interp ALU ops on gfx1036; p2_f16 keeps vdst's high half
tools/interp_hw_probe.py runs v_interp_* in a compute wave through tools/hw_oracle (the ops read the
attribute words from LDS at M0) and checks them against exact models: p1/p2_f32 and p1ll_f16 are single
fmas rounded to f32, p2_f16 rounds once straight to f16 (30 discriminating ties), and a 32-bit read of a
packed channel takes the raw words as f32. f32 denormal words follow MODE. All 292,474 checks match per
mode on a Radeon gfx1036 iGPU.

v_interp_p2_f16 keeps the high 16 bits of vdst on hardware; the translator zeroed them. It now writes
the low half only (write_lo16), with a semantic test that fails on the old code.

The SPI half (what a real draw writes into LDS for a packed channel) stays unverified; it needs a
pixel-shader harness.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:27:10 +01:00
94955e12c3 tools: fmisc_diff.py, a differential fuzzer for f32 misc ops and float compares
A separate exact-rational ISA model for v_fract_f32, v_frexp_mant/exp_f32, v_ldexp_f32, v_cvt_u32/i32_f32, v_cvt_off_f32_i4, v_fmamk_f32, the 16 v_cmp_*_f32 conditions and v_cmp_class_f32, with neg/abs, omod and clamp and every source kind within the constant-bus rules, compared one lane at a time with rdna2spirv run in tests/semantic/spirv_mini_interp.py, optionally with the hardware through tools/hw_oracle (run under IEEE off, f32 denormals flushed). Denormals, NaN payloads read as integers, clamp of a NaN and omod giving a zero are counted skips. v_cmp_class_f32 with neg/abs on a signalling NaN only with --known.

AI-assisted.
2026-11-22 18:19:02 +01:00
91fb9d601a tools: pk16_diff.py, a differential fuzzer for packed and 16-bit integer VALU
A separate ISA model for the v_pk_* integer ops (op_sel, op_sel_hi, clamp) and the 16-bit VOP3 integer ops (op_sel on sources and the destination half, the kept other half, clamp), with VGPR, SGPR, inline-constant and literal sources within the constant-bus rules, compared one lane at a time with rdna2spirv run in tests/semantic/spirv_mini_interp.py, optionally with the hardware through tools/hw_oracle. A constant whose high half a packed op reads (#2224) only with --known.

AI-assisted.
2026-11-22 18:01:58 +01:00
c55056ff40 rdna2spirv: v_cvt_pknorm_i16/u16_f32 round the exact product once, as RDNA2 does (SHADER-363)
The f32 OpFMul of the clamped value and 32767 (or 65535) can land exactly on k + 0.5 while the exact product is just
below or above it; RoundEven then picked the even neighbour, one off from the hardware on 28 of 28 such inputs on an
RDNA2 iGPU (gfx1036, SHADER-339). The product's error Fma(c, s, -p) is exact, so on such a tie the translator now
takes floor(p) + 1 when it is positive, floor(p) when negative, and RoundEven when it is 0. Away from a tie both
roundings agree.

tools/pknorm_probe.py --oracle hw on the same iGPU now exits 0: all 134 words equal the translator's in wave32 and
wave64 under five MODEs. tests/semantic/test_alu_cvt_pknorm_f32.py's reference rounds the exact product once and
checks the twelve measured near-tie words (they fail on the old translation); tests/test_pknorm_probe.py expects
single rounding. docs/design.md: the three copies of the pknorm row become one, with both RDNA2 measurements.
2026-11-22 19:56:45 +03:00
ef3261c4ca rdna2spirv: support and verify packed int16 constant op_sel on RDNA2 (gfx1036) 2026-11-22 19:56:19 +03:00
4b6e54b1da Merge upstream/main 2026-11-22 17:49:12 +01:00
1ec817add5 tools: vint_diff.py, a differential fuzzer for 32-bit integer VALU in every encoding and source kind
A separate ISA model for 55 integer opcodes (VOP1/VOP2 as e32 and e64, VOP3-only ops, VOPC e64 + v_cndmask) with VGPR, SGPR, inline, float-inline and literal sources within the encoding and constant-bus rules, compared one lane at a time with rdna2spirv run in tests/semantic/spirv_mini_interp.py, optionally with the hardware through tools/hw_oracle. A mask read as data (#293) only with --known.

AI-assisted.
2026-11-22 17:49:10 +01:00
72758b9c5b Merge pull request #2270 from Tim Elery
# Conflicts:
#	docs/design.md
2026-11-22 11:43:39 -05:00
a9f9a52cf3 Merge pull request #2234 from d7ommy
# Conflicts:
#	docs/design.md
2026-11-22 11:43:13 -05:00
d603c4d566 Merge pull request #2217 from RobertPattinson007
# Conflicts:
#	docs/shader_validation.md
2026-11-22 11:43:01 -05:00
cf8d5edbc9 Merge pull request #2204 from Vonsek
# Conflicts:
#	docs/design.md
2026-11-22 11:42:49 -05:00
3bf4e6e574 Merge pull request #2200 from d7ommy
# Conflicts:
#	docs/design.md
2026-11-22 11:42:44 -05:00
526fea5ebf Merge pull request #2141 from nonverifiedperson 2026-11-22 11:42:11 -05:00
b8f2567b8e Merge upstream/main 2026-11-22 17:42:09 +01:00
bbf009fda0 tools: wint_diff.py, a whole-wave differential fuzzer for integer VALU under random EXEC
Seeded integer VALU programs run on every lane of a wave32 or wave64 wave with EXEC rewritten between instructions: compares into SGPR masks and VCC, v_cmpx, v_cndmask on the masks, carry-out/carry-in forms, v_mad_u64/i64 with a mask carry-out, 16-bit op_sel half writes and 32-bit ops. A per-lane ISA model is compared with rdna2spirv run in tests/semantic/spirv_wave_interp.py, optionally with the hardware through tools/hw_oracle. Known divergences (VCC data read as a mask, #2206; a mask read as data, #293) only with --known.

AI-assisted.
2026-11-22 17:42:08 +01:00
12df1f6aa6 Merge pull request #2113 from Vonsek 2026-11-22 11:41:54 -05:00
1fa5187d76 Merge pull request #2062 from dororodev
# Conflicts:
#	docs/design.md
2026-11-22 11:41:23 -05:00
fbe50b23fd rdna2spirv: align swizzled buffer addressing with native RDNA2 hardware (SHADER-343)
Measure MUBUF/MTBUF swizzled buffer addressing (V# SWIZZLE_ENABLE,
ADD_TID_ENABLE, INDEX_STRIDE, OOB_SELECT, multi-dword and typed
accesses, atomics, 32-bit offset wrap) natively on RDNA2 (gfx1036,
wave32 and wave64) via tools/buffer_swizzle_probe.py, and fix all six
observed silicon divergences in tools/rdna2spirv.py:

- idxen=1 ignores ADD_TID_ENABLE (both address and bounds).
- SWIZZLE_ENABLE=1 with idxen=0 and ADD_TID_ENABLE=0 stays linear and
  OOB_SELECT 3 remains RAW.
- Multi-dword raw accesses step by +4*IS only in scratch-swizzle mode
  (SWIZZLE_ENABLE=1, idxen=0, ADD_TID_ENABLE=1); indexed swizzle
  (idxen=1) steps linearly by +4 bytes even across IS boundaries.
- Scratch-swizzle mode suppresses typed formats > 4 bytes (MUBUF/MTBUF)
  and 8-byte buffer_atomic_*_x2 even under OOB_SELECT 2 (formats <= 4B
  execute normally); indexed swizzle executes them linearly.
- OOB_SELECT 3 with active swizzle and stride != 0 checks
  (index + soffset) >= num_records or off + payload > stride.
- off = uint32(voff + inst_offset) wraps at 32 bits before bounds
  checking, while RAW mode 3 uint64(off) + uint64(soffset) does not.

Update semantic tests, cs_buf_swizzle fixture expectation (word 4:
0x5eed0028 -> 0x5eed000c), unit tests, and docs/design.md /
docs/shader_validation.md.
2026-11-22 08:32:34 -08:00
06f36cec6b tools/salu_diff: add integer SALU ops and gfx1036 RDNA2 follow-up to #1746 (SHADER-137) 2026-11-22 19:29:38 +03:00
3fa378b15d image_d16_probe: measure d16 integer image loads on 1D, 2D-array and 3D (SHADER-387)
A hardware-oracle probe that reads 32-bit UINT/SINT texels (one and two channels) with d16 image_load and
image_load_mip on SQ_RSRC_IMG_1D, 2D, 2D_ARRAY and 3D, and compares each result with truncation and with
unsigned/signed saturation. Native gfx1036 saturates on every dimension and form, as the translator does;
docs/design.md and docs/shader_validation.md record it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:20:14 +01:00
74e39155f1 image_query_probe: measure image_get_resinfo and image_get_lod on RDNA2 (SHADER-388)
docs/design.md left resinfo's 2D depth word, the clamped LOD under a linear
mip filter and the u/v order of the LOD query unverified. The new probe runs
both instructions natively through tools/hw_oracle on hand-built GFX10
descriptors and compares every word with written rules. On gfx1036 all 614
results (wave32 and wave64) follow them:

- resinfo's 2D depth word is 0 (any WORD4 DEPTH); a 2D array's layer count
  is minified, max(1, layers >> (BASE_LEVEL + level)); past the last level
  width, height and depth are 0.
- get_lod's raw LOD includes LOD_BIAS; the clamped LOD is the clamp under a
  linear mip filter, the level read (half up) under point, 0 with none.
- u scales by the width, v by the height.

The translator still differs on the resinfo points; design.md says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:17:13 +01:00
30b763cb26 rdna2spirv: verify and support v_pack_b32_f16 abs/neg modifiers on RDNA2 (gfx1036) 2026-11-22 19:07:39 +03:00
c362d98eeb shader_validation: first RDNA2 (gfx1036) runs of the LDS and image hardware oracles (PROC-111)
lds_fuzz --oracle hw: default and --extended, seeds 1-3, 0 mismatches; the
masked ds_swizzle_b32 reads 0 from an off source lane on RDNA2 too
(SHADER-207). image_fuzz --oracle hw: 7,200 cases on the GFX10 T# layout,
0 mismatches. Negative controls caught every wrong model.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:04:34 +01:00
5885e160e8 tools: sdwa_diff.py, a differential fuzzer for the SDWA VALU forms
A separate reference for 92 _sdwa VOP1/VOP2/VOPC opcodes (integer and f16
families: source selects, sext(), dst_sel with dst_unused PAD/SEXT/PRESERVE,
SGPR and inline-constant sources, clamp, f16 neg/abs) compared with
rdna2spirv + spirv_mini_interp on seeded one-lane programs, in the style of
salu_diff.py. --oracle hw runs the programs on an RDNA1/RDNA2 GPU; every rule
of the reference was checked on gfx1036. Forms where the translator is known
to differ are left out unless --known.

AI-assisted.
2026-11-22 16:59:29 +01:00
09c3394b0c docs: measure VOP3 output modifiers on RDNA2 (gfx1031) (SHADER-353)
tools/f32_fuzz.py --oracle hw, seeds 1 to 6, on an RX 6700 XT (gfx1031,
AMD Windows driver 26.11.2): 39,101 programs, 0 mismatch, 66 omod -0 -> +0
deviations. mul:2/mul:4/div:2 behave as measured on gfx1150: applied with
IEEE off and f32 denormals flushed (a -0 result becomes +0), ignored by the
ALU ops with denormals kept (the transcendental and cube ops still apply
them), ignored with MODE.IEEE = 1.

- docs/design.md: merge the two duplicated "Output modifiers on hardware"
  rows (one said RDNA2 was unmeasured, the other cited gfx1036) and add the
  gfx1031 numbers.
- docs/shader_validation.md: the gfx1031 run and its omod table.
- tools/f32_fuzz.py: omod_label no longer counts a -0 result that the omod
  cannot change as "applied" (65 such programs showed up as "applied" in
  the ieee column); widen the table's label column; drop "RDNA2 unmeasured".
- tests/test_f32_fuzz.py: the omod_label labels, the -0 case included.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 16:48:49 +01:00
741ae3ed43 Merge pull request #2028 from Bora Sevim
# Conflicts:
#	docs/design.md
2026-11-22 10:40:35 -05:00
4e477e98ab Merge pull request #1959 from SHAFAY04
# Conflicts:
#	docs/design.md
2026-11-22 10:39:49 -05:00
c20586fc58 pknorm_probe: v_cvt_pknorm_* give 0 for NaN on RDNA2, but round the exact product once (SHADER-339)
tools/pknorm_probe.py runs v_cvt_pknorm_i16_f32 / v_cvt_pknorm_u16_f32 through the translator on the CPU interpreter
and, with --oracle hw, natively through tools/hw_oracle in wave32 and wave64 under five MODEs. On an RDNA2 iGPU
(gfx1036) every NaN half (74 of 74: quiet, signalling, both signs, payloads, in S0 and S1) gives 0, as the translator
assumes, whatever IEEE, DX10_CLAMP and the f32 denormal mode are.

The rounding does not match: the hardware rounds the exact product x * 32767 (or 65535) once, while the translator
rounds the f32 OpFMul product and then RoundEven, one off on 28 of 28 near-tie inputs in both directions. Recorded in
docs/design.md and docs/shader_validation.md; the translator is not changed here. tests/test_pknorm_probe.py checks
four near-tie words against a hand derivation and the translator side's double rounding and NaN zero.
2026-11-22 18:35:49 +03:00