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

Merged
lukaslw-lab merged 1 commit from upstream-pr/3539 into main 2026-11-30 09:55:34 +00:00
lukaslw-lab commented 2026-11-30 02:35:09 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-30T02:35:09Z.


Change

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

  • 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: #3521 runs this install at launch. Our #3472 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. #3521 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 #3521).

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

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5557950195 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3539). Originally posted by [lukaslw-lab](https://github.com/lukaslw-lab) on 2026-11-30T02:35:09Z. --- ## Change `compile_dxil --index-graphics-interfaces DIR CACHE [--jobs N]` (1–64, default 1) indexes the reviewed containers on N threads. Fixes #3534. - 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: #3521 runs this install at launch. Our #3472 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. #3521 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 #3521). ## 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)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!3539
No description provided.