Commit Graph

90 Commits

Author SHA1 Message Date
3d4c111c2c Merge pull request #3552 from DanielDeGiorgio
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:07:47 -05:00
db9af91597 Merge pull request #3304 from Matheus Gomes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:07:12 -05:00
fe34d2b0e8 Merge pull request #3290 from Tomgamer
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	docs/design.md
2026-11-22 23:07:11 -05:00
ccb572e33e Merge round-43 sampled indexing fix into storage indexing follow-up 2026-11-23 13:44:31 +10:00
dad0da40a1 Merge round-43 main into sampled descriptor indexing fix 2026-11-23 13:43:27 +10:00
be8570ace1 Merge remote-tracking branch 'origin/main' into triage-r43
# Conflicts:
#	docs/runtime_imports.md
#	runtime/CMakeLists.txt
#	runtime/shims/xgameruntime.cpp
#	runtime/test/xmem_test.cpp
#	tools/rdna2spirv.py
2026-11-22 22:12:50 -05:00
921a959b72 Merge upstream main into pipeline checker input protection
Keep both the filesystem header for identity checks and the upstream type traits for the large-module budget. Preserve the input checks and CLI coverage.

AI-assisted (Codex).
2026-11-22 22:14:33 -03:00
1c604af1a0 vk_pipeline_check: large modules share a memory budget instead of compiling alone
Modules over --large-module-bytes compiled one at a time with every other thread waiting. On the translated
corpus that is 695 modules (the ray-tracing compute shaders, ~14k RDNA2 instructions each, ~4.9 MB of SPIR-V),
about 12 s and 2 GB each on RADV GFX1201, so the pipelines stage spent hours mostly single-threaded.

large_module_gate.h lets large modules in while 512 bytes per SPIR-V byte fits 3/4 of the memory available at
start (Linux: MemAvailable and the cgroup v2 memory.max room up the tree; Windows: ullAvailPhys), one always
admitted when none is in, small modules never held back. Unknown memory keeps the old exclusive gate, as does
--large-parallel 1. malloc_trim(0) after each large module returns what glibc kept in per-thread arenas.

40 modules (27 large), Mesa shader cache off, RX 9070 XT / Mesa 25.3.6: 297 s -> 83 s on 6 threads (7.1 -> 8.3 GB
peak), 56 s on 12 threads (15.1 GB).

Tested: large_module_gate_test (Linux, and the clang-cl build under Proton), ctest on Linux (40 passed, 2
skipped), vk_pipeline_check over 40 real modules in three modes, and the pipelines stage over the corpus with the
gate: 26,000+ of 26,503 modules in 15 min, none failed. The largest module (26 MB of SPIR-V) was still compiling
alone on RADV after 25 min, as it would under the old gate. AI-assisted.
2026-11-23 00:30:02 +00:00
d62694e8ce Merge remote-tracking branch 'origin/main' into pr3290-merge-main
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:48:47 +01:00
ec9a5780b6 Merge refreshed sampled indexing into storage indexing follow-up 2026-11-23 08:06:17 +10:00
f56396ce21 Merge upstream pipeline checker updates 2026-11-22 23:02:46 +01:00
e34b0c7b78 Merge current upstream main into sampled descriptor indexing fix 2026-11-23 08:01:46 +10:00
42e20d695a Merge pull request #367 from mrb-eel 2026-11-22 16:56:52 -05:00
967d1870f5 BUILD-1035: Support pipeline crash isolation on Windows 2026-11-22 21:53:07 +01:00
58226b459c Seed runtime Vulkan pipeline cache from offline builds 2026-11-22 21:24:02 +01:00
5d09434c08 Merge pull request #3234 from Matheus Gomes 2026-11-22 15:16:03 -05:00
272ff05ffa Merge pull request #3163 from Matheus Gomes 2026-11-22 15:15:19 -05:00
782c09c117 Merge origin/main into shader-597-f64-float-controls
Conflict in docs/design.md only: main updated the "Floating-point class
compare" row next to the float-controls rows. Kept main's row, the
SHADER-99 row's pointer to f64 and the SHADER-597 row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 21:14:23 +01:00
d0b036f078 Merge pull request #3040 from whoalin1 2026-11-22 15:14:17 -05:00
92d53a0cd6 Merge pull request #2927 from bobcatchris 2026-11-22 15:13:16 -05:00
f5ec088201 Merge pull request #2817 from IAmNotSiob 2026-11-22 15:12:17 -05:00
ee0d2c5117 Merge refreshed sampled indexing into storage indexing follow-up 2026-11-23 06:09:15 +10:00
c901fda139 Merge upstream main into sampled descriptor indexing fix 2026-11-23 06:06:06 +10:00
00c01a198f fix(runtime): protect pipeline checker inputs from output aliases
Reject cache, stats and snapshot paths that point to the shader index or skip list before opening them. Check file identity so case differences and filesystem links cannot hide an alias.
2026-11-22 17:01:53 -03:00
ef2798d79e Translator: declare SignedZeroInfNanPreserve 64 in f64 modules (SHADER-597)
Modules that declare Float64 now also get
OpExecutionMode %main SignedZeroInfNanPreserve 64, so -0, NaN and inf in
native f64 ops no longer rest on driver defaults. Same gating as the
32-bit mode from #664: the index entry lists
shaderSignedZeroInfNanPreserveFloat64 next to Float32, vk_pipeline_check
skips the shader where that property is false, and --no-float-controls
leaves both modes out. Modules without Float64 are unchanged.

