Skip to content

Key compiled forward sharing and Inductor validation by GPU name - #597

Open
brandonmmusic-max wants to merge 2 commits into
NVIDIA:mainfrom
brandonmmusic-max:mixed-gpu-inductor-keying
Open

brandonmmusic-max wants to merge 2 commits into
NVIDIA:mainfrom
brandonmmusic-max:mixed-gpu-inductor-keying

Conversation

@brandonmmusic-max

@brandonmmusic-max brandonmmusic-max commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Why this change is proposed

Multi-GPU SM120 workstations commonly pair RTX PRO 6000 Blackwell Max-Q Workstation Edition GPUs with RTX PRO 6000 Blackwell Workstation Edition GPUs. Both cards share compute capability (12, 0) and memory capacity, but report distinct CUDA device names and can compile different Inductor Triton kernel inventories for the same logical compilation_variant.

Although ForwardCache.__init__ (ignition/preparation/aot.py) already hashes properties.name into each rank's self.root, four coordination paths on main bypassed that per-SKU separation:

  • ForwardCache._prepare_ranks keyed _variant_compilers and paths[name, variant] by compilation_variant alone and lent missing compilations across all ranks on a host regardless of GPU product name, causing different-SKU ranks to compile into or load from another SKU's self.root and fail Inductor kernel-inventory agreement.
  • ForwardCache._publication_lock locked only one publication.lock per host, leaving secondary SKU cache roots on the same host unlocked during compilation and binding.
  • _share_artifacts fetched every compiled path reported by any peer host, which on multi-host mixed-SKU runs would write foreign-SKU artifacts into unlocked cache roots.
  • allocate_workers (ignition/preparation/compile_pool.py) allocated per host without GPU SKU grouping, allowing one SKU to consume all host workers and starve a secondary active SKU group, while InductorSelections.warm (ignition/preparation/inductor_tuning.py) checked Inductor kernel-inventory equality across all ranks sharing one compilation_variant string regardless of GPU product name.

What exactly changed

  • Added cuda_device_identity(device) in ignition/preparation/inductor_tuning.py to return (product_name, compute_capability) for CUDA devices and ("", None) for non-CUDA devices.
  • Updated ForwardCache._publication_lock (ignition/preparation/aot.py) to gather (host, str(self.root.resolve())) across ranks and acquire publication.lock once per distinct (host, resolved_root) in deterministic sorted order.
  • Updated ForwardCache._prepare_ranks (ignition/preparation/aot.py) to gather (gpu_name, capability) across ranks, reject cross-architecture rank groups (ordering capabilities safely when None is present), key selections, compilers, work, lent, and paths by (compilation_variant, gpu_name) while keeping un-suffixed {name}.{compilation_variant} filenames inside each SKU's GPU-partitioned self.root, pass groups=gpu_names to allocate_workers, and restrict host-local compilation lending to matching (host, gpu_name) peers.
  • Updated _share_artifacts (ignition/preparation/aot.py) with an optional root=None parameter (passed as root=self.root at both multi-host call sites in _prepare_ranks) so each rank fetches only peer artifacts located directly inside Path(root).resolve(), preventing foreign-SKU writes into unlocked roots on multi-host mixed-SKU runs while preserving same-SKU cross-host sharing.
  • Updated allocate_workers (ignition/preparation/compile_pool.py) with an optional groups=None parameter (normalized via groups = hosts if groups is None else groups) so active (host, group) subgroups are each seeded with one worker before surplus allocation, idle/cached subgroups receive zero workers, host effective worker limits smaller than the active subgroup count raise ValueError, the 2 GiB minimum-allowance fallback applies strictly when len(active_groups) == 1, and multi-group hosts enforce the full per-worker memory estimate monotonically for every seeded worker (raising MemoryError when insufficient).
  • Updated InductorSelections.warm (ignition/preparation/inductor_tuning.py) to gather ((compilation_variant, gpu_name), inventory) and require identical Inductor kernel inventories within each (compilation_variant, gpu_name) group (relying on ForwardCache._prepare_ranks for the upstream cross-architecture gate).
  • Updated docs/model-preparation.md and docs/preparation-development.md to document per-(host, GPU product name) cache roots and locks, per-(compilation_variant, GPU product name) forward sharing and Inductor inventory agreement, same-SKU host-local lending, per-active-SKU worker admission (ValueError on low worker limits and single-active-group 2 GiB fallback), and cross-architecture rejection.
  • Added 20 CPU unit tests in tests/preparation/test_mixed_gpu_inductor_keying.py covering cuda_device_identity("cpu"), mixed-SKU keying and same-SKU lending isolation, homogeneous-to-mixed cache reuse with zero recompilation on the shared SKU, monotonic multi-SKU memory admission (12, 39, 40, 41, 42, 71 GiB raising MemoryError, 72 GiB admitting [1, 0, 1, 0], and single-active-group 10 GiB fallback), explicit ValueError when the host worker limit is below the active group count, idle-SKU worker withholding, two-host mixed-SKU _share_artifacts root isolation, multi-root _publication_lock acquisition on one host, un-suffixed homogeneous sharing, cross-architecture rejection (including None capabilities), and per-(variant, gpu_name) Inductor inventory validation.

