Skip to content

cuda aot: refuse a captured spec whose launch PDL disagrees with its PDL constant (#2715) - #2899

Open
ashhart wants to merge 3 commits into
mainfrom
lead/dsv41-pdl-check
Open

ashhart wants to merge 3 commits into
mainfrom
lead/dsv41-pdl-check

Conversation

@ashhart

@ashhart ashhart commented Nov 11, 2026

Copy link
Copy Markdown
Owner

What this changes

DeepSeek-V4.1 compiles its Triton kernels with PDL=false as a compile-time constant (zig/src/families/deepseek_v41/block_attn.zig, block_prefill_attn.zig), but the launch attribute comes from the captured spec's own pdl field (zig/src/cuda/aot.zig, triton_capture.zig). Nothing checked that the two agree. A PDL=false variant launched with programmatic serialization could start before the kernel ahead of it finishes.

Both captured loaders now check every spec before any cubin is opened or module loaded (zig/src/cuda/aot_pdl.zig):

  • a spec whose launch pdl disagrees with its PDL constexpr is refused by kernel name (error.PdlMismatch);
  • a spec with no PDL constexpr may only launch without PDL;
  • a malformed or non-integer PDL fails closed.

Matching specs load and launch exactly as before. No kernel, variant choice, launch geometry or arithmetic changes, and the check runs at load, not per token. The DeepSeek replay loader now keeps a spec's constants instead of dropping them.

Tests

  • zig/src/cuda/aot_pdl_test.zig: both disagreement directions, a bad spec after good ones (refused before any module loads), missing and non-integer PDL, both agreeing values, and legacy manifests with no pdl.
  • zig/src/families/deepseek_v41/load_test.zig: the same through the DeepSeek loader with the fake driver, checking launch configs and balanced module ownership.
  • Both disagreement directions fail on main with the tests alone (the load reaches FileNotFound, and parse and replay accept the bad spec).

Host: 25/25 steps, 959/961 tests (2 skipped). Linux cross-compile of the tool and server: 14/14. Lean 386 to 386.

Not yet checked on a GPU: loading DeepSeek-V4.1, Flash Next and Nemotron with their shipped captures, to confirm none of them carries a disagreeing spec. This will be done on GB10 before landing.

Refs #2715.

@ashhart
ashhart force-pushed the lead/dsv41-pdl-check branch from 2e33126 to 7d02826 Compare November 23, 2026 19:02

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant