Skip to content

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

Done

Description

@lukaslw-lab

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 compute: prepare the compute pack on several threads (--jobs) #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.

Activity

  1. Not-Saii commented on Nov 29, 2026

    @Not-Saii
    Contributor

    @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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions