Commit Graph

692 Commits

Author SHA1 Message Date
cce1757c2a Merge pull request #2029 from Youssef Rahmouni
# Conflicts:
#	docs/design.md
2026-11-22 10:40:36 -05:00
741ae3ed43 Merge pull request #2028 from Bora Sevim
# Conflicts:
#	docs/design.md
2026-11-22 10:40:35 -05:00
8b11bc8166 Merge pull request #2026 from Vonsek 2026-11-22 10:40:32 -05:00
40b1290e2a Merge pull request #2025 from undeadhuman37 2026-11-22 10:40:31 -05:00
b75c154b0a Merge pull request #2000 from SweatierKey
# Conflicts:
#	docs/design.md
2026-11-22 10:40:19 -05:00
92800c634f Merge pull request #1993 from Ayinaki
# Conflicts:
#	docs/design.md
2026-11-22 10:40:13 -05:00
41caa0bbae Merge pull request #1975 from tboris
# Conflicts:
#	docs/design.md
2026-11-22 10:40:03 -05:00
71ec5de3ef Merge pull request #1974 from Luiz Neves
# Conflicts:
#	docs/design.md
2026-11-22 10:40:01 -05:00
0d06dec75b Merge pull request #1969 from Youssef Rahmouni
# Conflicts:
#	docs/design.md
2026-11-22 10:39:57 -05:00
cc71595325 Merge pull request #1968 from SweatierKey
# Conflicts:
#	docs/design.md
2026-11-22 10:39:55 -05:00
213276d8ef Merge pull request #1967 from fearkov
# Conflicts:
#	docs/design.md
2026-11-22 10:39:53 -05:00
8af79aaf65 Merge pull request #1962 from abilliontokens 2026-11-22 10:39:50 -05:00
4e477e98ab Merge pull request #1959 from SHAFAY04
# Conflicts:
#	docs/design.md
2026-11-22 10:39:49 -05:00
989b133143 Merge pull request #1954 from Luiz Neves
# Conflicts:
#	docs/design.md
2026-11-22 10:39:44 -05:00
16cea91e30 Merge pull request #1948 from Luiz Neves 2026-11-22 10:39:40 -05:00
14fc271bd2 Merge pull request #1941 from Vonsek
# Conflicts:
#	docs/design.md
2026-11-22 10:39:37 -05:00
8b50505220 Merge pull request #1931 from Vonsek 2026-11-22 10:39:31 -05:00
e89156dc85 Merge pull request #1922 from YaBulochka 2026-11-22 10:39:28 -05:00
a5e776f72f Merge pull request #1913 from Jan Trencansky 2026-11-22 10:39:24 -05:00
95f60f970e Merge pull request #1904 from edwin042331-hue 2026-11-22 10:39:18 -05:00
507dfe884d Merge pull request #1903 from Luiz Neves
# Conflicts:
#	docs/design.md
2026-11-22 10:39:17 -05:00
3b5ac8f1c1 Merge pull request #1900 from Tim Elery 2026-11-22 10:39:15 -05:00
911ed91fae Merge pull request #1893 from liang-kai-shui
# Conflicts:
#	docs/design.md
2026-11-22 10:39:13 -05:00
de8278f673 Merge pull request #1882 from Tomgamer 2026-11-22 10:39:08 -05:00
607c668dbf Merge pull request #1871 from Vonsek
# Conflicts:
#	docs/design.md
2026-11-22 10:39:04 -05:00
33625dba3c Merge pull request #1808 from Taffyyy-ops 2026-11-22 10:38:56 -05:00
fd936d2d35 Merge pull request #1792 from Luiz Neves 2026-11-22 10:38:53 -05:00
e403590204 Merge pull request #718 from fearkov 2026-11-22 10:38:40 -05:00
81e520c327 Merge pull request #409 from JustDown 2026-11-22 10:38:36 -05:00
cb4a761dd9 docs/design: mark the EXEC and 64-bit scalar bitwise rows hardware-verified 2026-11-22 18:36:40 +03:00
d8a66eebaf rdna2spirv: avoid undefined FClamp on NaN in v_med3_f32 / v_med3_f16 2026-11-22 16:36:17 +01: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
be94645977 Translator: border address modes in the image_gather4_l emulation (SHADER-348)
Since #1567 made the game's S# words literals, 16 corpus gathers with
CLAMP mode 6 (clamp border) failed as Unsupported. Modes 6 and 7 (mirror
once border) now give a tap outside [0, n-1] the S# border colour's
channel (BORDER_COLOR_TYPE, word 3 [31:30]: transparent black, opaque
black, opaque white), for literal and run-time S#s; a table border
colour stays Unsupported on a literal S#, and half-border modes 4 and 5
keep their old handling. GPU test ps_gather_border, translator tests and
the contract row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:35:23 +03:00
eb35aed2e7 Merge origin/main into shader-309-wave64-lds-limit
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 16:32:05 +01:00
b378fd38e0 docs(design): the f16 transcendentals ignore FP_ROUND, measured
The Known approximations row still said v_cos_f16, v_exp_f16 and
v_log_f16 were unmeasured, although the f16 transcendentals row from
#1310 (FUZZ-29) records that the f16 field of FP_ROUND is ignored by
all seven transcendentals. Cite that row instead; the translator
already treats them the same, so no code change.