Before this change, mixed-SKU SM120 ranks shared one paths[name, variant] entry across different-SKU self.root directories, lent compilations across SKUs, locked only one cache root per host, could starve secondary active SKU groups or fail Inductor inventory agreement, and could transfer foreign-SKU artifacts across hosts into unlocked roots. After this change, each GPU product name locks its own cache root, receives compiler workers monotonically when active, compiles and reuses un-suffixed artifacts inside its own self.root across homogeneous and mixed launches, restricts multi-host transfers to its own self.root, and validates Inductor inventories per (compilation_variant, gpu_name), while cross-architecture groups fail explicitly before compilation.

Claimed benefit or result

Enables tensor-parallel preparation (ignition export --gpus ...) on mixed-SKU same-architecture SM120 hosts while preserving homogeneous-to-mixed on-disk cache reuse, monotonic host RAM admission, multi-host cache-root isolation, and strict compute-capability invariants.

Supporting evidence and limitations

  • Standalone CPU unit tests:
    CUDA_VISIBLE_DEVICES="" pytest \
      tests/preparation/test_mixed_gpu_inductor_keying.py \
      tests/preparation/test_forward_artifact_sharing.py \
      tests/preparation/test_inductor_prepared_winners.py \
      tests/preparation/test_compile_pool.py \
      tests/preparation/test_core_boundary.py
    Result: 103 passed, 2 warnings in 33.58s (20 tests in test_mixed_gpu_inductor_keying.py, 12 in test_forward_artifact_sharing.py, 18 in test_inductor_prepared_winners.py, 49 in test_compile_pool.py, 4 in test_core_boundary.py; the 2 warnings are unrelated cutlass.utils.LayoutEnum deprecation notices in test_compile_pool.py). These tests verify mixed-SKU keying and same-SKU lending isolation, homogeneous-to-mixed un-suffixed cache reuse with zero recompilation, monotonic allocate_workers admission (MemoryError at 12/39/40/41/42/71 GiB, [1, 0, 1, 0] at 72 GiB, single-active-group 2 GiB fallback at 10 GiB), ValueError when the host worker limit is below the active SKU group count, cached-SKU worker withholding, two-host mixed-SKU _share_artifacts isolation, multi-root _publication_lock locking, cross-architecture rejection, and per-(variant, gpu_name) Inductor inventory agreement.
  • Prior combined-stack end-to-end serving checks (on the same mixed-SKU SM120 preparation stack prior to this CPU-only follow-up update):
    • Mixed-SKU TP4 export and flare run serving of DeepSeek-V4.1-Flash on a 4-GPU SM120 host pairing two RTX PRO 6000 Blackwell Max-Q Workstation Edition GPUs (300 W) with two RTX PRO 6000 Blackwell Workstation Edition GPUs (450 W), prepared with --mla-compute-mode bf16, --expert-scale-compression native, and --embedding-table-storage ram: 135 CUDA graphs per rank, 38,944 kernels across 4 ranks, 72.8 GiB / 21,058,816 KV tokens (62 s startup), cold prefill 37,671 to 43,134 tok/s from 8K to 128K tokens, sustained decode 377.4 tok/s at concurrency 1 (1,185.8 tok/s at concurrency 8), 6/6 long-context needle-retrieval exact first-token matches, 21/21 multi-turn chat and tool-calling trials passed, 5/5 chat/responses edge cases passed, 1/1 image OCR check passed, and 0 CUDA or runtime errors.
    • Mixed-SKU TP4 export and flare run serving of the gb202 Hugging Face package revision of brandonmusic/glm-5.3-flash-exl3-tr3-2.375bpw-flare on the same 4-GPU mixed-SKU SM120 host: 49,868 kernels across 4 ranks, 121 CUDA graphs per rank, 24/24 multi-turn chat and tool-calling trials passed, 0 CUDA or runtime errors.
    • Homogeneous TP2 export and flare run serving of the gb202-tp2 Hugging Face package revision of brandonmusic/glm-5.3-flash-exl3-tr3-2.375bpw-flare on two RTX PRO 6000 Blackwell Workstation Edition GPUs at 600 W: 256.9 tok/s at concurrency 1, 1,428.9 tok/s at concurrency 32, 10.38M KV token capacity, 24/24 multi-turn chat and tool-calling trials passed, 2/2 vision trials passed, 0 CUDA or runtime errors.
    • Whole-pipeline serving metrics verify integration compatibility and are not attributable solely to this PR.
  • Limitations and unrun checks: tests/preparation/test_inductor_tuning_cuda.py and live GPU preparation/re-export checks were not run during this CPU-only update pass because GPUs were held offline for this revision; an isolated main-vs-branch GPU preparation benchmark has not been collected on this revision. Mixed-SKU hardware execution was previously observed on SM120 (RTX PRO 6000 Blackwell Max-Q Workstation Edition + RTX PRO 6000 Blackwell Workstation Edition) only; cross-architecture rejection and two-host mixed-SKU _share_artifacts isolation are verified by CPU unit tests rather than a multi-host or mixed-architecture GPU cluster. Rust crate tests were not run because this PR modifies Python preparation, test, and documentation files only.