Found by @Jolymmiles (issue #3047).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:46:01 +01:00
76e66debcf fix(runtime): bound pipeline checker workers to the shader slice
Keep the requested jobs count as an upper bound. Launch only as many workers as the filtered slice can use and report the resulting count.
2026-11-22 16:45:45 -03:00
3ca929037b vk_pipeline_check: parse floating-point CLI values without from_chars (BUILD-822) 2026-11-22 13:40:41 -06:00
a9dd291912 Declare dynamic storage image indexing in translated SPIR-V 2026-11-23 05:38:45 +10:00
f674ba82a1 fix(runtime): publish pipeline checker progress snapshots atomically
Stage the full in-flight report before replacing its destination, using the existing checked checkpoint writer. Preserve the last complete snapshot if staging or replacement fails.
2026-11-22 16:33:40 -03:00
e14290a4b9 Gate sampled descriptor indexing before shader module creation 2026-11-23 05:31:20 +10:00
a094bd2d53 rdna2spirv: declare DenormPreserve 16 so a driver keeps f16 denormals (SHADER-526)
ps_sdwa_f16_const read mrt0 lane y as 0x0000 instead of 0x1c00 on NVIDIA: the
_sdwa src0_sel:BYTE_1 selects the f16 denormal 0x0040 (2^-18), and the driver
flushed it on the way into f32 because the module declared no 16-bit denormal
mode. The translator models f16 arithmetic in f32 with integer narrowing, so no
f32 denormal is involved and that conversion is what the 16-bit mode governs.

Every module now also emits OpExecutionMode %main DenormPreserve 16 with the
matching capability (core since SPIR-V 1.4, so no extension), and the index
lists shaderDenormPreserveFloat16, which vk_pipeline_check requires and
--no-float-controls still drops along with the 32-bit mode.

Tested on an RTX 4070 SUPER (driver 610.88, validation layers on): the GPU test
goes from 4096/4096 mismatches to 4096/4096 pixels exact, and the full GPU suite
from 142/189 to 143/189 passed with 0 failures and the same 46 skips.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
2026-11-22 21:10:20 +02:00
fdffac4983 Declare dynamic sampled descriptor indexing in translated SPIR-V 2026-11-23 05:08:57 +10:00
9f53808e02 Merge pull request #2713 from Capital 2026-11-22 13:17:16 -05:00
8511fbad1d Merge pull request #2689 from Capital 2026-11-22 13:17:06 -05:00
4fa6c61ff9 Merge pull request #2480 from whoalin1 2026-11-22 13:15:37 -05:00
09cf8b65e3 rdna2spirv: s_memtime / s_memrealtime via OpReadClockKHR, enable VK_KHR_shader_clock 2026-11-22 19:14:59 +01:00
7f29bae81e Merge pull request #2111 from Thatters 2026-11-22 13:13:03 -05:00
51d954a2cd Merge pull request #436 from S1m0ne1997 2026-11-22 13:12:27 -05:00
86d92e13ad [BUILD-761] Validate SPIR-V file framing before creating modules 2026-11-22 18:59:19 +01:00
0cb7b7bf41 [BUILD-748] Check mesh workgroup memory before pipeline compilation 2026-11-22 18:52:11 +01:00
3917298d1b vk_pipeline_check: support --pc-tail-ubo set-1 layouts and 128-byte push-constant devices
vk_pipeline_check previously created one VkPipelineLayout with a hardcoded 144-byte push-constant range and set 0 only (without checking vkCreatePipelineLayout's result). On a 128-byte push-constant device (AMD Windows RDNA2 iGPUs, some Intel Arc drivers) that violates VUID-VkPushConstantRange-size-00298, and every --pc-tail-ubo shader declaring set 1 fails pipeline creation with VK_ERROR_UNKNOWN / VUID-VkComputePipelineCreateInfo-layout-07988.

Parse push_constant_bytes and pc_tail.bytes from index.json (with strict from_chars validation, tested in check_vk_pipeline_cli.cmake), skip shaders whose required push-constant size exceeds props.limits.maxPushConstantsSize, add set 1 (UNIFORM_BUFFER_DYNAMIC at binding 0), and create one pipeline layout per distinct (push_bytes, has_pc_tail) needed by the selected shaders within the device limit.

Claimed in #2300.

Co-Authored-By: Gemini 4 Neon <noreply@google.com>
2026-11-22 19:11:14 +02:00
97afefdebc Merge remote-tracking branch 'origin/main' into shader-33-vs-inputs
# Conflicts:
#	tests/test_shader_checks.py
2026-11-22 18:06:20 +01:00
5fdb55613d Merge pull request #2226 from SirAmong 2026-11-22 11:43:06 -05:00
e77d75dc3c vk_pipeline_check: an empty first positional argument also counts as the cache path
Review of #2111 (@matheuskshn): an explicit empty argument followed by a filename was accepted, because an empty
cache_path stood for both "not given" and "given as ''". A flag now records that the cache path was given, so a
second positional argument is always a usage error (exit 2), and the message quotes both values.

Tested: `vk_pipeline_check <dir> "" b.bin` and `<dir> a.bin b.bin` exit 2 with the message; one cache path still runs
(62/62 real compute modules, RTX 5070 Ti / 621.24) and writes the cache. No new warnings. AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:41:55 -05:00
c97e961387 Merge pull request #2111 from Thatters 2026-11-22 11:41:53 -05:00
ea00498d3f Merge pull request #664 from WHOISJARDAS 2026-11-22 11:40:30 -05:00
2a1bd0399d vk_pipeline_check: a module is in flight from vkCreateShaderModule on, tagged module or pipeline
Review of #2111 (@Pipodi): the in-flight table got its entry only just before vkCreateComputePipelines /
vkCreateGraphicsPipelines, so a thread busy in vkCreateShaderModule (or a large module there, alone behind
compile_gate) was invisible: the watchdog never named it, and --inflight-file couldn't name a module that died there.

- The entry is made once the worker holds compile_gate, before vkCreateShaderModule, with phase "module"; it becomes
  "pipeline" when the pipeline is created, and is removed on every path out of the loop (a pipeline, a skip, a failed
  module). A module over --large-module-bytes writes the file when it enters the driver, not only at its pipeline.
- --inflight-file lines are "name<TAB>phase"; make_game.py reads the name.
- The watchdog says "still creating the shader module of X" or "still compiling X".

Waiting on compile_gate is not in the table: that thread isn't in the driver.

Tested on Windows 11 Pro 25H2, MSVC 14.51 + Ninja, RTX 5070 Ti / 621.24: the crash end-to-end through
make_game.pipelines on 62 real compute modules (skipped, the other 61 checked); the in-flight file at a simulated
crash reads "<module>\tpipeline" and is empty after a clean pass (62/62). tests/test_make_game_pipelines.py writes the
tab format; all 14 test_make_game*.py files pass. No new warnings. No game data. AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:34:50 -05:00
0c45e9a569 Pipelines stage: use the new checker options only when the build has them; the checker rejects unknown options
Review of #2111 (@matheuskshn): a vk_pipeline_check built before this PR takes any argument it doesn't know as the
cache path. Run with --inflight-file F, it would write the Vulkan pipeline cache into F and exit 0; make_game.py would
then delete F and report success, with no pipeline_cache.bin. That happens with a reused runtime build or a supplied
Windows build (#2194).

- make_game.py asks the checker first: run without arguments it prints its usage before touching Vulkan, and only a
  build that lists --inflight-file and --skip-file gets them and the crash retry. An older build runs exactly as before
  (one call, a crash stops the stage), with a log line saying to rebuild the runtime stage for crash recovery.
- vk_pipeline_check: an unknown --option or a second positional argument is now a usage error (exit 2) instead of
  silently becoming the cache path, so the next new option can't be swallowed the same way.

Tested on Windows 11 Pro 25H2, MSVC 14.51 + Ninja, RTX 5070 Ti / 621.24:
- checker_supports: True for this build, False for a 6a6704df build (before this PR).
- the new checker: --no-such-option and a second cache path exit 2 with a message.
- make_game.pipelines on 62 real compute modules: with this build and a simulated crash, the module is skipped and
  the other 61 checked, as before; with the 6a6704df build, one call without the new flags, exit 0, and the cache in
  pipeline_cache.bin (6.7 MB), nothing written to pipeline_inflight.txt.
- tests/test_make_game_pipelines.py: 11 tests, 2 new (an older checker gets the old invocation and isn't retried;
  support is read from the usage line). All 14 test_make_game*.py files pass.
No game data. AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:25:07 -05:00
bcf9a8fba6 vk_pipeline_check: reject bytes after the top-level object, keep the malformed-JSON wording, check .exe path (TEST-257 review)
Review of #1847: (1) read_index returned on the closing brace without checking
that only whitespace follows, so {}garbage was accepted: now it is malformed.
(2) Malformed and empty input keep 'malformed JSON in ...' (open PR #1735's CLI
test asserts it); only a file that cannot be opened or read says 'cannot read'.
(3) The file is read with read() and its gcount checked, since
istreambuf_iterator bypasses the stream state. (4) The test's find_binary also
checks runtime/build/vk_pipeline_check.exe (single-config Windows Ninja).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-22 11:22:01 -05:00
05686f15a4 Pipelines stage: a module that takes vk_pipeline_check down is skipped and the rest is still checked
Since dcd8ecf the two #881/#884 giants pass spirv-val and are back in the corpus. On NVIDIA the larger one runs the
driver's compiler out of memory (LLVM ERROR: out of memory, exit 0x80000003), vk_pipeline_check dies with it, and the
pipelines stage stops: on @VeTkN's RTX 5070 (#884, c603b8f) about 5,750 pipelines after it were never checked or
cached, and make_game.py exited 1.

vk_pipeline_check:
- --inflight-file F keeps the names of the modules being compiled in F. It is rewritten when a module over
  --large-module-bytes starts or finishes (those compile alone, #903, so F then names exactly that module), by the 5 s
  watchdog for the others, and emptied at the end of the pass.
- --skip-file F: modules named in F are not compiled; each is reported as `MODULE CRASH <name> (<stage>, killed the
  driver in an earlier run; not retried)` and counted as a failed pipeline, as --isolate does on POSIX. --isolate
  passes it on to its children. A missing F is a usage error (exit 2).

make_game.py, pipelines stage:
- runs the checker with --inflight-file. When it exits other than 0, 1 or 2 (a crash, not Ctrl+C), the modules in
  the in-flight file are added to pipeline_crashes.txt and the checker runs again with --skip-file; what was already
  compiled comes back from pipeline_cache.bin (checkpointed every 10 minutes). If several modules were compiling, each
  is tried alone (--start/--count in the checker's name-sorted index) and only those that crash alone are skipped.
- a crash no module can be named for is not retried, nor is Ctrl+C, and there are at most 5 restarts.
- the stage still fails when anything failed, now after checking everything else, and names the modules that took
  the driver down. pipeline_crashes.txt is cleared at the start of each pipelines stage, so a module gets a fresh
  chance after a translator change.
- run() takes check=False and returns the exit code.

The --isolate child-process mode stays POSIX-only; with a multi-GB pipeline cache per child it is too heavy for the
default path. A memory cap for the checker on Windows, so the OOM doesn't take other programs down, is a follow-up.

Tested on Windows 11 Pro 25H2, MSVC 14.51 + Ninja, RTX 5070 Ti / 621.24:
- tests/test_make_game_pipelines.py: 6 new cases (a named crasher is skipped and the rest checked; several in flight
  are tried alone and only the crasher is skipped; no suspect or Ctrl+C is not retried; the retry limit; a clean run is
  one call and an old skip list is dropped). All 14 test_make_game*.py files pass.
- end to end on 62 real compute modules from my own copy's work folder (2 over 4 MiB), through make_game.pipelines:
  with VK_PIPELINE_CHECK_SIMULATE_CRASH on one large module, the first run died (exit 3), the in-flight file named
  that module, the second run checked the other 61 (all ok) and saved the cache, and the stage failed naming it.
  Without the hook: one call, 62/62, exit 0. The in-flight file is empty after a clean pass.
No game data. AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 10:58:37 -05:00