main currently carries this row three times after the merge round, so
the sentence is fixed in each copy.
2026-11-22 23:30:54 +08:00
cc283495e6 rdna2spirv: check every printed encoding against its blob, not only re-anchored listings
A listing is LLVM's text for the instruction it decoded, not the bytes it
read. translate() compared the two only for listings with undecodable words
(the re-anchoring path); a clean listing was translated from the text alone,
so a field the disassembler drops would be translated as 0 without a word.
llvm-mc's gfx1013 decoder does drop the VOP3 op_sel bits (14:11) of 16-bit
VOPC compares and re-encodes them as 0.

check_printed_encodings() runs for every other listing whose header names
its code range and whose fssm/ or fspx/ blob holds that range: each
instruction's printed encoding must be the bytes at its offset, with
same_encoding's exceptions, or the shader is Unsupported. Hand-written
listings, run_gpu_tests.py's synthetic listings and the tests' header-only
blobs are not checked.

On the 1.0.2.1 corpus the 25,030 clean listings hold 30,335,381
instructions and none differs (754 fall under same_encoding's exceptions);
the 166 16-bit VOPC compares have op_sel clear.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 16:28:18 +01:00
a044f4e78b docs/tests: fix measured baseline depth figure for 2,000 diamonds (2,000, not 4,000) 2026-11-22 11:27:20 -04:00
ba24377527 int_hw_probe: verify packed u16/i16, min3/max3/med3_16, v_swaprel_b32 and v_pack_b32_f16 abs on RDNA2 2026-11-22 16:26:59 +01:00
bda17759e4 rdna2spirv: VCCTuple scalar lists, src_scc, and image_atomic a16 (FSPX) 2026-11-22 16:26:36 +01:00
3e38c98377 rdna2spirv: bound structured nesting depth with the dispatch-loop form
spirv-val's structured-control-flow checking cost grows roughly with the cube
of the nesting depth: over the 1.0.2.1 corpus the deepest block sits 118
constructs deep and about 85% of validation time is in modules nested 20 or
deeper. cfg_structure.depth() measures the tree and a module deeper than
MAX_STRUCTURED_DEPTH (16) is emitted in the existing flat dispatch-loop form
instead, which emits the same blocks and only changes the routing. Depth
5-12 shows no gain, hence the bound at 16.
2026-11-22 15:23:55 +00:00
4eb6155d3a int_hw_probe: the five gfx1035 divergences are fixed; docs index and four tools follow the repo rules
- int_hw_probe: VOP3 clamp on the carry-out add/sub ops (#1831) and v_cvt_rpi/flr's exact floor(x+0.5) and NaN
  sign saturation (#1856) now translate as gfx1035 measured, so KNOWN_DIVERGENCES is empty. The known-divergence
  test reports a synthetic entry. shader_validation.md says so, and design.md loses the stale duplicate
  v_cvt_flr/rpi row a "both" merge left that still called them open.
- docs/README.md: one Other languages line (fr, pt-BR, zh-CN, pl-PL, tr, ru, ja); docs/i18n/README.md: one row
  each for pt-BR and zh-CN (the newer).
- anim_rigs, d16_format_probe, pe_shader_containers: text writes name newline="\n" (#1615);
  pe_shader_containers guards stdout (#1428).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 10:22:53 -05:00
6763596e5d rdna2spirv: v_add_nc_i16 and v_sub_nc_i16
Both were rejected while v_add_nc_u16 / v_sub_nc_u16 are translated.
They take the same 16-bit path (op_sel source and destination halves, the
other half kept); without clamp they are bit-identical to the u16 forms,
and clamp saturates the exact signed result to [-32768, 32767].

tests/semantic/test_valu_add_sub_nc_i16.py covers a value grid with and
without clamp, op_sel and equality with the u16 forms. docs/design.md
row added.
2026-11-22 12:20:07 -03:00
e438e37ec5 docs/design: the v_mac_f32 and conversion-modifier row is GPU-checked on an RTX 2060 SUPER (TEST-298)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SAjLH1HkG4JP6WaEQFA8yX
2026-11-22 15:20:04 +00:00
759a90c42e SHADER-309: refuse an RSRC2 LDS allocation over the cap
translate() clips the LDS array to 16,384 dwords, so a native compute
shader whose RSRC2 LDS_SIZE allocates more than 64 KiB passed the cap
check with a cut array (review on #1882). The check now counts the LDS
at max(array, RSRC2 allocation) and refuses it. A need that comes only
from a constant ds offset keeps the clipped array: the +4-dword slack
makes an in-range b32 at offset 65,524 compute as 65,540 B, and a real
offset past 64 KiB is out of range on hardware.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 16:18:23 +01:00
427c137677 rdna2spirv: buffer_load_{u,s}{byte,short}, GFX10_FORMAT_8_UINT, global_atomic_fmin/fmax 2026-11-22 16:17:57 +01:00
6be2031fe5 Docs: the 64-bit exchange rows say a split exchange can tear 2026-11-22 11:16:15 -04:00
ccda91c495 rdna2spirv: ds_mskor_b32 and ds_mskor_rtn_b32
M = (M & ~DATA) | DATA2, the _rtn_ form returning the old M. Emitted as
an atomic AND with ~DATA (its result is the old M, exactly) and an atomic
OR with DATA2; the memory is exact unless another lane's op on the same
dword lands between the two.

tests/semantic/test_lds_mskor.py runs them in the interpreter.
docs/design.md row added.
2026-11-22 12:15:27 -03:00
4e7bd89e92 rdna2spirv: coherent image accesses (glc) read and write Coherent storage views
- On GFX10 a device-scope load is `glc dlc` and a device-scope store `glc` (Mesa ac_get_hw_cache_flags sets
  exactly these bits for ACCESS_COHERENT). The 10 POPS pixel shaders read-modify-write their ordered images that
  way, but a glc image_load was translated as a read of the sampled array (no coherent form in SPIR-V) and no
  storage view was Coherent, so under the fragment-shader interlock a read could miss the previous fragment's store.
- A glc image_load now reads the storage view the stores write (OpImageRead, StorageImageReadWithoutFormat, class
  picked from the T# FORMAT as for stores); a shader with a glc image load or store decorates its storage views
  Coherent. Every other image_load keeps SHADER-151's sampled path (byte-identical output).
- glc on a sampled read (image_sample*, image_gather*, image_load_mip) or on a dimension without storage views is
  Unsupported instead of silently non-coherent; dlc alone (CU scope) stays non-coherent.
- tests/semantic/test_image_coherent.py (real translator; 7 of 10 fail on the old one) and a docs/design.md row.
2026-11-22 07:12:57 -08:00
d87d9459e6 test_buffer_format_narrow_int: measured d16 stores (review: d16 SINT path untested)
buffer_store_format_d16_xyzw into every narrow UINT/SINT format, read back
from gfx1036 (wave32 and wave64 alike): a SINT half is sign-extended before
the clamp. Dropping the signed d16 source for sint now fails 10 rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 16:12:10 +01:00
a47953b1de scalar_load: a constant SGPR offset is added as the run-time path adds it (no 32-bit wrap)
#1686 folded a known SGPR offset into the immediate before the 32-bit
truncation (s_buffer_load) or the 21-bit sign extension (s_load), so
s12 = -4 with offset:20 read byte 16 instead of being out of range, and an
s_load sOFF of 2^20 or more turned negative. Hardware does not wrap
(@Pierre-Kookis, gfx1036); the run-time path adds zext(sOFF & ~3) to the
normalised immediate in 64 bits. The fold now does the same. Found and
GPU-reproduced by @Impre-visible.

tests/semantic/test_smem_const_offset.py runs each case with the offset
as a constant and through v_readfirstlane, against the measured rule.
docs/design.md: the row says it (and a duplicated copy of the row goes).
2026-11-22 12:11:16 -03:00