Commit Graph

252 Commits

Author SHA1 Message Date
e0343157d8 Merge pull request #1143 from Rayhan Robin 2026-11-22 02:47:54 -05:00
fcdf2b391d Merge pull request #1136 from quackottu 2026-11-22 02:47:52 -05:00
b4db783bb7 Merge pull request #1127 from Jess-Doit 2026-11-22 02:47:49 -05:00
9b524e5774 Merge pull request #1122 from whattheflop 2026-11-22 02:47:47 -05:00
9307b32b3f Merge pull request #1111 from quackottu 2026-11-22 02:47:44 -05:00
f7679b4909 Merge pull request #1104 from AlxcBTW 2026-11-22 02:47:41 -05:00
1bc8459361 Merge pull request #930 from BACONMANXDGOD 2026-11-22 02:47:39 -05:00
059e6afd86 BUILD: use canonical game path prefix in carve_all.ps1 2026-11-22 01:34:55 -06:00
1979b944f5 rdna2spirv: d16 image_load reads integer images through their uint/sint views
A d16 image_load skipped the T# FORMAT branch the 32-bit load uses and
always read the float sampled view, which integer images are never bound
to, so a min16uint/min16int Load returned garbage (sint texel 14774 for
129 on an RTX 5070). d16 loads now go through image_load_typed and pack the
dmask components two per VGPR: f16 from the float view, the 16-bit integer
(truncated) from the uint/sint views.
2026-11-22 12:57:13 +05:30
a0a6d2f07c Translator: --texel-offset-fallback for image_sample*_o without VK_KHR_maintenance8
A run-time texel Offset outside gather needs VK_KHR_maintenance8, which NVIDIA
Pascal lacks, so ps_texoff skips there and 4 PS (31 image_sample_o) can't run.
With --texel-offset-fallback the offset is folded into the coordinate:
coordinate + offset / size of the sampled level (0 for _lz/_c_lz, the LOD for
_l, OpImageQueryLod's for implicit samples, plus the bias for _b; floored and
clamped). An integer offset commutes with wrapping and clamping, so this is
exact at that level for every address mode; only a trilinear blend differs
(the coarser level moves by offset / 2). Implicit samples become Grad samples
with the unshifted coordinate's derivatives, so the LOD doesn't change with a
per-pixel offset. Gathers keep their Offset (shaderImageGatherExtended).

- LEONIDA_TEXOFF_FALLBACK=1 for build.py, check.py and run_gpu_tests.py;
  vk_texture_test then isn't asked for maintenance8, and texoff_problem also
  judges the +16/-32 sample.
- runtime/test/shaders/ps_texoff_implicit.asm: ps_texoff's per-pixel sample
  as image_sample_o, the corpus form.
- tests/test_texel_offsets.py: the fallback for every sample form, including
  spirv-val without --allow-offset-texture-operand.
- docs/design.md "Texel offsets", docs/testing.md.

GTX 1060: ps_texoff and ps_texoff_implicit 4096/4096 exact (SKIP before).
Corpus: the 4 PS translate and validate; needs_maintenance8 4 -> 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SSJXX67xeoorUsLJ2f9zms
2026-11-21 23:18:38 -08:00
43b5b3ecc0 Use literal paths in meta_to_xml.ps1 2026-11-22 17:14:28 +10:00
2b7621997a Merge remote-tracking branch 'origin/main' into oob-select-v2
# Conflicts:
#	tests/semantic/regen_fixtures.py
2026-11-22 08:11:31 +01:00
c774f25f09 rdna2spirv: barrier rounds for wave32 compute shaders whose s_barrier isn't in uniform control flow (SHADER-91)
On RDNA every s_barrier counts against the same workgroup barrier and a wave that has ended no longer counts;
SPIR-V needs every OpControlBarrier reached by the whole workgroup in uniform control flow. A native wave32
compute shader whose s_barrier sits anywhere but a top-level block of the structured tree now runs in rounds,
the emulated wave64 loop without its cross-lane part: s_barrier ends a segment, each invocation runs until its
next s_barrier or the end, and the workgroup meets at one OpControlBarrier at the end of the round. A per-round
count of the invocations not done (three Workgroup words) ends the loop. Native wave64 cs and ms are unchanged.