Discord: Brandonmusic

@flare-autobot

Copy link
Copy Markdown
Collaborator

A case file has been opened for 597.
Case File Intake Report

Future reviews will auto-run 90 minutes after code updates are pushed.

  • Re-review sooner: Call @flare-autobot after push.
  • Opt-out: Include #autobot:ignore in the PR or any comment.

@flare-autobot flare-autobot added area:preparation Ignition checkpoint loading, tuning, compilation, capture, and export. enhancement New feature or request performance Performance, latency, throughput, or memory-efficiency investigation or improvement. triage:review Proposed change needs code review; this does not imply merge readiness. labels Nov 29, 2026
@flare-autobot

Copy link
Copy Markdown
Collaborator

Autobot Review

Full Review · Value Proposition · Case File

Recommendation: Changes Requested

Fixes a real mixed-SKU SM120 gap (cross-SKU paths[name, variant] sharing, per-(host, root) publication locking, same-SKU lending, per-(variant, gpu_name) Inductor inventory checks) while keeping homogeneous paths clean, but introduces a verified non-monotonic memory-admission / RAM-overcommit bug in allocate_workers, an unnecessary on-disk gpu_tag suffix that breaks cache reuse, a multi-host _share_artifacts lock bypass, and stale docs with no main failure reproduction.

  • Blockers: 1 · Should fix: 4 · Subtract/Simplify: 3 · Nits: 3
Walkthrough
  • ignition/preparation/inductor_tuning.py: Adds _cuda_device_identity(device) (:21-26) returning (product_name, compute_capability) (or ("", None) for non-CUDA), and updates InductorSelections.warm (:247-260) to key inventory agreement by (compilation_variant, gpu_name) and reject cross-architecture capabilities.
  • ignition/preparation/aot.py: Updates ForwardCache._publication_lock (:774-811) to gather (host, str(self.root.resolve())) and acquire publication.lock per distinct pair in deterministic sorted order with per-key barriers; updates ForwardCache._prepare_ranks (:929-1010, 1112, 1131, 1154) to gather (gpu_name, capability), reject cross-architecture groups, suffix compilation_variant with a normalized gpu_tag when multiple GPU names appear, pass groups=gpu_names to allocate_workers, and restrict compilation lending to (host, gpu_name) peers.
  • ignition/preparation/compile_pool.py: Adds groups=None to allocate_workers (:62-128), raising ValueError if limit < len(active_groups), seeding one worker per active (host, group) subgroup (with a per-subgroup 2 GiB fallback), raising MemoryError if any active subgroup remains empty, and distributing surplus workers across active subgroups.
  • tests/preparation/test_mixed_gpu_inductor_keying.py: Adds 13 CPU-only unit tests using forked Gloo processes and monkeypatched ForwardCache / InductorSelections stubs covering mixed-SKU keying, lending isolation, worker seeding, multi-root publication locking, homogeneous un-suffixed sharing, cross-architecture rejection, and Inductor inventory mismatches.
