Repository navigation
[CI] The bundle carries validation/layer, under the compiler's CI cap, and names each call left to aten - #401
Merged
Conversation
…er and each of its ops The layer suite reads the compiler's validation/layer/tpu_v6e_qwen3moe_layer_torchxla.csv and builds each row as the TPU harness (tpu-perf-archive harness/qwen_moe_layer_v1.py) ran it: the whole layer for prefill (T = S) and decode (one token over a cache of S, its own K/V not written), and rmsnorm, q_norm, k_norm, rope_q, rope_k, residual, router_post, dispatch, gmm_gate_up, silu_mul, gmm_down and combine alone at the layer's shapes. Routing is the harness's fixed uniform ids (token i -> experts 8i..8i+7 mod 128), passed in as an input; combine's unsort is its `positions` form; torch_xla's gmm is torch.nn.functional.grouped_mm. The manifest carries section, name, T and S. A workload's inputs now come from a maker drawing on the generator, so the layer's weights, rope tables and ids are inputs beside the normal tensors; the existing suites draw exactly what they drew before. The layer runs in its own timing-mode process in CI, since its projections are mm templates; its picks are folded into the record with the GEMMs'.
…four processes, and names each call left to aten The layer suite bundles only the rows the compiler's validation/layer/simulate_shapes.py under_cap takes (a layer's S, an op's T at most 4096), read from the compiler itself so the cap has one definition; the other suites still build every row. `bundle.py --jobs N` builds the workloads in N spawned processes, each taking the next one, largest first by the compiler's rank (token_pairs for the layer); CI builds the layer with four, since its prefill at S 4096 alone takes ~85 min. Measured on the bundle step as CI runs it (gemm and vector+attention beside it, cold dumps, no previous picks): the 96 capped layer rows in 5229 s against ~3.8 h in one process, gemm 4856 s, vector+attention 1503 s, the step 5229 s. Each manifest gains `externs`: every call Inductor left to aten (an extern kernel or a fallback), in order, with `at`, the launches before it. They run as aten does and nothing is simulated for them. The npu wrapper codegen, the class registered for the device, writes a torchsim_extern line before each such call, naming the op its IR node holds (or the callable it calls), and bundle.py observes those as it observes launches; nothing reads generated code. On the layer suite these are aten._grouped_mm.default (#398) and aten.sort.stable (#399), tracked in #397.
YWHyuk
force-pushed
the
bundle/layer-suite
branch
from
October 21, 2026 03:17
57564ee to
859c97a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The validation bundle now carries the compiler's
validation/layersuite: Qwen3-30B-A3B's decoder layer and each of its ops. The bundle fits the 240-min job, and each manifest names the calls Inductor leaves to aten.Commits
0204134: the layer suite.
bundle.pybuilds each row ofvalidation/layer/tpu_v6e_qwen3moe_layer_torchxla.csvthe way the TPU harness ran it:It runs as its own timing-mode process in CI, because its projections are mm templates.
57564ee: the cap, the processes, and the externs.
validation/layer/simulate_shapes.pyunder_capaccepts: a layer's S and an op's T at most 4096. The definition is loaded from the pinned compiler, not restated here. Other suites still build every row.bundle.py --jobs Nbuilds the workloads in N spawned processes. Each process takes the next workload, largest first by the compiler's rank (token_pairs). CI uses--jobs 4for the layer.manifest.jsongainsexterns: every call Inductor left to aten, in order, each withat, the number of launches before it. Detection:register_backend_for_device. Itsgenerate_extern_kernel_out/alloc/multi_out,generate_fallback_kernel(_with_runtime_lookup),generate_scatter_fallbackandgenerate_index_put_fallbackeach write atorchsim_extern(<op>)line before the call they emit.<op>is the op the IR node holds (aten.sort.stable), or the Python callable it calls when it holds none (extern_kernels.mm).bundle.pyobserves those lines at runtime, the same way it observes launches. Nothing parses generated code or text.TorchDispatchModewas tried first and rejected: with a mode active, Dynamo runs dispatch eagerly instead of compiling it.Measured
The bundle step was run as CI runs it: gemm in timing mode, the layer in timing mode with
--jobs 4, and vector+attention, all three at once. Dumps were cold, no previous picks were used, and the host has 50 cores. Rows over the cap (all T or S 8192, 14 of them) were dropped.In one process the capped layer took about 3.8 h by earlier per-row probes; prefill S 4096 alone is 5104 s. The layer's wall time is now set by that one row.
Externs found in the bundle: 32 of 96 layer workloads, and none in gemm (62), vector (228) or attention (56).
aten._grouped_mm.default: every gmm op row (which holds only a cumsum kernel), plus 2 per layer.aten.sort.stable: dispatch at T >= 128, and the prefill layers.Tracking
Landing order
This workflow runs only on a push to
pytorchsim-triton-backend, never on a PR. That push opens or updates the compiler'sbot/pts-bundlePR (scripts/ci/ptb_bundle_pr.sh). The order:validation/layerand itsunder_cap/token_pairs. At the current pin d0553bd the layer suite has no csv, and the bundle job would fail.externsto the compiler asbot/pts-bundle.🤖 Generated with Claude Code
https://claude.ai/code/session_011cGNfHFySFsi7feZKKvq7e