Intel Arrow Lake Xe-LPG iGPU (32.0.101.8132): cs_barrier_divergent and the new cs_barrier_early_end and
cs_barrier_loop lose the device with the plain translation and pass with barrier rounds; all three pass on an
RTX 5070 Ti (617.42) either way. docs/design.md's Workgroup barriers row describes it.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:09:17 -06:00
70ed36c765 Merge pull request #1100 from quackottu 2026-11-22 02:09:06 -05:00
16608f2a53 Merge pull request #1064 from SHAURYASANYAL3 2026-11-22 02:08:57 -05:00
2a0de113b3 Merge pull request #988 from jdotcollins 2026-11-22 02:08:53 -05:00
9543f5d305 carve_all.ps1: -LiteralPath everywhere, so a folder with [ ] in its name works
-Game was resolved with -LiteralPath, but Get-ChildItem, Test-Path,
Get-Content and Set-Content then took it as a wildcard path. A game folder
like 'GTA VI [1.0.2.1]' matched no archives and the script exited 0 without
writing coverage.json; an -Out folder with brackets broke the index.json
skip.
2026-11-22 12:38:16 +05:30
662752cc57 run_gpu_tests: bary, gradient and WQM checks fail a NaN or short frame
abs(nan - want) > tol is False, so an all-NaN frame counted as exact, and
none of the three counted pixels, so an empty .raw passed. check.py rejects
both; these now do too, as check_pixel_const already counts pixels.
2026-11-22 12:25:11 +05:30
d1a7bb96d2 check.py: request 32 lanes for the wave32 lane-mask dumps, as run_gpu_tests.py does (#774)
check.py ran cs_wqm_w32, cs_w32_lane_wrap, cs_w32_permute and cs_bpermute32
without VKC_SUBGROUP_SIZE, so on a device whose range is 8..32 (Intel ANV) the
driver could pick a narrower size and the two runners judged different words.
check.py now requests 32 for them; run_gpu_tests.py requests it even without
index.json.

vk_compute_test prints whether a VKC_SUBGROUP_SIZE request is honoured
("compute subgroup size: N" or "... N not available"), and both runners skip
these dumps when 32 can't be pinned instead of reporting wrong words. Output
from an older vk_compute_test is judged as before.
2026-11-21 23:53:02 -07:00
16e7591419 runtime: thunk deduplication, XGameRuntime shims, PE loader long paths, and drive-root packaging 2026-11-22 12:19:06 +05:30
14887e6828 Translator: honour V# OOB_SELECT in MUBUF/MTBUF bounds checks
buffer_address() picked the bounds check from the stride alone and never read
word3. It now reads OOB_SELECT (bits 29:28) and applies the rule measured
natively on RDNA2 (gfx1036, docs/buffer_bounds.md; Mesa's GFX11 column): a
dword is out of range in mode 0 at idx >= NR or off + 4 > stride, mode 1 at
idx >= NR, mode 2 at NR == 0, mode 3 (RAW) at offs + 4 > NR, where off is
inst_offset + vaddr and offs adds soffset. A literal word3 folds the mode, a
run-time one selects with OpSelect.

Builds on the raw tail rule of #443 (per-dword loads): x2..x4 loads AND stores
are per dword in modes 0 and 3 (a store that straddled the edge used to write
past it), modes 1 and 2 take the whole access, a typed element
(buffer_load/store_format) is all or nothing at its format's size, an atomic
checks its dword's end. Measured on a Radeon 880M (gfx1150), a valid proxy for
RDNA2: 504 buffer_load_dword cases over idxen/offen/inst_offset/soffset at the
stride and record edges agree with the rules, plus the x2/x4, typed and atomic
edges.

Swizzle (V# word1 bit 31 SWIZZLE_ENABLE, word3 bit 23 ADD_TID_ENABLE; Mesa
gfx10-rsrc.json lines 326 and 337): a literal V# with either is Unsupported in
every mode; a run-time one is translated unswizzled (documented known gap).

A V# with word3 = 0 is mode 0 / stride 0 and so always out of range, as on
hardware: the harness output V# (vk_compute_test, interpreter push constants),
cs_bounds, cs_fmt_1010102, cs_store, mem_diff and the format tests now say
OOB_SELECT 3 (or 1 with a stride) explicitly.

Tests: tests/semantic/test_buffer_oob_select.py (33 hand-tabulated cases plus
multi-dword stores, typed elements and the swizzle gate, literal and run-time
V#), GPU tests cs_oob_select.asm and cs_oob_tail.asm (the second tells the end
check from Mesa's GFX10 start check). docs/design.md, Buffer bounds checking,
has the per-mode rule; docs/buffer_bounds.md notes the translator reads it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 07:40:20 +01:00
dd6f55634b Merge pull request #1041 from sanuk369 2026-11-22 01:38:00 -05:00
d1d23d842d Merge pull request #804 from Jess-Doit 2026-11-22 01:37:54 -05:00
4030a386fb Translator: --bary-fallback for raw barycentrics without VK_KHR_fragment_shader_barycentric (SHADER-98)
The 321 pixel shaders that read the raw barycentric pair are translated to
BuiltIn BaryCoordKHR, so they can't run on a device without the extension
(NVIDIA Pascal, for one). With --bary-fallback the pair comes from an
ordinary vec3 input one location past the shader's attributes; the module
needs neither the capability nor the extension, and the index records the
location as bary_fallback_input. tools/bary_fallback_gs.py writes the
pass-through geometry shader that fills it: Position and the PS's inputs
copied unchanged, plus (1,0,0), (0,1,0), (0,0,1) at the three vertices,
whose perspective interpolation is the BaryCoordKHR value.

- LEONIDA_BARY_FALLBACK=1 for build.py, check.py and run_gpu_tests.py
  (like LEONIDA_W64_EMULATE): translate with the flag, build
  <name>.bary_gs.spv, draw those shaders through it.
- vk_harness: VKH_GS_HELPER=1 keeps VKH_SUBGROUP_SIZE on the fragment
  stage when the GS only feeds the pixel shader under test.
- tests/semantic/test_bary_fallback.py and the ps_bary fixture.
- docs/design.md contract row and index key, docs/testing.md section.

GTX 1060 (Pascal): ps_bary 4096/4096 exact, ps_uniform_branch and
ps_scc_mask32 pass with the fallback (SKIP without it). Pixel-shader corpus:
12,101/12,101 translate and pass spirv-val with and without the flag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SSJXX67xeoorUsLJ2f9zms
2026-11-21 22:28:25 -08:00
3d15db456b Merge pull request #1017 from Vonsek 2026-11-22 01:08:23 -05:00
94aaa2b799 Merge pull request #1011 from nicolas 2026-11-22 01:08:20 -05:00
926b03eb22 Merge pull request #1003 from bobcatchris 2026-11-22 01:08:17 -05:00
63bb76f079 Merge pull request #820 from kapitche 2026-11-22 01:08:06 -05:00
66c07cc858 carve_all.ps1: archive names from the resolved -Game, so a relative or trailing-backslash path works
The archive name was FullName.Substring($Game.Length + 1), which assumes
-Game is absolute and has no trailing separator. With -Game .\game (what
tab completion gives) or game, the name kept part of the absolute path;
with a trailing backslash it lost its first letter ("carving ommon.rpf").
Either way every existing carve was missed and everything was carved
again into misnamed folders, and coverage.json named the wrong archives.

-Game is now resolved, and names are cut after it plus one separator.
tests/test_carve_all_paths.py runs the three forms against two carves
that are already there.
2026-11-22 11:37:41 +05:30
87d7bf7c43 Translator: SMEM alignment, s_buffer_load NUM_RECORDS bound, signed s_load imm, raw MUBUF per-dword tail
What was wrong (tools/rdna2spirv.py):
- s_load* / s_buffer_load* added base + soffset + imm unaligned; hardware truncates each of the three to a
  multiple of 4 before adding them.
- s_buffer_load* had no bound at all and read past NUM_RECORDS.
- s_load* zero-extended a negative immediate from 32 bits (soffset 8 + imm -4 read ptr + 4 GiB + 4).
- raw buffer_load_dword* checked only the start (offset < num_records), so a dword at NR-1..NR-3 and the tail
  of a multi-dword load returned data where hardware returns 0.

Hardware evidence: AMD Radeon RX 6800 (gfx1030, driver 32.0.21045.29003), raw compute kernels, wave32 and
wave64, 155 runs, every result 0 or the stored data, wave32 = wave64 in every dword. Decisive rows:
s_buffer_load imm 0x10 with NR 18 -> 0; imm 0x13 with NR 21 -> data@0x10; soffset 0xe + imm 2 with NR 16 ->
data@0xc; x4 at 0xc with NR 21 -> data, data, 0, 0; stride 4 with NR 5: 0x10 data, 0x14 0; stride 1 with NR 17:
0x10 -> 0; base & 3 = 1 with imm 3 -> data@0. s_load soffset 8 + imm -4 -> @4, soffset 0xb + imm -1 -> @4.
buffer_load_dword at 0xf with NR 18 -> 0; x4 at 3 with NR 18 -> d0..d2 data, d3 0.

Now: off = (soff & ~3) + (imm & ~3), dword i at (base & ~3) + off + 4i. s_buffer_load dword i is 0 and not
loaded (its own selection construct + OpPhi) when off + 4i + 4 > limit, limit = NR * stride or NR (stride 0).
s_load: imm sign-extended from 21 bits, 64-bit sum, no bound. Raw (stride 0, no idxen) buffer_load: dword i
loaded iff O + 4i + 4 <= NR. Structured, idxen, stores, atomics and format loads keep their old first-byte
check (not measured).

Inferred, not measured: s_load with soffset + imm < 0 (64-bit signed sum), s_buffer_load x16 and buffer_load
x3 (same rule), an s_buffer_load immediate with bit 20 set or negative. OOB_SELECT (V# word3[29:28]) changes
vector-load results on hardware (2 probes) and is recorded in docs/design.md, not modelled.

Tests: tests/semantic SmemHardwareRuleTests (evaluator follows branches/phis), RawBufferTailBounds and
MeasuredBoundsShaders assert values and the exact addresses read; 19 fail with main's translator. New GPU
tests cs_smem_bounds, cs_smem_stride_align, cs_smem_sload_neg, cs_buf_tail (expected words derived by hand
from the model) in check.py and scripts/run_gpu_tests.py. test_heap_base_is_added_once now gives its V# a
NUM_RECORDS (it had 0, which the measured bound turns into a load of nothing).

Tested on AMD Radeon RX 6800 / Windows / driver 26.11.2 (Vulkan), on main d937b7f: run_gpu_tests 62/62 passed;
check.py 56 of 56; unittest tests/semantic 460 OK; pytest 1796 passed, 7 skipped, 1 xfailed. The three new tests
that are safe to run with main's translator fail with it on the GPU; cs_smem_sload_neg was not run with it (it
would read 4 GiB past the heap). Indexed (idxen) buffer loads keep their single selection construct.

AI-assisted.

Rebased onto main 8df277f: since 2e8101b the semantic mini interpreter raises on a PhysicalStorageBuffer access that
is not 4-byte aligned, so RawBufferTailBounds rows that load at an unaligned O now set base_low so that base + O is
aligned (the bound sees only O, so the measured O / NR pairs are kept); the base & 3 = 3 row uses offset 5 as a
stand-in for the measured offset 3. Byte-exact data at an unaligned address is no longer asserted there.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 22:49:26 -07:00
773891bdff fix: pack D16 explicit-LOD gather results
Route both four-tap gather paths through the existing binary16 conversion so explicit LOD and offsets keep the two-word result and the following register intact.
2026-11-22 06:48:05 +01:00
502462e1c7 rdna2spirv: set constant EXEC lane bits with shift and mask, not OpBitFieldUExtract
Intel's Windows driver (UHD 770 / Xe-LP, 32.0.101.6129) evaluates OpBitFieldUExtract
of a constant that fits in 16 bits with the offset taken mod 16, so s_mov_b32
exec_lo, 0xffff ran all 32 lanes and lanes 16-31 copied the EXEC bits of lanes 0-15.
That is what broke cs_w32_permute case C and lds_fuzz w32 programs 24 and 26 there.

(K >> lane) & 1 gives the same bit on every driver. cs_exec_const.asm checks four
constant masks, three of them 16-bit, in both GPU runners.
2026-11-22 00:46:32 -05:00
f966fc159b Tests: cover the Wine test runner, and stop it crashing on bad input
scripts/run_wine_tests.py is what runtime.yml's wine job runs, and it was the
only script in the tree with no test. tests/test_run_wine_tests.py drives it
with the Python interpreter as the "wine" command and tiny exit-code scripts
as build artifacts, so every status and exit code is checked without Wine.

That exposed three real defects, fixed here: a --tests file that is not JSON
(and JSON that is not ctest --show-only=json-v1 output) ended in a
JSONDecodeError/AttributeError before any test ran; a wine command that cannot
be started ended in FileNotFoundError out of subprocess.run, losing every
result; and WILL_FAIL/ctest booleans were read with Python truthiness, so the
JSON string "0" inverted the check. --timeout now refuses 0 and negatives,
which previously raised ValueError inside subprocess.run.

Negative control on main: 1 failure and 17 errors. With the change: 24/24.
Standard library only, no Wine, no game data.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-21 23:36:48 -06:00
07402f3828 Merge pull request #973 from Vonsek 2026-11-22 00:33:21 -05:00
81647000cc Merge pull request #950 from Bushyon 2026-11-22 00:33:14 -05:00
738870a92b Merge pull request #793 from DANISBR1 2026-11-22 00:32:53 -05:00
acbb574bca Fail a GPU test filter that selects only inputs 2026-11-21 22:30:27 -07:00
5826a60187 fix: apply sampler LOD bounds to emulated gathers
Explicit-LOD gathers use four texel fetches that bypass the Vulkan sampler. Decode its 4.8 LOD bounds before selecting the mip so clamped gathers agree with a sampler-backed draw.
2026-11-22 06:25:26 +01:00
1293cc2656 Translator: hardware NaN rules for float min/max/med3, v_fract below 1.0
Measured on an AMD Radeon RX 6800 (gfx1030) with the hw-oracle tool from the
AnyPS5 project, all four IEEE/DX10_CLAMP combinations, wave32 and wave64:

- v_min/v_max f32/f16, each half of v_pk_min/max_f16, and v_min3/v_max3 now
  emit NMin/NMax (one NaN operand gives the other) instead of FMin/FMax.
- v_med3_f32/_f16: FClamp(z, NMin(x,y), NMax(x,y)), and with OpIsNan of each
  operand that can be a NaN, select NMin(NMin(x,y), z) (hardware: min3 when
  any operand is NaN). Non-NaN constants get no check; no select when none.
- v_fract_f32: Fract, then 1.0 -> 0x3f7fffff by compare and select (the NaN
  of fract(+-inf) is kept). v_fract_f16: the same, then a packed 0x3c00 ->
  0x3bff (not after an output multiplier).

Other FMin/FMax/FClamp uses (clamp bit, LOD and conversion clamps) are
unchanged. GPU fixtures ps_fnan_med3 and ps_fnan_fract read their inputs
from memory; on the RX 6800 the two med3 words differed before this change.
tests/semantic/test_float_nan_fract.py runs the measured rows; both
interpreters gain NMin/NMax, and spirv_mini_interp OpIsNan and exact Fract.

tests/semantic/test_alu_med3.py (merged after this branch was cut): its float
reference used Python min/max, which return the first argument for equal
zeros. Hardware orders -0 below +0 (RX 6800: med3(-0, +0, 1.0) = +0,
med3(+0, -0, -1.0) = -0 in every operand order), so the reference now sorts
with that order, and spirv_mini_interp's FMin/FMax/FClamp order zeros the same
way as its NMin/NMax.

Rebased onto 8df277f. Two upstream tests were written against the old
behaviour and are updated: tests/semantic/test_valu_f32_min3_max3_mad.py
(its min3/max3 reference used first-operand order for mixed zeros, and its
negative control replaced FMin/FMax; now -0 < +0, as measured on the RX 6800,
and the control swaps NMin/NMax) and tests/semantic/test_valu_f16_round.py
(it asserted that the interpreter rejects Fract; it now asserts the value).
Upstream had added an OpIsNan/OpIsInf branch to spirv_mini_interp, so this
commit's own OpIsNan branch is dropped (it shadowed upstream's). docs/design.md
notes that an output modifier on v_fract_f16 is applied before narrowing to
f16, an order not measured on hardware.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 22:25:05 -07:00
f61720d877 Translator: s_cmp of a lane mask with -1 compares the real mask word
In a partial wave, lanes that were never launched don't vote but their
bits are 0 in the mask, so the vote called vcc_hi = 0xff "all ones".
Keep the vote for 0 only; -1 goes through wave_mask(). GPU tests for a
40-thread wave64 and a 20-thread wave32.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:04:46 -03:00
e13c9ceb77 Merge pull request #870 from nicolas 2026-11-21 23:15:38 -05:00
524bb1fb7b Merge pull request #862 from sanuk369 2026-11-21 23:15:35 -05:00
d627754795 Merge pull request #849 from stayjuced 2026-11-21 23:15:33 -05:00
0e191881e2 Merge pull request #846 from Ayoze Torres 2026-11-21 23:15:32 -05:00
b7e24a0869 run_gpu_tests: run cs_wavemask once and report it once
The cs_wavemask branch kept two older inline copies of the test next to the wavemask_check() call that
replaced them (merge leftovers): vk_compute_test ran three times and the result was appended twice, so
every run reported cs_wavemask twice (seen in a #166 report: RX 5700 XT on Windows, "83/94" for 90
tests). The branch is now the wavemask_check() call alone, with w64_emulated() for LEONIDA_W64_EMULATE
(it also accepts the trailing space cmd.exe leaves).

New test: run_suite with a fake translator and vk_compute_test runs cs_wavemask once and prints one row
(fails before: 3 runs).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 22:09:09 -06:00
9e9138829a CI: run the Wine job on WineHQ stable as well as Ubuntu's Wine
A matrix entry installs winehq-stable from WineHQ's repository next to
Ubuntu's Wine 9.0, closer to what Proton users run. The job summary
names the Wine version (run_wine_tests.py --label).
2026-11-22 03:55:52 +00:00
f674a125d9 CI: pe_loader_bounds off the default EXE base; host-tool tests skip under Wine
test_pe_loader_bounds maps images at 0x140000000 like loader_test, so it
links with GTA6RT_HOST_BASE too (under Wine every case was rejected with
"preferred base is taken").

run_wine_tests.py: a test whose command is a tool of the Windows runner
(gameinput's cmake -P, d3d12_trace's python) is reported as skipped with
that reason instead of failing as missing from the artifact.
2026-11-22 03:55:50 +00:00
8987269414 Report available shader statistics across drivers 2026-11-21 20:55:26 -07:00
0c84bff89a GPU tests: a device with too few push constant bytes skips the texture tests
vk_texture_test returned 1 instead of the unsupported code 77 when
maxPushConstantsSize is below the 144 bytes it needs (only --two-mip got 77),
and run_gpu_tests.py treated any non-zero exit of the bindless texture tests and
ps_gather_wrap as a failure. On a 128-byte device that reported 8 FAILs instead
of SKIPs. Both now skip with the device's own reason; check.py already mapped 77
to a skip.
2026-11-22 09:25:03 +05:30
ddb1faf9b7 Reject llvm-mc install paths inside the cleanup directory 2026-11-21 22:50:24 -05:00