Merge Risk: Medium · up to f8a033a
  • allocate_workers (ignition/preparation/compile_pool.py:96-118) runs on every distributed forward compilation; while homogeneous hosts (len(active_groups) == 1) preserve existing behavior, mixed-SKU hosts can concurrently overcommit host RAM (64 GiB estimated peak on 12–42 GiB available) or hit a non-monotonic MemoryError at 40–41 GiB.
  • ForwardCache._prepare_ranks (ignition/preparation/aot.py:939-944) changes on-disk artifact filenames whenever any peer in the TP group has a different GPU product name, preventing cache reuse between homogeneous and mixed runs on the same card; on multi-host mixed-SKU runs, _share_artifacts (aot.py:698-734, 1103, 1169) writes foreign-SKU artifacts into unlocked cache roots.
  • No Python CI workflow runs tests/preparation, and tests/preparation/test_inductor_tuning_cuda.py was not run against the change.
Pre-merge checks: ✅ 2 passed · ⚠️ 2 warnings
  • ✅ Security / malicious screen: No prompt injection, shell execution, credential exposure, or unsafe deserialization introduced across the 4 changed files.
  • ✅ Charter & value fit: Lives in shared ignition/preparation, targets SM120 workstation TP preparation with no new flags, env vars, or per-model branches, and tightens architecture/SKU invariants; however, evidence does not yet meet the charter's root-cause/before-after bar.
  • ⚠️ Related / duplicate / conflict check: Additive to main (no merged PR covers this layer, and main's reconcile_selections already handles the b12x tuning half from Treat Max-Q and Workstation Edition device names as one GPU when tuning #150), but overlaps open PRs Make the compiler memory headroom a preparation setting #122 (compile_pool.py, aot.py) and Add sm110/thor identifiers #592 (aot.py, compile_pool.py) and imports private helpers from tests/preparation/test_forward_artifact_sharing.py.
  • ⚠️ Tests & verification evidence: No Python CI exists; "96 passed" has no attached command/output; no main failure reproduction or isolated preparation measurement is provided; tests/preparation/test_inductor_tuning_cuda.py was not run; and the new tight-budget test only checks 40 GiB, missing the 12–39 GiB and 42 GiB overcommit bug.

Have your agent review the Full Review for complete verified findings, file:line citations, and suggested changes.

To opt out, include #autobot:ignore in your post or comment.

@brandonmmusic-max
brandonmmusic-max force-pushed the mixed-gpu-inductor-keying branch from f8a033a to 1acb1f0 Compare November 29, 2026 11:06
@brandonmmusic-max

Copy link
Copy Markdown
Contributor Author

Updated branch (1acb1f05) to address the review items:

  • ignition/preparation/compile_pool.py: Fixed the non-monotonic allocate_workers admission bug by restricting the 2 GiB minimum-allowance fallback strictly to single-active-group hosts (len(active_groups) == 1, using += 1), requiring full worker_bytes for every seeded worker when multiple SKU groups are active on a host. Collapsed the groups is None branch (groups = hosts if groups is None else groups) and removed the redundant admitted counter.
  • ignition/preparation/aot.py: Removed heterogeneous and gpu_tag filename suffixing; keyed selections, compilers, work, lent, and paths by (compilation_variant, gpu_name) while keeping un-suffixed {name}.{compilation_variant} filenames inside each SKU's self.root so homogeneous and mixed launches on the same GPU reuse cached .bin files. Added root=None filtering to _share_artifacts (passed as root=self.root at both multi-host call sites in _prepare_ranks) so multi-host mixed-SKU runs do not write foreign-SKU artifacts into unlocked cache directories.
  • ignition/preparation/inductor_tuning.py: Exposed cuda_device_identity as a public helper and removed the duplicate cross-architecture check from InductorSelections.warm (already enforced upstream in ForwardCache._prepare_ranks).
  • docs/model-preparation.md and docs/preparation-development.md: Updated forward worker admission, same-SKU host-local lending, per-(host, GPU product name) cache roots and publication.lock ordering, per-(compilation_variant, GPU product name) forward sharing and Inductor inventory agreement, ValueError on low host worker limits, and cross-architecture rejection.
  • tests/preparation/test_mixed_gpu_inductor_keying.py: Switched to per-SKU cache roots, added monotonic admission tests (12, 39, 40, 41, 42, 71 GiB raising MemoryError, 72 GiB admitting [1, 0, 1, 0], and 10 GiB single-active-group fallback), added homogeneous-to-mixed cache reuse (0 recompilations on Workstation ranks) and two-host mixed-SKU _share_artifacts root-isolation tests, and removed the duplicate warm cross-architecture test.

Verification (CPU-only update pass; tests/preparation/test_inductor_tuning_cuda.py was not run):

CUDA_VISIBLE_DEVICES="" pytest \
  tests/preparation/test_mixed_gpu_inductor_keying.py \
  tests/preparation/test_forward_artifact_sharing.py \
  tests/preparation/test_inductor_prepared_winners.py \
  tests/preparation/test_compile_pool.py \
  tests/preparation/test_core_boundary.py

Result: 103 passed, 2 warnings in 33.58s (20 passed in test_mixed_gpu_inductor_keying.py).

@flare-autobot

@flare-autobot flare-autobot added area:memory Memory budgets, allocation lifetimes, scratch sharing, and capacity. triage:validation Proposed implementation needs acceptance evidence; no claim that a reported defect is fixed. and removed triage:review Proposed change needs code review; this does not imply merge readiness. labels Nov 29, 2026
@flare-autobot

Copy link
Copy Markdown
Collaborator

Autobot Review

Full Review · Value Proposition · Case File

Recommendation: Ready To Merge

Head 1acb1f0 cleanly resolves the Round 1 blocker and all Round 1 code/doc review items: allocate_workers is strictly monotonic without multi-group RAM overcommit, on-disk filenames stay un-suffixed inside each SKU's GPU-partitioned ForwardCache.root, and both preparation docs are updated. No new correctness, concurrency, or homogeneous-path regressions were introduced; only a GPU verification gap outside CI remains.

  • Blockers: 0 · Should fix: 0 · Subtract/Simplify: 1 · Nits: 3
Walkthrough
  • ignition/preparation/inductor_tuning.py: Exposes cuda_device_identity(device) (:21-26) returning (product_name, compute_capability) (or ("", None) for non-CUDA), and updates InductorSelections.warm (:247-253) to key Inductor kernel-inventory agreement by (compilation_variant, gpu_name) while removing the redundant cross-architecture check.
  • ignition/preparation/aot.py: Updates _publication_lock (:778-816) to lock every distinct (host, str(self.root.resolve())) in sorted order; updates _prepare_ranks (:933-1067, 1113, 1132, 1155-1159) to reject cross-architecture rank groups (safely ordering None capabilities), key selections/compilers/work/lent/paths by (compilation_variant, gpu_name) with un-suffixed {name}.{variant} on-disk filenames, pass groups=gpu_names to allocate_workers, and restrict host-local lending to matching (host, gpu_name) peers; adds root=None exact-parent filtering to _share_artifacts (:698-724), passed as root=self.root at both multi-host call sites (:1104-1105, 1170).
  • ignition/preparation/compile_pool.py: Adds optional groups=None to allocate_workers (:62-124), raising ValueError when limit < len(active_groups), seeding one full-estimate worker per active (host, group) subgroup, restricting the 2 GiB minimum-allowance fallback strictly to len(active_groups) == 1, raising MemoryError if any active subgroup remains empty, and distributing surplus workers across active subgroups.
  • docs/model-preparation.md (:238-252) & docs/preparation-development.md (:351-382): Documents per-SKU worker seeding, same-SKU lending, per-(host, GPU product name) cache roots and locks, multi-host root-scoped sharing, per-(compilation_variant, GPU product name) Inductor inventory validation, and cross-architecture rejection.
  • tests/preparation/test_mixed_gpu_inductor_keying.py (:1-453): Adds 20 CPU unit tests covering cuda_device_identity("cpu"), mixed-SKU keying and same-SKU lending isolation, homogeneous→mixed cache reuse with zero recompilation on the cached SKU, monotonic multi-SKU memory admission ([12, 39, 40, 41, 42, 71] GiB → MemoryError, 72 GiB → [1, 0, 1, 0], 10 GiB single-active-group fallback), low worker-limit ValueError, cached-SKU worker withholding, two-host mixed-SKU _share_artifacts root isolation, multi-root _publication_lock locking, homogeneous un-suffixed sharing, cross-architecture rejection (including None), and per-(variant, gpu_name) Inductor inventory checks.
Merge Risk: Low · up to 1acb1f0
  • Homogeneous hosts and single-active-SKU runs are unchanged: allocate_workers (ignition/preparation/compile_pool.py:70, 101-111) preserves the 2 GiB minimum-allowance fallback whenever len(active_groups) == 1, CompilePool.__init__ (compile_pool.py:161) keeps its existing single-rank call, _publication_lock (ignition/preparation/aot.py:789-816) executes the same barrier count per distinct root, and on-disk filenames remain un-suffixed {name}.{variant} inside self.root (aot.py:968, 1025, 1066).
  • Mixed-SKU hosts gain strict safety invariants with a clear RAM floor: Two active SKU groups on one host require 2 × 32 + 8 = 72 GiB available host RAM to seed one full-estimate worker per active group (compile_pool.py:93-114), avoiding the concurrent RAM overcommit that existed in the prior revision; hosts with only one active SKU compiling (e.g., the other SKU cached) retain the single-group fallback.
  • Verification gap remains outside CI: No .github/workflows/ job executes tests/preparation/, and tests/preparation/test_inductor_tuning_cuda.py plus an isolated main-vs-branch mixed-SKU GPU export were not run on 1acb1f0.
Pre-merge checks: ✅ 2 passed · ⚠️ 2 warnings

Have your agent review the Full Review for complete verified findings, file:line citations, and suggested changes.

To opt out, include #autobot:ignore in your post or comment.

…y GPU name

Multi-GPU SM120 hosts pairing RTX PRO 6000 Blackwell Max-Q Workstation Edition
and RTX PRO 6000 Blackwell Workstation Edition GPUs share compute capability
(12, 0) but report distinct CUDA device names and can compile different
Inductor kernel inventories for the same logical compilation_variant. Although
ForwardCache.__init__ already partitions self.root by properties.name,
ForwardCache._prepare_ranks previously keyed _variant_compilers and
paths[name, variant] by compilation_variant alone and lent missing compilations
across all ranks on a host regardless of GPU name, ForwardCache._publication_lock
locked only one cache root per host, _share_artifacts fetched peer artifacts
without scoping to self.root, allocate_workers could starve a secondary active
SKU group on a host, and InductorSelections.warm required identical Inductor
kernel inventories across all ranks sharing one compilation_variant string.

Add cuda_device_identity(device) in ignition/preparation/inductor_tuning.py,
lock every distinct (host, resolved_root) in deterministic sorted order in
ForwardCache._publication_lock, and extend allocate_workers in
ignition/preparation/compile_pool.py with an optional groups parameter that
rejects host worker limits smaller than the active group count with ValueError,
restricts the 2 GiB minimum-allowance fallback strictly to single-active-group
hosts, and enforces monotonic full per-worker memory admission across multiple
active SKU groups before distributing surplus workers. In
ForwardCache._prepare_ranks, gather (gpu_name, capability) across ranks, reject
cross-architecture rank groups, key selections, compilers, work, lent, and paths
by (compilation_variant, gpu_name) while keeping un-suffixed
{name}.{compilation_variant} on-disk filenames inside each SKU's self.root,
restrict host-local lending to matching (host, gpu_name) peers, and pass
root=self.root to _share_artifacts so multi-host transfers fetch only artifacts
under the rank's own cache root. Key InductorSelections.warm kernel-inventory
agreement by (compilation_variant, gpu_name). Update docs/model-preparation.md
and docs/preparation-development.md, and add 20 CPU unit tests in
tests/preparation/test_mixed_gpu_inductor_keying.py.

This enables tensor-parallel preparation on mixed-SKU same-architecture SM120
hosts while preserving homogeneous-to-mixed cache reuse inside per-SKU roots,
monotonic host RAM admission, multi-host cache-root isolation, and
cross-architecture rejection.

Validated with standalone CPU pytest (CUDA_VISIBLE_DEVICES="" pytest
tests/preparation/test_mixed_gpu_inductor_keying.py
tests/preparation/test_forward_artifact_sharing.py
tests/preparation/test_inductor_prepared_winners.py
tests/preparation/test_compile_pool.py tests/preparation/test_core_boundary.py
tests/preparation/test_preparation_reclamation.py
tests/preparation/test_forward_cache_sources.py
tests/test_design_review_hook.py: 135 passed, 79 warnings in 31.60s, including
20 tests in test_mixed_gpu_inductor_keying.py) and prior combined-stack
mixed-SKU TP4 and homogeneous TP2 export and flare run serving checks on
DeepSeek-V4.1-Flash and the gb202 / gb202-tp2 Hugging Face package revisions of
brandonmusic/glm-5.3-flash-exl3-tr3-2.375bpw-flare.
tests/preparation/test_inductor_tuning_cuda.py and live GPU re-exports were not
run during this CPU-only rebase pass, cross-architecture rejection and two-host
root isolation are verified on CPU only, and Rust crate tests were not run
because only Python, test, and documentation files changed.

Design-Signed-Off-By: Brandon M. Music; design-review=2e5b
Signed-off-by: Brandon M. Music <266531604+brandonmmusic-max@users.noreply.github.com>
@brandonmmusic-max
brandonmmusic-max force-pushed the mixed-gpu-inductor-keying branch from 1acb1f0 to f69e407 Compare November 29, 2026 22:42
@flare-autobot flare-autobot added triage:review Proposed change needs code review; this does not imply merge readiness. triage:validation Proposed implementation needs acceptance evidence; no claim that a reported defect is fixed. and removed triage:validation Proposed implementation needs acceptance evidence; no claim that a reported defect is fixed. triage:review Proposed change needs code review; this does not imply merge readiness. labels Nov 30, 2026
@flare-autobot

Copy link
Copy Markdown
Collaborator

Autobot Review

Full Review · Value Proposition · Case File

Recommendation: Ready To Merge

Head f69e407 (clean rebase of the Round 2-approved 1acb1f0 onto main, including #592, #608, and #618) preserves all Round 1 fixes with no new correctness, concurrency, or homogeneous-path regressions. Only optional cleanup suggestions and an unrun GPU/isolated-repro verification caveat remain.

  • Blockers: 0 · Should fix: 2 · Subtract/Simplify: 2 · Nits: 2
Walkthrough
  • ignition/preparation/inductor_tuning.py: Adds public cuda_device_identity(device) (:21-26) returning (product_name, compute_capability) (or ("", None) for non-CUDA) and keys InductorSelections.warm kernel-inventory agreement by (compilation_variant, gpu_name) (:247-253).
  • ignition/preparation/aot.py: Updates ForwardCache._publication_lock (:862-899) to gather (host, str(self.root.resolve())) across ranks and acquire publication.lock once per distinct pair in sorted order; updates ForwardCache._prepare_ranks (:1045-1065, 1113-1128, 1141-1189, 1222-1283) to reject cross-architecture rank groups (safely sorting None capabilities), key selections/compilers/work/lent/paths by (compilation_variant, gpu_name) while preserving un-suffixed {name}.{variant} filenames inside each SKU's self.root, pass groups=gpu_names to allocate_workers, and restrict host-local lending to matching (host, gpu_name) peers; adds root=None exact-parent filtering to _share_artifacts (:772-812), passed as root=self.root at both multi-host call sites (:1224-1226, 1312-1313).
  • ignition/preparation/compile_pool.py: Adds optional groups=None to allocate_workers (:62-124), raising ValueError if limit < len(active_groups), seeding one full-estimate worker per active (host, group) subgroup, limiting the 2 GiB minimum-allowance fallback strictly to len(active_groups) == 1, raising MemoryError if any active subgroup remains unseeded, and distributing surplus workers across active subgroups.
  • docs/model-preparation.md (:238-252) & docs/preparation-development.md (:351-382): Documents per-SKU worker seeding, ValueError on low host worker limits, multi-group full-estimate admission, same-SKU host-local lending, per-(host, GPU product name) cache roots and lock ordering, root-scoped multi-host sharing, per-(compilation_variant, GPU product name) Inductor inventory checks, and cross-architecture rejection.
  • tests/preparation/test_mixed_gpu_inductor_keying.py (:1-452): Adds 20 CPU unit tests (isolated via forked Gloo child processes and monkeypatch) covering cuda_device_identity("cpu"), mixed-SKU keying and same-SKU lending isolation, homogeneous-to-mixed cache reuse with zero recompilation on the shared SKU, monotonic multi-SKU memory admission ([12, 39, 40, 41, 42, 71] GiB → MemoryError, 72 GiB → [1, 0, 1, 0], 10 GiB single-active-group fallback), low worker-limit ValueError, cached-SKU worker withholding, two-host mixed-SKU _share_artifacts root isolation, multi-root _publication_lock acquisition, un-suffixed homogeneous sharing, cross-architecture rejection (including None), and per-(variant, gpu_name) Inductor inventory validation.
Merge Risk: Low · up to f69e407
  • Homogeneous and single-active-SKU paths are unchanged: allocate_workers (ignition/preparation/compile_pool.py:70, 101-111) preserves the 2 GiB minimum-allowance fallback whenever len(active_groups) == 1, CompilePool.__init__ (:161) keeps its single-rank behavior, _publication_lock (ignition/preparation/aot.py:873-896) performs the same barrier count per distinct root, and on-disk filenames remain un-suffixed {name}.{variant} inside self.root (aot.py:1080, 1142, 1187).
  • Mixed-SKU hosts gain strict isolation invariants with explicit admission floors: Two active SKU groups on one host require 2 × 32 + 8 = 72 GiB available host RAM (compile_pool.py:91-114, host_memory.py:15-16) and a host worker limit >= len(active_groups) (compile_pool.py:86-90), avoiding cross-SKU lending, unlocked foreign-root writes, and multi-group RAM overcommit; cached SKUs withhold workers so a single compiling SKU still retains the 2 GiB fallback.
  • GPU verification gap remains outside CPU CI: .github/workflows/python-cpu.yml:30-33 (not opened) now runs all CPU preparation tests (including the 20 new tests), but tests/preparation/test_inductor_tuning_cuda.py (not opened) and an isolated main-vs-branch mixed-SKU GPU export were not run on f69e407.
Pre-merge checks: ✅ 3 passed · ⚠️ 2 warnings
  • ✅ Security / malicious screen: No prompt injection, shell execution, credential exposure, or unsafe deserialization across the 6 changed files (the #autobot:ignore / "Have your agent review…" footer in PR comments is Autobot's own review boilerplate, not an attack).
  • ⚠️ Charter & value fit: Cleanly scoped to ignition/preparation for SM120 workstation TP preparation with no new CLI flags, env vars, or per-model branches, and preserves homogeneous paths; however, an isolated main-vs-branch mixed-SKU hardware reproduction/benchmark is still absent (only combined-stack serving runs and CPU unit tests are provided).
  • ✅ Related / duplicate / conflict check: Additive to main (#592 and #618 are already rebased into f69e407; #122 and #584 are closed unmerged; #622 does not duplicate this; open PRs #314 and #639 touch aot.py/compile_pool.py for distinct features).
  • ⚠️ Tests & verification evidence: .github/workflows/python-cpu.yml:30-33 (not opened) now runs pytest tests/ -q with CUDA_VISIBLE_DEVICES="" (executing all 20 new tests in CI), and the author reports 103 passed, 2 warnings; however, tests/preparation/test_inductor_tuning_cuda.py (not opened) and a live mixed-SKU GPU export were not run on this revision (Rust/TLA+ gates are N/A for Python-only preparation changes).

Have your agent review the Full Review for complete verified findings, file:line citations, and suggested changes.

To opt out, include #autobot:ignore in your post or comment.

…dmission

Allowing root=None in _share_artifacts left a silent fallback branch that
could disable cache-root isolation if a caller omitted root, allocate_workers
duplicated its full-estimate admission loop across group seeding and surplus
distribution, its MemoryError omitted active group count and per-worker memory
estimates needed to diagnose mixed-SKU host RAM floors, and docs/cli-design.md
did not mention mixed-SKU active-group worker seeding or the low-limit
ValueError under --compile-workers.

Make root a required parameter of _share_artifacts in
ignition/preparation/aot.py (updating tests/preparation/test_forward_artifact_sharing.py
to pass root="forwards"), extract a local admit(candidates) helper in
ignition/preparation/compile_pool.py to share the worker-selection logic
between group seeding and surplus allocation, include active group count and
minimum per-worker MiB estimate in the allocate_workers MemoryError message
(asserted in tests/preparation/test_mixed_gpu_inductor_keying.py), and align
the --compile-workers flag description in docs/cli-design.md with
docs/model-preparation.md.

This eliminates the unlocked-root bypass branch in multi-host artifact
sharing, keeps seed and surplus worker admission from drifting, makes
mixed-SKU host RAM failures immediately actionable, and keeps CLI
documentation consistent with preparation behavior with no runtime or model
core compatibility impact.

Validated with CPU pytest (CUDA_VISIBLE_DEVICES="" pytest
tests/preparation/test_mixed_gpu_inductor_keying.py
tests/preparation/test_forward_artifact_sharing.py
tests/preparation/test_inductor_prepared_winners.py
tests/preparation/test_compile_pool.py tests/preparation/test_core_boundary.py
tests/preparation/test_preparation_reclamation.py
tests/preparation/test_forward_cache_sources.py
tests/test_design_review_hook.py: 135 passed, 0 failed) and single-GPU SM120
CUDA Inductor tests (FLARE_RUN_CUDA_TESTS=1 CUDA_VISIBLE_DEVICES=3 pytest
tests/preparation/test_inductor_tuning_cuda.py: 8 passed, 5 multi-GPU tp2
cases skipped on single GPU 3). Multi-GPU tp2 CUDA cases and a live mixed-SKU
GPU export were not re-run in this pass; Rust crate tests were not run because
only Python, test, and documentation files changed.

Design-Signed-Off-By: Brandon M. Music; design-review=2e5b
Signed-off-by: Brandon M. Music <266531604+brandonmmusic-max@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:memory Memory budgets, allocation lifetimes, scratch sharing, and capacity. area:preparation Ignition checkpoint loading, tuning, compilation, capture, and export. enhancement New feature or request performance Performance, latency, throughput, or memory-efficiency investigation or improvement. triage:validation Proposed implementation needs acceptance evidence; no claim that a reported defect is fixed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants