compute pack: a startup capture of 2689 compute requests exceeds the 256 MiB pack limit; 28 requests are left out #3473

Closed
opened 2026-11-29 16:27:22 +00:00 by lukaslw-lab · 1 comment
lukaslw-lab commented 2026-11-29 16:27:22 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-29T16:27:22Z.


compile_dxil --prepare-compute-pack writes one compute-<entry>.pack of at most 256 MiB. The writer stops adding records at (256 << 20) - 128 bytes (src/direct_compute_cache.cpp:410), and the reader accepts only files up to 256 MiB (lookup, :208).

Captured slot 67 requests from one 360 s startup run value
requests 2689
prepared / unsupported 941 / 1720
left out (invalid compute pack size) 28
pack 268,435,431 bytes (at the limit)
  • Measured on main cf0c30af with the parallel preparation from #3472 (--jobs 1 gives the same bytes). The same requests on an older main gave 266.7 MB with nothing left out: frontend records grow as more programs translate, so longer runs will lose more.
  • Left-out keys get no prepared record and are translated again at first dispatch. The command exits 1.
  • Proposal: split the pack into numbered parts (compute-<entry>.<n>.pack), each under the limit, and load all of them. Or raise both limits together and bump the pack version. Test: a request set over the limit must publish every record.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6681172845 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3473). Originally posted by [lukaslw-lab](https://github.com/lukaslw-lab) on 2026-11-29T16:27:22Z. --- `compile_dxil --prepare-compute-pack` writes one `compute-<entry>.pack` of at most 256 MiB. The writer stops adding records at `(256 << 20) - 128` bytes (`src/direct_compute_cache.cpp:410`), and the reader accepts only files up to 256 MiB (`lookup`, `:208`). | Captured slot 67 requests from one 360 s startup run | value | |---|---| | requests | 2689 | | prepared / unsupported | 941 / 1720 | | left out (`invalid compute pack size`) | **28** | | pack | 268,435,431 bytes (at the limit) | - Measured on `main` `cf0c30af` with the parallel preparation from #3472 (`--jobs 1` gives the same bytes). The same requests on an older `main` gave 266.7 MB with nothing left out: frontend records grow as more programs translate, so longer runs will lose more. - Left-out keys get no prepared record and are translated again at first dispatch. The command exits 1. - Proposal: split the pack into numbered parts (`compute-<entry>.<n>.pack`), each under the limit, and load all of them. Or raise both limits together and bump the pack version. Test: a request set over the limit must publish every record.
Not-Saii commented 2026-11-29 17:05:29 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Not-Saii on 2026-11-29T17:05:29Z.


@lukaslw-lab, unless you're already on this after #3472, I'd like to take it. If you are, say so and I'll leave it.

Approach: numbered parts. I'd go with your first option and not raise the limit:

  • lookup in src/direct_compute_cache.cpp reads every cache file into one buffer and enforces the 256 MiB cap for all of them. Raising it for the pack raises it everywhere.
  • A pack bigger than 256 MiB would also be read in a single ReadFile.
  • Parts keep each file under the limit that's already there.

Plan.

  1. Writer (build_compute_frontend_pack): when the next record would cross the limit, it closes the current part and starts a new one. Parts are written in the sorted request order:

    • part 0 stays compute-<entry>.pack;
    • later parts are compute-<entry>.<n>.pack;
    • part 0's header records the part count;
    • higher-numbered parts left over from an earlier, larger pack are removed.

    Only a single record over the limit still fails with invalid compute pack size.

  2. Reader (ComputeFrontendPack::load): loads every part named by the count into the one record map. It refuses the pack, like any damaged pack today, if any of these happens:

    • a part is missing or stale;
    • a key repeats across parts;
    • a part has trailing data.
  3. Version: bump pack_version, so a single-file pack from before is rebuilt instead of being misread.

  4. Tests: pass the part limit to the writer as an internal parameter, so a test can cross it with a few small source-built requests instead of 256 MiB of them.

    • A set over the limit publishes every record across parts. lookup returns the same result for each key as a pack built with no limit.

    • Negative controls:

      • delete a middle part;
      • leave a stale extra part;
      • duplicate a key across parts;
      • load an old-version pack.

      Each must be refused, or rebuilt, without a crash.

    • Revert control: with the writer change reverted, the oversized set leaves records out again.

  5. Measurement: counts only. If one of my own captures goes over the limit, I'll report prepared / unsupported / left out before and after, and the part sizes. If none does, the synthetic test is the evidence, and a rerun of your 2,689-request set would be welcome.

Environment: Windows 11 build 26300, MSVC (VS 2022, dev preset), Windows SDK 10.0.26100, Python 3.12. No GPU needed.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7259413926 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3473#issuecomment-7259413926). Originally posted by [Not-Saii](https://github.com/Not-Saii) on 2026-11-29T17:05:29Z. --- @lukaslw-lab, unless you're already on this after #3472, I'd like to take it. If you are, say so and I'll leave it. **Approach: numbered parts.** I'd go with your first option and not raise the limit: - `lookup` in `src/direct_compute_cache.cpp` reads every cache file into one buffer and enforces the 256 MiB cap for all of them. Raising it for the pack raises it everywhere. - A pack bigger than 256 MiB would also be read in a single `ReadFile`. - Parts keep each file under the limit that's already there. **Plan.** 1. **Writer** (`build_compute_frontend_pack`): when the next record would cross the limit, it closes the current part and starts a new one. Parts are written in the sorted request order: - part 0 stays `compute-<entry>.pack`; - later parts are `compute-<entry>.<n>.pack`; - part 0's header records the part count; - higher-numbered parts left over from an earlier, larger pack are removed. Only a single record over the limit still fails with `invalid compute pack size`. 2. **Reader** (`ComputeFrontendPack::load`): loads every part named by the count into the one record map. It refuses the pack, like any damaged pack today, if any of these happens: - a part is missing or stale; - a key repeats across parts; - a part has trailing data. 3. **Version:** bump `pack_version`, so a single-file pack from before is rebuilt instead of being misread. 4. **Tests:** pass the part limit to the writer as an internal parameter, so a test can cross it with a few small source-built requests instead of 256 MiB of them. - A set over the limit publishes every record across parts. `lookup` returns the same result for each key as a pack built with no limit. - Negative controls: - delete a middle part; - leave a stale extra part; - duplicate a key across parts; - load an old-version pack. Each must be refused, or rebuilt, without a crash. - Revert control: with the writer change reverted, the oversized set leaves records out again. 5. **Measurement:** counts only. If one of my own captures goes over the limit, I'll report prepared / unsupported / left out before and after, and the part sizes. If none does, the synthetic test is the evidence, and a rerun of your 2,689-request set would be welcome. Environment: Windows 11 build 26300, MSVC (VS 2022, dev preset), Windows SDK 10.0.26100, Python 3.12. No GPU needed. AI-assisted.
Sign in to join this conversation.
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#3473
No description provided.