compile_dxil: index the graphics interface catalog on several threads (--jobs) #3541

Manually merged
github merged 1 commit from github-bot/gh-3539 into gh-pr/3539/base 2026-11-30 10:00:13 +00:00 AGit
Owner

@⁠lukaslw-lab on GitHub · 2026-11-30 02:35 UTC · original
lukaslw-lab:tooling/parallel-interface-index → main · +66 −25 · 4 files · 1 commits · merged 2026-11-30 09:55 UTC

Change

compile_dxil --index-graphics-interfaces DIR CACHE [--jobs N] (1–64, default 1) indexes the reviewed containers on N threads. Fixes #3536.

  • Workers take files from a sorted list, then read, parse and publish each container (src/direct_compute_cache.cpp, index_graphics_interfaces).
  • Keys are merged afterwards in file order, so the catalog and its index are byte-identical for any N. The ambiguous-key rule does not depend on order.
  • The first failure in file order still fails the install, and no new index is written.
  • Without --jobs, the behaviour and output are unchanged. Other callers keep jobs = 1.

Related: #3523 runs this install at launch. Our #3474 adds --jobs to the compute pack in the same files, in other functions.

Verification

Commit a8a7b031 on Windows 10 22H2 (build 19045), Visual Studio 2026 18.12 (MSVC 19.52), Windows SDK 10.0.26100, CMake 4.3.1, Python 3.13.7.

ctest --test-dir out/build/release --no-tests=error -R '^(native_graphics_interface_library|native_compile_dxil_watch)$'
100% tests passed, 0 tests failed out of 2
ctest --test-dir out/build/dev --no-tests=error -R '^(native_graphics_interface_library|native_compile_dxil_watch)$'
100% tests passed, 0 tests failed out of 2

native_graphics_interface_library now installs its synthetic library once on one thread and once with --jobs 3, and compares the two interfaces/library trees byte for byte. That library includes the ambiguous embedded ID. The test also checks that --jobs 0 is refused and that a broken container still fails with --jobs 3.

Mutations, each applied alone, all caught by that test: errors from workers ignored; workers skipping every other file.

Timing on a local corpus of 23,619 vertex, pixel and mesh containers (from tools/extract_shaders.py), 8 logical CPUs, same code before the rebase onto d88f784b:

--jobs empty cache same cache again
1 261 s 140 s
4 62 s —
8 63 s 66 s

The 1-job and 8-job catalogs are identical (same catalog, same .index name, 23,014 files each).

Evidence and follow-up

  • Memory: workers keep only each file's id and keys, not the container. That is the same key set the one-thread map held. The merge is order-independent by construction, so no test can catch a merge in completion order, and none is needed. Duplicate containers (about 600 in the corpus) may publish the same .stage path concurrently, which publish() already handles.
  • Beyond 4 jobs this host gains nothing. The limit is probably file I/O, not tested further.
  • Docs: no page on main describes the install yet. #3523 adds one, and --jobs can go there once both have landed.
  • Not covered: skipping the install when the catalog is already current (launcher side, raised on #3523).

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted: prepared with Claude Code; the commands and results above were run on the author's PC.

🤖 Generated with Claude Code

**@⁠lukaslw-lab** on GitHub · 2026-11-30 02:35 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3539) `lukaslw-lab:tooling/parallel-interface-index` → `main` · +66 −25 · 4 files · 1 commits · merged 2026-11-30 09:55 UTC ## Change `compile_dxil --index-graphics-interfaces DIR CACHE [--jobs N]` (1–64, default 1) indexes the reviewed containers on N threads. Fixes #3536. - Workers take files from a sorted list, then read, parse and publish each container (`src/direct_compute_cache.cpp`, `index_graphics_interfaces`). - Keys are merged afterwards in file order, so the catalog and its index are byte-identical for any N. The ambiguous-key rule does not depend on order. - The first failure in file order still fails the install, and no new index is written. - Without `--jobs`, the behaviour and output are unchanged. Other callers keep `jobs = 1`. Related: #3523 runs this install at launch. Our #3474 adds `--jobs` to the compute pack in the same files, in other functions. ## Verification Commit `a8a7b031` on Windows 10 22H2 (build 19045), Visual Studio 2026 18.12 (MSVC 19.52), Windows SDK 10.0.26100, CMake 4.3.1, Python 3.13.7. ctest --test-dir out/build/release --no-tests=error -R '^(native_graphics_interface_library|native_compile_dxil_watch)$' 100% tests passed, 0 tests failed out of 2 ctest --test-dir out/build/dev --no-tests=error -R '^(native_graphics_interface_library|native_compile_dxil_watch)$' 100% tests passed, 0 tests failed out of 2 `native_graphics_interface_library` now installs its synthetic library once on one thread and once with `--jobs 3`, and compares the two `interfaces/library` trees byte for byte. That library includes the ambiguous embedded ID. The test also checks that `--jobs 0` is refused and that a broken container still fails with `--jobs 3`. Mutations, each applied alone, all caught by that test: errors from workers ignored; workers skipping every other file. Timing on a local corpus of 23,619 vertex, pixel and mesh containers (from `tools/extract_shaders.py`), 8 logical CPUs, same code before the rebase onto `d88f784b`: | `--jobs` | empty cache | same cache again | |---|---|---| | 1 | 261 s | 140 s | | 4 | 62 s | — | | 8 | 63 s | 66 s | The 1-job and 8-job catalogs are identical (same `catalog`, same `.index` name, 23,014 files each). ## Evidence and follow-up - Memory: workers keep only each file's id and keys, not the container. That is the same key set the one-thread map held. The merge is order-independent by construction, so no test can catch a merge in completion order, and none is needed. Duplicate containers (about 600 in the corpus) may publish the same `.stage` path concurrently, which `publish()` already handles. - Beyond 4 jobs this host gains nothing. The limit is probably file I/O, not tested further. - Docs: no page on `main` describes the install yet. #3523 adds one, and `--jobs` can go there once both have landed. - Not covered: skipping the install when the catalog is already current (launcher side, raised on #3523). ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [ ] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. _AI-assisted: prepared with Claude Code; the commands and results above were run on the author's PC._ 🤖 Generated with [Claude Code](https://claude.com/claude-code)
--index-graphics-interfaces DIR CACHE [--jobs N] (1-64, default 1). Workers
read, parse and publish the containers; their keys are merged afterwards in
sorted file order, so the catalog is byte-identical for any N. The first
failure in file order still fails the install before a new index is written.

Refs #3534

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 02:40:09 +00:00
github-bot force-pushed github-bot/gh-3539 from a8a7b031f7 to 81711d0004 2026-11-30 09:42:02 +00:00 Compare
github-bot changed target branch from main to gh-pr/3539/base 2026-11-30 10:00:11 +00:00
github manually merged commit 81711d0004 into gh-pr/3539/base 2026-11-30 10:00:12 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.