Skip to content

[None][refactor] Clean up the MiniMax-M3 modeling_v2 family under the Modeling V2 code rules - #23200

Draft
Wanli-Jiang wants to merge 2 commits into
NVIDIA:mainfrom
Wanli-Jiang:user/williamj/m3-mv2-cleanup
Draft

Wanli-Jiang wants to merge 2 commits into
NVIDIA:mainfrom
Wanli-Jiang:user/williamj/m3-mv2-cleanup

Conversation

@Wanli-Jiang

@Wanli-Jiang Wanli-Jiang commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

Description

This brings the existing minimax_m3 Modeling V2 family in line with the Modeling V2 code rules proposed in #23183. The family has 11 ModelCores: MiniMax-M3 NVFP4 on sm_103 (tp4, tp8) and sm_107 (tp2, tp4, tp8), and MiniMax-M3.1 Flash NVFP4 on sm_107 (tp2, tp4, tp8, tp2ctx, dep2ctx, dep). The results of the supported deployments do not change (see Verification). Deployments that failed at load or at their first step are now declined at routing.

The diff is large because the clean-up deletes much more than it adds: 1,575 files, +51,866 / -171,866 lines.

This is a draft and a first step: it brings the parts listed under "What changes" in line with the rules, and "Not in this pull request" lists what is left for follow-up pull requests. The second commit moves two kernel choices into ops, adds a routing decline, fixes the unit-test layout and removes comments that mark no exception.

What changes, by layer

Layer Change
Routing Every ModelCore has its own deployment check in minimax_m3/deployment.py. Configurations that failed at load or at the first step are declined at routing (listed below).
ModelCore Handles and workspaces are built at load, and the family's own switches are read once, at load. Of 387 registered environment switches, 5 stay (ROUTER_TF32_48_ROWS, TP4_WHOLECHAIN, TP4WC_HOIST, DEP2CTX_ROUTER_BF16S, DEP_VLLM_TOPK), each with a comment that says why it exists, its default and when to turn it off. The others are deleted with the paths they guarded and those paths' tests. Environment reads in the family go from 89 to 43.
Targets and drafters Every ModelCore has Targets whose forward calls its modules and ops in execution order. The Eagle3 and DSpark drafter steps are written the same way. Choices of a collective or a kernel by row count moved from modules into ops.
Ops Kernels that model code called directly are wrapped in ops. New ops have reference, CELLS and ARCHS; 23 ops gained an is_valid.
Kernels Identical kernel and op copies go from 69 groups (154 files) to 1 group (2 files, with its exception comment). Copies that differ say at their top why they are separate (list below). The MiniMax C++/CUDA code in cpp/tensorrt_llm/ (149 files, 40,654 lines) moved into the family's and the ModelCores' csrc/ and is reached through torch.ops.mv2_minimax_m3; 10 files (1,710 lines) of shared build and registration code stay.
Unit tests 522 files with 1,708 test functions become 465 files with 780. Bitwise comparisons stay only for ops that do no floating-point arithmetic (102); the others (209) compare with reference within a tolerance whose derivation is in a comment. Each ModelCore has one whole-step CUDA graph test; 43 per-op CUDA graph tests are removed and 17 remain. Tests skip on GPU architectures their code does not serve, and tests of family ops moved with the ops.
Accuracy tests Each ModelCore has two cases, without and with speculative decoding. Acceptance-length floors are registered in tests/integration/defs/accuracy/references/acceptance_length.yaml.
Code no deployment runs Deleted: the DSpark drafter paths behind engine hooks that do not exist on main (about 21,800 lines, including M3.1's Eagle3 code), and the DEP tail and side-stream code whose registration hooks do not exist.

Deployments now declined at routing

Under modeling_v2="auto" these run on Modeling V1; under "require" they fail with the reason. Before, they failed at load or at the first step.

  • A breakable prefill CUDA graph on M3 sm_103 tp4 / tp8 and sm_107 tp2 / tp4 / tp8, and on M3.1 tp2 / tp4 without the fused projection.
  • M3.1 tp2ctx when its native kernels are not built.
  • The requirements the ModelCore constructors checked, now checked at routing.

Fixes of problems on main

  • M3.1 tp2ctx aborted at startup on both ranks: a load-time probe borrowed an NCCL window tensor and dropped it, which the NCCL window lifetime check aborts on. The probe only wrote a log line and is removed; tp2ctx loads.
  • M3.1 tp2 kept every ModelCore it had loaded alive in a module-level dictionary (_BCG_CORES), so a second load in the same process ran out of memory. The dictionary holds weak references now.
  • The fix of [None][fix] Fix two synchronization gaps in the MiniMax M3 low-M split-K GEMM #21848 is applied to the family copy of m3_lowm_splitk.py, which the M3.1 tp2 and tp4 DSpark drafters use. It changes those drafters' split-K results.

Not in this pull request

  • Use of Modeling V1 model classes, layers and backends: 90 imports remain (71 in the ModelCores, 19 in family code), and the context and DEP ModelCores run whole layers through Modeling V1 modules. The rule on this was added to [None][doc] Modeling V2: code rules and a skill that checks a pull request against them #23183 after this clean-up.
  • Kernel choices and state inside Targets and modules: in about 140 places a forward or a module picks a kernel by execution mode (for example a second MoE engine only on a decode graph) or by whether an op covers the step's shape, or passes data to a later op through module-level state. The rules put kernel choices in ops and fix every other choice at load. The choices between op sequences by row count (about 66 more) are allowed by the rules.
  • Kernels called outside ops on every step: about 140 call sites, of which 86 launch the family's own kernels and 55 run through Modeling V1 modules. (The kernels of the engine's logits head and speculative-decoding workers need no op.)
  • Routing: about 33 configuration checks still run at load instead of routing (for example the index-head layout, the CUTLASS MXFP8 GEMM requirement, the Eagle3 drafter width), LoRA and image or video input are not declined at routing, and 10 ModelCores fall back to a slower path per step with a log line.
  • Per-step code: the engine's get_env_enable_pdl(), which reads TRTLLM_ENABLE_PDL, is called on every step (about 75 sites); some steps test whether a native op exists; decode ops keep module-level state they rewrite per step.
  • Code that needs engine hooks main does not have: the M3.1 ModelCores request hooks through runtime_hooks_compat, which drops the ones the engine lacks. The family MSA backend (msa/) is therefore never built, and the code behind the other dropped hooks never runs. Whether to keep it for an engine change is one of the owner's decisions.
  • Tests: 17 per-op CUDA graph tests, 2 tests that parse source text, family-level tests that load ModelCore code through computed importlib names (CI test selection does not see them), and 11 ops without a reference test.
  • Accuracy coverage: long context (the long-selection paths start at about 16.5K tokens; the cases run 4K and 16K) and image and video input are not covered.
  • Copies that compute the same thing with different kernels are kept; each says at its top why.
  • 9 ops for which an is_valid would help have none yet; each would need a GPU run over all its CELLS.
  • M3.1 tp8 keeps two checks in its Targets that raise on a breakable prefill graph.
  • TLLM_DISABLE_ALLREDUCE_AUTOTUNE is still set with os.environ.setdefault at load (the engine's AllReduce reads it from the environment only).
  • Speed was not measured. The kernel sequence of every step is the same before and after (below), but the host-side changes (handles built at load, planning before forward, removed per-step checks) were not timed.

Verification

How: for each change, before and after, on the same nodes: the kernel sequence of each step on every rank (kernel by kernel, or by kernel family where the autotuner picks the tactic, with two loads of unchanged code as the control), the greedy tokens, the unit tests and the accuracy cases. GPUs: GB300 (sm_103) and VR200 (sm_107), one and two nodes. The numbers below are from this change on main 5e5196675b. After the update to main f1965254e7, the unit tests of the files main's new commits touched were run again on both GPUs and pass.

Unit tests (whole minimax_m3 unit tree):

GPU Passed Failed Skipped
GB300 2,040 1 799
VR200 7,313 4 133

The 5 failures are the new CUDA graph tests of M3 sm_103 tp4, M3 sm_107 tp2 / tp4 and M3.1 tp2 / tp4: a decode step replayed from a CUDA graph gives logits that differ from the same step run eagerly, by 1.6 to 7. They fail the same way on main with only the test added, and the M3 sm_103 tp8 graph test (two nodes, not in the run above) fails the same way. The eager path is deterministic, and a load with CUDA graphs that does not replay matches eager bit for bit. A bug is being filed, and the two sm_103 graph tests, which post-merge CI runs, will be waived until it is fixed.

Accuracy (GSM8K; acceptance length from the iteration statistics of the whole GSM8K run):

ModelCore Without speculation With speculation Acceptance length (floor) Compared with main
M3 sm_103 tp4 89.121 Eagle3 89.727 3.488 (3.388) identical
M3 sm_103 tp8 (2 nodes) 88.931 Eagle3 90.220 3.498 (3.398) identical
M3 sm_107 tp2 piecewise CUDA graph 90.978 Eagle3 89.992 3.517 (3.417) identical
M3 sm_107 tp4 piecewise CUDA graph 89.765 Eagle3 90.751 3.507 (3.407) identical on the same load order (see below)
M3 sm_107 tp8 (2 nodes) piecewise CUDA graph 91.243 Eagle3 89.310 3.506 (3.406) identical
M3.1 tp2 95.906 DSpark 96.588 4.673 (4.552) within the run-to-run spread; on main the DSpark case runs out of memory after the first case in the same process (fixed here)
M3.1 tp4 96.588 DSpark 96.816 4.664 (4.546) within the spread
M3.1 tp8 (2 nodes) 96.740 DSpark 96.361 4.719 (4.619) identical
M3.1 tp2ctx 96.361 DSpark 96.285 4.732 (4.532) main fails to load
M3.1 dep2ctx 96.664 DSpark 96.816 4.672 (4.530) within the spread
M3.1 dep (2 nodes) 96.740 DSpark 96.740 4.662 (4.541) within the spread
  • M3.1 DSpark GSM8K varies from 96.2 to 97.1 between runs of the same code, so for M3.1 the kernel sequences decide, and they are the same.
  • M3 sm_107 tp4 piecewise GSM8K depends on what ran before it in the process (89.765 first in a fresh process, 89.158 or 89.348 after the Eagle3 case), on main and on this branch alike: the process-wide autotuner cache changes which all-reduce small decode steps use. Its Eagle3 GSM8K takes 89.651 or 90.751 between runs on main too.
  • M3 sm_107 tp2 Eagle3 gave 90.334 once and 89.992 in two repeats of the same code.

Accuracy coverage and CI stages

The features covered are decoding without speculation, speculative decoding (Eagle3 on M3, DSpark on M3.1) and, on M3 sm_107, piecewise CUDA graphs. Each ModelCore has one test file with two cases, each loading the model once.

Stage Cases Why there
pre-merge M3 sm_103 tp4 Eagle3 GSM8K and acceptance (4 GPUs, 40 min) the one family case on a GPU pre-merge has; it runs the target and the drafter
post-merge the other three sm_103 cases (tp8 on two nodes) sm_103 GPUs, cost
QA all 18 sm_107 cases no CI stage has sm_107 GPUs

CI cost: unit-test functions go from 1,708 to 780. Test-list entries with a timeout that this pull request adds: pre-merge 19 family op-test entries (1 GPU, 30 min each, 570 GPU-minutes; these tests ran before inside the ModelCore directories) and the accuracy case above (160 GPU-minutes); post-merge the two sm_103 CUDA graph tests (4 GPUs and 8 GPUs, 60 min each, 720 GPU-minutes). Other entries use the stage's default timeout.

Exceptions, copies and decisions for the owner

  • 100 MV2-EXCEPTION comments: routing 27, modelcore 7, target 2, kernel 25, unit-test 39. Under the latest rules these are notes for readers, and the exceptions the rules list are allowed without them; the list is in the first comment below. Places that break a rule in a way the rules do not list are the items of "Not in this pull request", plus two branches in M3.1 dep2ctx that follow what the MoE backend reports after each launch.
  • 44 kernel and op files are copies of another file in the family and stay separate; the list is below.
  • 22 items need the family owner's decision: the switches, the acceptance-length gates and CI stages, code that waits for engine hooks main does not have, one deployment question and one placement question. They are in the table below.

Decisions for the owner

Decisions for the family owner (22). ModelCore short names: M3 sm_103 tp4 is minimax_m3_nvfp4__sm_103__tp4, M3.1 tp2 is minimax_m3_1_flash_nvfp4__sm_107__tp2, and so on.

Topic ModelCore(s) What this pull request does What the owner decides
Process-wide default of TLLM_DISABLE_ALLREDUCE_AUTOTUNE M3.1 tp2, tp4, tp2ctx, tp8 Keeps os.environ.setdefault("TLLM_DISABLE_ALLREDUCE_AUTOTUNE", "1") at load, with a comment: AUTO's timed autotuner varies per start on SM107; set 0 to restore timing. The engine reads it on every AUTO all-reduce, so it affects the whole worker process, drafter and other models included. PR #23107 keeps it. Whether to keep writing a process environment variable. A proposed rule says the engine component should take an argument instead, so ModelCores write no environment variables.
ROUTER_TF32_48_ROWS (TRTLLM_M31_DISABLE_ROUTER_TF32_48_ROWS) M3.1 tp2, tp8 Restored as a switch, default on, as in PR #23107. On, 17..48-row decode steps use the TF32 tensor-core router (TP8: 116 us and 103 us less per step at 24 and 32 rows; not bitwise equal to fp32). Off is main's path. tp2 off: GSM8K 96.437. tp8 off: never run or tested. Confirm keeping the switch and its off path; whether tp8 needs one run or a test of the off path.
TP4_WHOLECHAIN (variables named TRTLLM_M31_DISABLE_<ID>) M3.1 tp4 Restored as a switch, default on, agreed across the TP group with tp_agree before the engine build. On: whole-chain port (reference fused engine at 8 rows, hoist blocks with hoist). Off: 8 rows run m3_moe without the engine or hoist. Off run: DSpark GSM8K 96.361 (pass). No test of the off path. Confirm keeping it. Registered reasons to turn it off: comparing with the plain m3_moe chain, or the reference engine fails on a new build, driver or device.
TP4WC_HOIST M3.1 tp4 Restored as a switch, active only with TP4_WHOLECHAIN on, agreed across the TP group in _prebuild_hoist; off builds no hoist blocks. On saves 8.19 us per layer, not bitwise (the accuracy test gates it). Off run: DSpark GSM8K 97.043 (pass), TP4 MoE engine still on. No test of the off path. Confirm keeping it. Registered reasons to turn it off: ruling out a regression from hoist numerics, or a post hang or rx-deadline trap.
DEP2CTX_ROUTER_BF16S (TRTLLM_M31_DISABLE_DEP2CTX_ROUTER_BF16S) M3.1 dep2ctx Restored as a switch that binds the gate class at load. On: MiniMaxM3GateBf16s (FP32 weight split into two BF16 terms, closer to FP64 than TF32, no FP32 copy). Off: MiniMaxM3Gate (TF32 router on an FP32 copy, main's path). New test test_both_gates_bound_at_load checks both bitwise. Off run: GSM8K 96.285 (pass). Confirm keeping it. Registered reasons to turn it off: routing must match the TF32 router bitwise, or the extra weights and cuBLAS workspace do not fit.
TRTLLM_M31_DISABLE_DEP_VLLM_TOPK M3.1 dep Restores the off path, as in PR #23107, in msa/msa_indexer.py. Read once at import, default on (vLLM 16-bit-key decode top-16 select); 1 returns to the exact minimax_m3_select_blocks. Commented, with MV2-EXCEPTION(modelcore). Confirm keeping it.
TRTLLM_MODELING_V2_VALUE_DUMP M3 sm_107 tp8 (the modeling.py of M3 sm_107 tp2, tp4, tp8 all read it) Kept as a diagnostic switch (read once at import, default off). The comment says each rank records every kernel entry per step and prints at exit, for finding which call went wrong. Rank now comes from mpi_rank(), not OMPI_COMM_WORLD_RANK/RANK. Eagle3 drafter ops still record through it. PR #23107 keeps it as is. Confirm keeping it.
TRTLLM_M31_CUTE_AOT_DIR, TRTLLM_M31_CUTE_AOT_EXPORT_DIR, TRTLLM_M31_CUTE_AOT_DISABLE M3.1 ModelCores (family cute_aot.py) Comments moved onto the constants; four MV2-EXCEPTION(modelcore) at the reads removed. DIR kept: objects exported from the same source, key and toolchain replace load-time compiles. EXPORT_DIR kept: the only way to produce them; no test drives _export. DISABLE is a deletion candidate: same effect as leaving DIR unset. Whether to delete TRTLLM_M31_CUTE_AOT_DISABLE; whether the untested EXPORT_DIR path is acceptable.
TP4 hoist debug switches M3.1 tp4 (kernels/hoist/tp4c1/runtime/debug.py) Deletion candidates, not deleted: M31_TP4C1_DEBUG_<name> and M3_LLK_DEBUG_<name> (nothing builds Debug(enabled=True) or calls BuildContext.debug); H1_DBG, H1_DIE, H1_NOSPEC and host_env_set (no source reads them); uncalled stray_debug_env(); also Debug.get, BuildContext.debug, Runtime.debug. Each now has a comment. Whether to delete these switches and functions.
TRTLLM_M3_KV_POOL_ZERO_INIT M3.1 ModelCores (family runtime_hooks_compat.py) An engine switch (tensorrt_llm/_torch/attention/backends/sparse/minimax_m3/cache_manager.py:299) that zeroes the MSA KV pool, replacing the msa_kv_cache_fixes hook this engine lacks. The family reads it at routing and hook build; off declines M3.1 targets. Kept, with a family comment. The engine's comment only says "Kill switch (diagnostics only)"; not changed. Confirm keeping it; whether to complete the comment at the engine definition.
Acceptance-length gates for M3 Eagle3 M3 sm_103 tp4, tp8; M3 sm_107 tp2, tp4, tp8 Per-target gates replace MIN_ACCEPTANCE_RATE = 0.78 and MIN_ACCEPTANCE_LENGTH = 3.3: references/acceptance_length.yaml, min_al = ref_al - 0.10. ref_al / min_al: sm_103 tp4 3.488 / 3.388; sm_103 tp8 3.498 / 3.398; sm_107 tp2 3.517 / 3.417; sm_107 tp4 3.507 / 3.407; sm_107 tp8 3.506 / 3.406 (sm_107 tp8 measured 3.506 on this branch too). Confirm each ref_al / min_al.
Acceptance-length gates for M3.1 DSpark M3.1 tp2, tp2ctx, tp8, dep, dep2ctx Gates registered in references/acceptance_length.yaml at the measured value minus 0.10 (lower of two runs where there were two): tp2 4.552, tp2ctx 4.532, tp8 4.619, dep 4.541, dep2ctx 4.530. Under attention DP only rank 0's requests are counted, so dep2ctx measured 4.630 and 4.803 in two runs. Confirm each gate and the 0.10 margin.
DSpark acceptance-length gate for M3.1 tp4 M3.1 tp4 DSpark keeps per-iteration stats at load, and acceptance length is computed over the whole GSM8KInferenceX run (1319 prompts), as in PR #23107. Two runs both gave 4.645746 (GSM8K 97.043); min_al is 4.545746. Another branch run also measured 4.645746. Confirm the value.
Margin of the M3.1 dep2ctx gate M3.1 dep2ctx Two runs gave 4.630189 and 4.802752, 0.17 apart, more than the 0.10 margin; min_al is 4.530189 (the lower run minus 0.10). Under attention DP, get_stats holds only rank 0's iterations (TLLM_METRICS_ALL_RANKS unset), so it measures rank 0's share of the requests. Use a wider margin, or stats from all ranks (TLLM_METRICS_ALL_RANKS=1 changes the get_stats records, which acceptance_length_from_iteration_stats does not read today).
Acceptance rate no longer checked M3 sm_103 tp4, tp8; M3 sm_107 tp2, tp4, tp8 The yaml holds only ref_al / min_al, so the acceptance-rate check is gone; the rate is only printed. With draft length 3, rate = (length - 1) / 3 (true in all five runs), so the new gates 3.388 to 3.417 equal rates 0.796 to 0.806, stricter than the old 0.78. Confirm dropping the rate gate. If a later drafter proposes fewer tokens per step, the two diverge: add a rate field to the yaml then?
M3 sm_103 tp4 Eagle3 case moved to pre-merge M3 sm_103 tp4 Moves TestModelingV2MiniMaxM3Nvfp4Sm103Tp4::test_eagle3_gsm8k_and_acceptance from post-merge l0_gb300_multi_gpus to pre-merge l0_gb300 (4-GPU block), TIMEOUT (40), cold start 875 s; the comment there says the stage is the model owner's decision. Its test_gsm8k (deleted in PR #23107, kept here) stays in post-merge. Confirm the pre-merge stage.
Family ops/comm tests in post-merge Family Takes them out of _NO_CI_STAGE into l0_gb300_multi_gpus (4 GB300, post-merge, about 72 s). The old reason ("not yet in the 4-GPU list") was not missing hardware: world-4 cells run on sm_103. The list names two tests:ops/comm files; test_modeling_v2_m3_boundary_allreduce_norm_sm107.py goes to _NO_CI_STAGE. Confirm.
CI place of the one CUDA graph test per ModelCore All 11 ModelCores sm_103 tp4's graph test goes to l0_gb300_multi_gpus and sm_103 tp8's to l0_gb300_multi_nodes_node2_gpu8 (both TIMEOUT (60)); the 9 sm_107 ones go to _NO_CI_STAGE (CI has only single-GPU GR100 stages). Entries listing whole ModelCore directories get --ignore-glob=.../*_cuda_graph.py. Both sm_103 graph tests also fail on main (see "CUDA graph replay and eager give different logits"). Confirm these list places, including two graph tests that fail today in post-merge lists.
Tests newly in the GR100 (sm_107) stage Family l0_gr100.yml lists the family ops/attention directory, so moved tests run there too: test_modeling_v2_m3_dense_decode_sm103.py (later deleted) and test_modeling_v2_m3_msa_attention.py (covers the M3.1 tp4 caller on sm_107; this op had no test before). l0_gb300.yml and l0_b300.yml list the new sm_103 family files by name. Confirm.
Code that waits for engine hooks that main does not have all M3.1 ModelCores Deleted, because no deployment can run it on main: the DSpark worker's prebuild items after its hook check (15 to 17 missing enable_* hooks), the one-model Eagle3 drafter of M3.1 (routing never selects it), and the DEP tail, side-stream and co-run band (no MoE registration hook). Kept for now: the M3.1 ModelCores request runtime hooks through runtime_hooks_compat, which drops the ones the engine lacks, so the family MSA backend under msa/ is never built (no sparse_attention hook), tile select never registers, and the code behind the other dropped hooks and the other DEP items never runs. Whether an engine change that adds these hooks is coming. If it is, the kept code stays and the deleted code returns from history, rewritten to the rules; if not, the kept code is deleted too.
Whether CTX deployments pin moe_backend M3.1 tp2ctx With the harness default CUTLASS MoE backend, GEN_FINALIZE, NORMQ_FP4 and the sequence-parallel pre-MoE boundary never engage (they need the TRTLLM-gen backend), so only the pre-attention boundary runs sequence parallel. These paths are kept for TRTLLM-gen deployments. Whether CTX deployments pin moe_backend (a deployment question for the owner).
Identical checkpoint checks in five ModelCores M3 sm_103 tp4, tp8; M3 sm_107 tp2, tp4, tp8; and the input-scale check in seven ModelCores Left in each ModelCore's weights.py / modeling.py, each with its MV2-EXCEPTION(routing) comment (checkpoint contents are known only once the weights are read). Whether to move these identical checks into one family function. The rules leave moving identical ModelCore code to the family to the model owner; it would take the routing exceptions from 27 to about 8.
Copies kept separate (44)

Paths are relative to tensorrt_llm/_torch/modeling_v2/models/minimax_m3/.

File Related copy Relation Why it is separate
kernels/attention/producer_tp8.py minimax_m3_1_flash_nvfp4__sm_107__tp8/kernels/m3_layer/phase_producer.py original of MV2-EXCEPTION(kernel): differs from minimax_m3_1_flash_nvfp4__sm_107__tp8/kernels/m3_layer/phase_producer.py only in the reciprocal square root ...
kernels/gemm/m3_lowm_splitk.py kernels/m3_lowm_splitk.py original of Kept separate: this copy (the MiniMax-M3 targets' split-K GEMM) has the SwiGLU-into-B operand path (b_swiglu), the dense SwiGLU entry points and the drafter ...
kernels/gemm/m3_mx_gemv_kernel.py minimax_m3_1_flash_nvfp4__sm_107__tp8/kernels/mx_gemv/m3_mx_gemv_kernel.py original of Kept separate: the M3.1 TP8 copy adds a gate/up SwiGLU epilogue (the gu_swiglu compile key) and calls its own phase producer (rsqrt without .ftz;
kernels/m3_lowm_splitk.py kernels/gemm/m3_lowm_splitk.py copied from Kept separate: the M3.1 TP2 / TP4 drafters' split-K GEMM (their kernels/m3_draft_lowm.py and the family ops/gemm/m3_draft_lowm.py compile it): compiles cached ...
minimax_m3_1_flash_nvfp4__sm_107__tp2/ops/attention/m3_sparse_decode.py minimax_m3_nvfp4__sm_103__tp4/ops/attention/m3_sparse_decode.py copied from MV2-EXCEPTION(kernel): same code as minimax_m3_1_flash_nvfp4__sm_107__tp4/ops/attention/m3_sparse_decode.py;
minimax_m3_1_flash_nvfp4__sm_107__tp2/ops/gemm/m3_mx_gemv.py minimax_m3_1_flash_nvfp4__sm_107__tp4/ops/gemm/m3_mx_gemv.py copied from MV2-EXCEPTION(kernel): differs from minimax_m3_1_flash_nvfp4__sm_107__tp4/ops/gemm/m3_mx_gemv.py only in the projection shape constants (the TP2 per-rank ...
minimax_m3_1_flash_nvfp4__sm_107__tp2/ops/gemm/m3_mx_gemv_bf16.py minimax_m3_1_flash_nvfp4__sm_107__tp4/ops/gemm/m3_mx_gemv_bf16.py copied from Kept separate: the TP2 projection shapes and rows (o_proj up to 16 rows at K 4096) on this ModelCore's GEMV host module kernels/mx_gemv/op.py, which differs ...
minimax_m3_1_flash_nvfp4__sm_107__tp4/ops/attention/m3_index_score_t2sc.py minimax_m3_nvfp4__sm_107__tp4/ops/attention/m3_index_score_t2sc.py copied from Kept separate: it runs this ModelCore's kernels/m3_index_score_t2sc runner (the family T2SC kernel with its own compile cache);
minimax_m3_1_flash_nvfp4__sm_107__tp4/ops/attention/m3_sparse_decode.py minimax_m3_nvfp4__sm_103__tp4/ops/attention/m3_sparse_decode.py copied from MV2-EXCEPTION(kernel): same code as minimax_m3_1_flash_nvfp4__sm_107__tp2/ops/attention/m3_sparse_decode.py;
minimax_m3_1_flash_nvfp4__sm_107__tp4/ops/gemm/m3_mx_gemv.py minimax_m3_1_flash_nvfp4__sm_107__tp2/ops/gemm/m3_mx_gemv.py copied from MV2-EXCEPTION(kernel): differs from minimax_m3_1_flash_nvfp4__sm_107__tp2/ops/gemm/m3_mx_gemv.py only in the projection shape constants (the TP4 per-rank ...
minimax_m3_1_flash_nvfp4__sm_107__tp4/ops/gemm/m3_mx_gemv_bf16.py minimax_m3_1_flash_nvfp4__sm_107__tp2/ops/gemm/m3_mx_gemv_bf16.py copied from Kept separate: the TP4 projection shapes and rows (o_proj up to 32 rows on the 32-column MMA) on this ModelCore's GEMV host module kernels/mx_gemv/op.py, ...
minimax_m3_1_flash_nvfp4__sm_107__tp8/ops/activation/m3_dense_swiglu_oai.py tensorrt_llm/_torch/modeling_v2/models/minimax_m3/minimax_m3_1_flash_nvfp4__sm_107__tp4/ops/activation/m3_dense_swiglu_oai.py copied from Kept separate: differs from the M3.1 TP4 op in the C++ launch it calls (this ModelCore's TP8 minimax_m3_sm107_tp8_swiglu_oai through its own ...
minimax_m3_1_flash_nvfp4__sm_107__tp8/ops/attention/m3_dense_fullctx_decode.py tensorrt_llm/_torch/modeling_v2/models/minimax_m3/minimax_m3_1_flash_nvfp4__sm_107__tp4/ops/attention/m3_dense_fullctx_decode.py copied from Kept separate: differs from the M3.1 TP4 op in the kernel module it runs (this ModelCore's TP8 kernels/m3_fullctx_decode, compiled for 8 query heads over ...
minimax_m3_1_flash_nvfp4__sm_107__tp8/ops/attention/m3_select_top16.py tensorrt_llm/_torch/modeling_v2/models/minimax_m3/minimax_m3_1_flash_nvfp4__sm_107__tp4/ops/attention/m3_select_top16.py copied from Kept separate: differs from the M3.1 TP4 op in the DSL select's trigger past the early-release rows (phase 1 here, the target's SELECT_LONG_TRIGGER_PHASE at ...
minimax_m3_1_flash_nvfp4__sm_107__tp8/ops/moe/m3_decode_router.py tensorrt_llm/_torch/modeling_v2/models/minimax_m3/minimax_m3_1_flash_nvfp4__sm_107__tp4/ops/moe/m3_decode_router.py copied from Kept separate: differs from the M3.1 TP4 op in the tensor-core rows' upper bound (an argument fixed at load: 48 rows here, 16 with ROUTER_TF32_48_ROWS off, 0 ...
minimax_m3_nvfp4__sm_103__tp4/ops/attention/m3_index_score.py ops/attention/m31_index_score.py original of Kept separate: it runs the index scorer copy in ops/m3_index_score (the sm_103 targets');
minimax_m3_nvfp4__sm_103__tp4/ops/attention/m3_sparse_decode.py minimax_m3_nvfp4__sm_103__tp8/ops/attention/m3_sparse_decode.py original of MV2-EXCEPTION(kernel): same code as minimax_m3_nvfp4__sm_103__tp8/ops/attention/m3_sparse_decode.py except the module its reference imports ...
minimax_m3_nvfp4__sm_103__tp4/ops/gemm/m3_mx_gemv.py minimax_m3_nvfp4__sm_107__tp4/ops/gemm/m3_mx_gemv.py original of MV2-EXCEPTION(kernel): differs from minimax_m3_nvfp4__sm_107__tp4/ops/gemm/m3_mx_gemv.py only in ARCHS;
minimax_m3_nvfp4__sm_103__tp4/ops/gemm/m3_mx_gemv_bf16.py minimax_m3_nvfp4__sm_107__tp4/ops/gemm/m3_mx_gemv_bf16.py original of MV2-EXCEPTION(kernel): differs from minimax_m3_nvfp4__sm_107__tp4/ops/gemm/m3_mx_gemv_bf16.py only in ARCHS;
minimax_m3_nvfp4__sm_103__tp4/ops/moe/m3_moe16_engine.py minimax_m3_nvfp4__sm_107__tp4/ops/moe/m3_moe16_engine.py original of MV2-EXCEPTION(kernel): differs from minimax_m3_nvfp4__sm_107__tp4/ops/moe/m3_moe16_engine.py only in ARCHS;
minimax_m3_nvfp4__sm_103__tp8/ops/attention/m3_sparse_decode.py minimax_m3_nvfp4__sm_103__tp4/ops/attention/m3_sparse_decode.py copied from MV2-EXCEPTION(kernel): same code as minimax_m3_nvfp4__sm_103__tp4/ops/attention/m3_sparse_decode.py except the module its reference imports and the head count ...
minimax_m3_nvfp4__sm_107__tp2/ops/attention/m3_fullctx_decode.py ops/attention/m3_fullctx_decode.py copied from Kept separate: it runs this ModelCore's ops/m3_fullctx_decode, the full-context decode compiled for 32 query heads per rank (TP2);
minimax_m3_nvfp4__sm_107__tp2/ops/gemm/m3_mx_gemv.py minimax_m3_nvfp4__sm_107__tp8/ops/gemm/m3_mx_gemv.py copied from Kept separate: the TP2 per-rank projection shapes and rows up to 48 (served_max_rows) on this ModelCore's GEMV host module ops/mx_gemv/op.py (its split / ring ...
minimax_m3_nvfp4__sm_107__tp2/ops/gemm/m3_mx_gemv_bf16.py minimax_m3_nvfp4__sm_107__tp8/ops/gemm/m3_mx_gemv_bf16.py copied from MV2-EXCEPTION(kernel): differs from minimax_m3_nvfp4__sm_107__tp8/ops/gemm/m3_mx_gemv_bf16.py only in the most rows its served cells reach (32 / 8);
minimax_m3_nvfp4__sm_107__tp2/ops/moe/m3_moe_engine.py minimax_m3_nvfp4__sm_107__tp8/ops/moe/m3_moe_engine.py copied from Kept separate: it binds this ModelCore's MoE engine (ops/m3_moe/op: the TP2 engine state, plan and expert shard);
minimax_m3_nvfp4__sm_107__tp4/ops/attention/m3_index_score_t2sc.py minimax_m3_1_flash_nvfp4__sm_107__tp4/ops/attention/m3_index_score_t2sc.py original of Kept separate: it runs this ModelCore's own T2SC kernel copy (ops/m3_index_score_t2sc.py);
minimax_m3_nvfp4__sm_107__tp4/ops/gemm/m3_draft_lowm.py ops/gemm/m3_draft_lowm.py original of Kept separate: it runs the M3 split-K kernel (kernels/gemm/m3_lowm_splitk);
minimax_m3_nvfp4__sm_107__tp4/ops/gemm/m3_mx_gemv.py minimax_m3_nvfp4__sm_103__tp4/ops/gemm/m3_mx_gemv.py copied from MV2-EXCEPTION(kernel): differs from minimax_m3_nvfp4__sm_103__tp4/ops/gemm/m3_mx_gemv.py only in ARCHS;
minimax_m3_nvfp4__sm_107__tp4/ops/gemm/m3_mx_gemv_bf16.py minimax_m3_nvfp4__sm_103__tp4/ops/gemm/m3_mx_gemv_bf16.py copied from MV2-EXCEPTION(kernel): differs from minimax_m3_nvfp4__sm_103__tp4/ops/gemm/m3_mx_gemv_bf16.py only in ARCHS;
minimax_m3_nvfp4__sm_107__tp4/ops/m3_drafter_attn.py minimax_m3_nvfp4__sm_107__tp8/ops/m3_drafter_attn.py copied from MV2-EXCEPTION(kernel): differs from minimax_m3_nvfp4__sm_107__tp8/ops/m3_drafter_attn.py only in the TP width in the drafter RoPE / FP8-KV op name ...
minimax_m3_nvfp4__sm_107__tp4/ops/moe/m3_moe16_engine.py minimax_m3_nvfp4__sm_103__tp4/ops/moe/m3_moe16_engine.py copied from MV2-EXCEPTION(kernel): differs from minimax_m3_nvfp4__sm_103__tp4/ops/moe/m3_moe16_engine.py only in ARCHS;
minimax_m3_nvfp4__sm_107__tp8/ops/attention/m3_decode_index_score.py tensorrt_llm/_torch/modeling_v2/models/minimax_m3/minimax_m3_nvfp4__sm_107__tp2/ops/attention/m3_decode_index_score.py copied from Kept separate: differs from the M3 sm_107 TP2 op in its scorer schedule (this target's scorer up to 2 requests at 1272 / 768 CTAs per request, where TP2 runs ...
minimax_m3_nvfp4__sm_107__tp8/ops/gemm/m3_projection.py tensorrt_llm/_torch/modeling_v2/models/minimax_m3/minimax_m3_nvfp4__sm_107__tp4/ops/gemm/m3_projection.py copied from Kept separate: differs from the M3 sm_107 TP4 op in its GEMV tables (every projection up to 8 rows, no (split, ring) override) and cells, and runs this ...
ops/attention/m31_index_score.py minimax_m3_nvfp4__sm_103__tp4/ops/attention/m3_index_score.py copied from Kept separate: it runs the index scorer copy in kernels/m3_index_score (the M3.1 targets');
ops/attention/m3_fullctx_decode.py minimax_m3_nvfp4__sm_107__tp2/ops/attention/m3_fullctx_decode.py copied from Kept separate: it runs the family kernels/m3_fullctx_decode, compiled for 16 query heads per rank (TP4);
ops/gemm/m3_draft_lowm.py minimax_m3_nvfp4__sm_107__tp4/ops/gemm/m3_draft_lowm.py copied from Kept separate: the M3.1 TP2 / TP4 drafters' low-M GEMM op runs the M3.1 split-K copy (kernels/m3_lowm_splitk);
minimax_m3_1_flash_nvfp4__sm_107__tp8/kernels/mx_gemv/m3_mx_gemv_kernel.py kernels/gemm/m3_mx_gemv_kernel.py kept apart Kept separate (SwiGLU epilogue, own producer)
minimax_m3_1_flash_nvfp4__sm_107__tp8/kernels/m3_layer/phase_producer.py kernels/attention/producer_tp8.py kept apart MV2-EXCEPTION(kernel) (one instruction)
minimax_m3_1_flash_nvfp4__sm_107__tp8/ops/attention/m3_fullctx_decode.py ops/attention/m3_fullctx_decode.py kept apart Kept separate (own 8-head kernel module)
minimax_m3_nvfp4__sm_107__tp8/ops/attention/m3_fullctx_decode.py minimax_m3_nvfp4__sm_107__tp4/ops/attention/m3_fullctx_decode.py kept apart MV2-EXCEPTION(kernel) (both;
minimax_m3_nvfp4__sm_107__tp8/ops/moe/m3_moe_engine.py minimax_m3_nvfp4__sm_107__tp2/ops/moe/m3_moe_engine.py kept apart Kept separate (own engine)
minimax_m3_nvfp4__sm_107__tp8/ops/m3_drafter_attn.py minimax_m3_nvfp4__sm_107__tp4/ops/m3_drafter_attn.py kept apart MV2-EXCEPTION(kernel) (TP width in an op name)
minimax_m3_nvfp4__sm_107__tp8/ops/gemm/m3_mx_gemv.py minimax_m3_nvfp4__sm_107__tp2/ops/gemm/m3_mx_gemv.py kept apart Kept separate (shapes, own host module)
minimax_m3_nvfp4__sm_107__tp8/ops/gemm/m3_mx_gemv_bf16.py minimax_m3_nvfp4__sm_107__tp2/ops/gemm/m3_mx_gemv_bf16.py kept apart MV2-EXCEPTION(kernel) (served rows)

Test Coverage

  • Unit tests: tests/unittest/_torch/modeling_v2/models/minimax_m3/ (whole tree on GB300 and VR200, results above).
  • Accuracy tests: tests/integration/defs/accuracy/modeling_v2/minimax_m3/ (all 11 ModelCores, results above).
  • CPU checks: tests/unittest/_torch/modeling_v2/test_modeling_v2_ci_selection.py and test_modeling_v2_contracts.py pass; ruff check and ruff format --check are clean on the changed files.

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.

  • PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.

  • Test cases are provided for new code paths (see test instructions)

  • If PR introduces API changes, an appropriate PR label is added - either api-compatible or api-breaking. For api-breaking, include BREAKING in the PR title.

  • Any new dependencies have been scanned for license and vulnerabilities

  • CODEOWNERS updated if ownership changes

  • Documentation updated as needed

  • Update tava architecture diagram if there is a significant design change in PR.

  • The reviewers assigned automatically/manually are appropriate for the PR.

  • Please check this after reviewing the above items as appropriate for this PR.

GitHub Bot Help

To see a list of available CI bot commands, please comment /bot help.

… Modeling V2 code rules

Bring the 11 minimax_m3 ModelCores (M3 sm_103 tp4 / tp8 and sm_107
tp2 / tp4 / tp8; M3.1-Flash sm_107 tp2 / tp4 / tp8 / tp2ctx / dep2ctx /
dep) and the family's shared code in line with the Modeling V2 code rules.

- Routing: each ModelCore has its own check in minimax_m3/deployment.py;
  configurations that would fail at load or on the first step (breakable
  prefill CUDA graph where unsupported, Eagle3 on M3.1) are rejected at
  routing.
- ModelCore switches: the environment switch registry goes from 387
  entries to the 5 kept ones, each documented and read once at load;
  handles and workspaces are built at load; no per-step mode flags.
- Targets and drafters: every ModelCore has Targets whose forward calls
  modules and ops in execution order; the Eagle3 and DSpark drafter steps
  follow the same form; row-count dispatch between kernels moves into ops.
- Ops: direct kernel calls are wrapped in ops with __call__, reference,
  CELLS, is_valid and ARCHS.
- Kernel copies and C++: identical kernel / op copies are merged into the
  family (69 groups to 1); each remaining near-copy states how and why it
  differs. The MiniMax-only C++ moves from cpp/ into the family library
  (csrc/, torch.ops.mv2_minimax_m3); cpp/ keeps the 3 ops shared code calls.
- Unit tests: tests follow their ops to the family; bitwise checks remain
  only for ops without floating-point arithmetic, the others compare with
  the reference within derived tolerances; one CUDA graph test per
  ModelCore replaces the per-op graph tests; architecture skips go through
  one conftest hook.
- Accuracy tests: two cases per ModelCore, acceptance-length floors in
  acceptance_length.yaml, the sm_103 tp4 Eagle3 case pre-merge.
- Dead code: paths no engine reaches are removed (DSpark prebuild paths
  gated on hooks no worker defines, the M3.1 one-model Eagle3 code, native
  ops without callers, cute_dsl_kernels/minimax_m3).

Also fixed: M3.1 tp2ctx failed to load (a logging-only NCCL window probe),
M3.1 tp2 kept every earlier ModelCore alive in _BCG_CORES (now a
WeakValueDictionary), and the NVIDIA#21848 m3_lowm_splitk fix is applied to the
family copy the M3.1 tp2 / tp4 DSpark drafters use.

Signed-off-by: Wanli Jiang <35160485+Wanli-Jiang@users.noreply.github.com>
@Wanli-Jiang

Wanli-Jiang commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator Author

The MV2-EXCEPTION comments in this pull request (100), by layer, with the reason as written. Under the latest code rules these are notes for readers; the exceptions the rules list are allowed without them. Paths of model code are relative to tensorrt_llm/_torch/modeling_v2/models/minimax_m3/; tests: is tests/unittest/_torch/modeling_v2/models/minimax_m3/.

routing (27)

Where Reason
m31_weights.py:730 the tensors a checkpoint holds are known only once its weights are read.
m31_weights.py:745 the tensors a checkpoint holds, and their shapes and dtypes, are known only once its weights are read; a checkpoint that differs from the one this target is written for declines here.
m31_weights.py:941 the tensors a drafter checkpoint holds are known only once its weights are read.
minimax_m3_1_flash_nvfp4__sm_107__dep/engagement.py:89 which implementation a MoE layer runs is what the engine's MoE resolution builds for it (each candidate's can_implement on this GPU and checkpoint), known once the layers exist; the deployment declines here with every refused layer.
minimax_m3_1_flash_nvfp4__sm_107__tp2/modeling.py:3539 the input scales are checkpoint tensors, known only once the weights are read; the kernels take one gate/up input scale, so a checkpoint whose two differ declines here.
minimax_m3_1_flash_nvfp4__sm_107__tp4/modeling.py:2321 the input scales are checkpoint tensors, known only once the weights are read; the kernels take one gate/up input scale, so a checkpoint whose two differ declines here.
minimax_m3_1_flash_nvfp4__sm_107__tp8/modeling.py:1886 the input scales are checkpoint tensors, known only once the weights are read; the kernels take one gate/up input scale, so a checkpoint whose two differ declines here.
minimax_m3_nvfp4__sm_103__tp4/modeling.py:1216 the input scales are checkpoint tensors, known only once the weights are read; the kernels take one gate/up input scale, so a checkpoint whose two differ declines here.
minimax_m3_nvfp4__sm_103__tp4/weights.py:661 the tensors a checkpoint holds are known only once its weights are read.
minimax_m3_nvfp4__sm_103__tp4/weights.py:676 the tensors a checkpoint holds, and their shapes and dtypes, are known only once its weights are read; a checkpoint that differs from the one this target is written for declines here.
minimax_m3_nvfp4__sm_103__tp4/weights.py:867 the tensors a drafter checkpoint holds are known only once its weights are read.
minimax_m3_nvfp4__sm_103__tp8/modeling.py:1183 the input scales are checkpoint tensors, known only once the weights are read; the kernels take one gate/up input scale, so a checkpoint whose two differ declines here.
minimax_m3_nvfp4__sm_103__tp8/weights.py:678 the tensors a checkpoint holds are known only once its weights are read.
minimax_m3_nvfp4__sm_103__tp8/weights.py:693 the tensors a checkpoint holds, and their shapes and dtypes, are known only once its weights are read; a checkpoint that differs from the one this target is written for declines here.
minimax_m3_nvfp4__sm_103__tp8/weights.py:885 the tensors a drafter checkpoint holds are known only once its weights are read.
minimax_m3_nvfp4__sm_107__tp2/modeling.py:1950 the input scales are checkpoint tensors, known only once the weights are read; the kernels take one gate/up input scale, so a checkpoint whose two differ declines here.
minimax_m3_nvfp4__sm_107__tp2/weights.py:661 the tensors a checkpoint holds are known only once its weights are read.
minimax_m3_nvfp4__sm_107__tp2/weights.py:676 the tensors a checkpoint holds, and their shapes and dtypes, are known only once its weights are read; a checkpoint that differs from the one this target is written for declines here.
minimax_m3_nvfp4__sm_107__tp2/weights.py:867 the tensors a drafter checkpoint holds are known only once its weights are read.
minimax_m3_nvfp4__sm_107__tp4/modeling.py:1848 the input scales are checkpoint tensors, known only once the weights are read; the kernels take one gate/up input scale, so a checkpoint whose two differ declines here.
minimax_m3_nvfp4__sm_107__tp4/weights.py:661 the tensors a checkpoint holds are known only once its weights are read.
minimax_m3_nvfp4__sm_107__tp4/weights.py:676 the tensors a checkpoint holds, and their shapes and dtypes, are known only once its weights are read; a checkpoint that differs from the one this target is written for declines here.
minimax_m3_nvfp4__sm_107__tp4/weights.py:867 the tensors a drafter checkpoint holds are known only once its weights are read.
minimax_m3_nvfp4__sm_107__tp8/modeling.py:1736 the input scales are checkpoint tensors, known only once the weights are read; the kernels take one gate/up input scale, so a checkpoint whose two differ declines here.
minimax_m3_nvfp4__sm_107__tp8/weights.py:678 the tensors a checkpoint holds are known only once its weights are read.
minimax_m3_nvfp4__sm_107__tp8/weights.py:693 the tensors a checkpoint holds, and their shapes and dtypes, are known only once its weights are read; a checkpoint that differs from the one this target is written for declines here.
minimax_m3_nvfp4__sm_107__tp8/weights.py:886 the tensors a drafter checkpoint holds are known only once its weights are read.

modelcore (7)

Where Reason
minimax_m3_1_flash_nvfp4__sm_107__dep2ctx/modeling.py:1156 decided at the first eager call, once the backend's quant state exists, and kept; no later call checks again (the flag is cleared). That call can be a serving step: with a guided decoder, the autotuner off and a compiled prefill, the warmup runs no eager routed-experts call.
minimax_m3_1_flash_nvfp4__sm_107__dep2ctx/modeling.py:1490 the CuTe DSL runners compile for the per-rank head geometry at the first eager step above _CTX_QKV_FUSED_MIN_ROWS outside the autotuner pass, once per process; no later step builds them again. That step can be a serving step: the warmup's long steps can run compiled or inside the autotuner pass.
minimax_m3_1_flash_nvfp4__sm_107__dep2ctx/modeling.py:2108 a band's self-check needs this module's loaded weights on the device and runs at the band's first eager use, once per (N, K, band); later steps read the stored verdict. The warmup's eager steps reach only the bands of their own row counts, so a band's first use can be a serving step.
minimax_m3_1_flash_nvfp4__sm_107__dep2ctx/modeling.py:2983 the cache layout exists only once the engine allocated the caches, after the load (this V1-shaped layer has no cache-manager bind); it is decided once, at the layer's first eager step with the caches, and no later step checks it again (a re-allocation keeps the layout). That step can be a serving step: with a guided decoder, the autotuner off and a compiled prefill, the warmup runs no eager step.
minimax_m3_1_flash_nvfp4__sm_107__tp2ctx/modeling.py:1618 the CuTe DSL runners compile for the per-rank head geometry at the first eager step above _CTX_QKV_FUSED_MIN_ROWS outside the autotuner pass, once per process; no later step builds them again. That step can be a serving step: the warmup's long steps can run compiled or inside the autotuner pass.
minimax_m3_1_flash_nvfp4__sm_107__tp2ctx/modeling.py:1948 a band's self-check needs this module's loaded weights on the device and runs at the band's first eager use, once per (N, K, band); later steps read the stored verdict. The warmup's eager steps reach only the bands of their own row counts, so a band's first use can be a serving step.
minimax_m3_nvfp4__sm_103__tp8/modeling.py:974 max_tiles is the KV cache manager's worst-case block count, known only at the first decode step; that step makes the buffers, every later step and capture only looks them up, and they never change. The first decode step can be a serving step: with a guided decoder and no CUDA graphs, the warmup runs no generation step. A first need inside a capture raises.

target (2)

Where Reason
minimax_m3_1_flash_nvfp4__sm_107__dep2ctx/modeling.py:4155 whether the next boundary takes the parked top-k reduce (DEP2CTX_TOPK_FOLD) is known only after the routed launch: the MegaMoE-local backend decides per launch (its bucket) whether it defers the reduce, and the plane checks read that launch's buffers. It also changes what this layer does next (a capture layer captures the fold's updated residual instead of the MoE output + residual before the stock boundary), so it is not one op's kernel choice. The fold is armed only where the backend can defer (fixed at load); on the default backend nothing is ever parked.
minimax_m3_1_flash_nvfp4__sm_107__dep2ctx/modeling.py:4277 whether the next boundary takes the parked top-k reduce (DEP2CTX_TOPK_FOLD) is known only after the routed launch: the MegaMoE-local backend decides per launch (its bucket) whether it defers the reduce, and the plane checks read that launch's buffers. It also changes what this layer does next (a capture layer captures the fold's updated residual instead of the MoE output + residual before the stock boundary), so it is not one op's kernel choice. The fold is armed only where the backend can defer (fixed at load); on the default backend nothing is ever parked.

kernel (25)

Where Reason
kernels/attention/producer_tp8.py:3 differs from minimax_m3_1_flash_nvfp4__sm_107__tp8/kernels/m3_layer/phase_producer.py only in the reciprocal square root (rsqrt.approx.ftz.f32 here, rsqrt.approx.f32 there: a different result only for a denormal argument); not merged because one instruction for both would change one target's numerics, which this cleanup keeps as they are.
minimax_m3_1_flash_nvfp4__sm_107__tp2/ops/attention/m3_sparse_decode.py:3 same code as minimax_m3_1_flash_nvfp4__sm_107__tp4/ops/attention/m3_sparse_decode.py; not moved to the family because it imports this ModelCore's kernels/triton_sparse_decode (the family decode bound to this target's SparseDecodeTarget settings) and ops/attention/m3_sparse_decode_lc, which differ between the M3.1 TP2 and TP4 ModelCores.
minimax_m3_1_flash_nvfp4__sm_107__tp2/ops/gemm/m3_mx_gemv.py:3 differs from minimax_m3_1_flash_nvfp4__sm_107__tp4/ops/gemm/m3_mx_gemv.py only in the projection shape constants (the TP2 per-rank shapes); not merged because it runs this ModelCore's GEMV host module kernels/mx_gemv/op.py (its split / ring table per shape and its compile cache), which differs between the M3.1 TP2 and TP4 ModelCores.
minimax_m3_1_flash_nvfp4__sm_107__tp4/ops/attention/m3_sparse_decode.py:3 same code as minimax_m3_1_flash_nvfp4__sm_107__tp2/ops/attention/m3_sparse_decode.py; not moved to the family because it imports this ModelCore's kernels/triton_sparse_decode (the family decode bound to this target's SparseDecodeTarget settings) and ops/attention/m3_sparse_decode_lc, which differ between the M3.1 TP2 and TP4 ModelCores.
minimax_m3_1_flash_nvfp4__sm_107__tp4/ops/gemm/m3_mx_gemv.py:3 differs from minimax_m3_1_flash_nvfp4__sm_107__tp2/ops/gemm/m3_mx_gemv.py only in the projection shape constants (the TP4 per-rank shapes); not merged because it runs this ModelCore's GEMV host module kernels/mx_gemv/op.py (its split / ring table per shape and its compile cache), which differs between the M3.1 TP2 and TP4 ModelCores.
minimax_m3_1_flash_nvfp4__sm_107__tp8/kernels/long_select.py:3 same code as minimax_m3_nvfp4__sm_107__tp8/ops/long_select.py except where the select ops come from (here this ModelCore's own ops/attention/m3_select_long and m3_select_long_dsl; there the family's TP2-build ops, which differ from these); not moved to the family because the two ModelCores' select ops differ.
minimax_m3_1_flash_nvfp4__sm_107__tp8/kernels/m3_layer/phase_producer.py:3 differs from kernels/attention/producer_tp8.py (the M3 TP8 producer) only in the reciprocal square root (rsqrt.approx.f32 here, rsqrt.approx.ftz.f32 there: a different result only for a denormal argument); not merged because one instruction for both would change one target's numerics, which this cleanup keeps as they are.
minimax_m3_nvfp4__sm_103__tp4/ops/attention/m3_sparse_decode.py:3 same code as minimax_m3_nvfp4__sm_103__tp8/ops/attention/m3_sparse_decode.py except the module its reference imports (m3_sparse_decode_lc / _lc8) and the head count in its note; not moved to the family because it imports this ModelCore's ops/triton_sparse_decode and ops/attention/m3_sparse_decode_lc (16 query heads per rank), which differ between the ModelCores.
minimax_m3_nvfp4__sm_103__tp4/ops/gemm/m3_mx_gemv.py:3 differs from minimax_m3_nvfp4__sm_107__tp4/ops/gemm/m3_mx_gemv.py only in ARCHS; not merged because it runs this ModelCore's GEMV host module ops/mx_gemv/op.py (GB300-measured split / ring per shape, its compile cache) and dequantizes through its own ops/moe/m3_moe_engine, which differ between the ModelCores (sm_103 is tuned separately).
minimax_m3_nvfp4__sm_103__tp4/ops/gemm/m3_mx_gemv_bf16.py:3 differs from minimax_m3_nvfp4__sm_107__tp4/ops/gemm/m3_mx_gemv_bf16.py only in ARCHS; not merged because it runs this ModelCore's GEMV host module ops/mx_gemv/op.py (GB300-measured split / ring per shape, its compile cache) and takes its projection shapes from its own ops/gemm/m3_mx_gemv, which differ between the ModelCores (sm_103 is tuned separately).
minimax_m3_nvfp4__sm_103__tp4/ops/moe/m3_moe16_engine.py:3 differs from minimax_m3_nvfp4__sm_107__tp4/ops/moe/m3_moe16_engine.py only in ARCHS; not merged because it binds this ModelCore's MoE16 engine ops/m3_moe/op16 (its CTA range check and INTER differ between the two) and its ops/moe/m3_moe_engine (sm_103 is tuned separately).
minimax_m3_nvfp4__sm_103__tp8/ops/attention/m3_sparse_decode.py:3 same code as minimax_m3_nvfp4__sm_103__tp4/ops/attention/m3_sparse_decode.py except the module its reference imports and the head count in its note; not moved to the family because it imports this ModelCore's ops/triton_sparse_decode and ops/attention/m3_sparse_decode_lc8 (8 query heads per rank), which differ between the ModelCores.
minimax_m3_nvfp4__sm_107__tp2/ops/comm/m3_boundary_allreduce_norm.py:3 same code as minimax_m3_nvfp4__sm_107__tp8/ops/comm/m3_boundary_allreduce_norm.py except CELLS (this target's boundaries: multicast up to 48 rows, world 2); not moved to the family because it calls this ModelCore's own multicast adapter (..m3_mc_allreduce: the TP2 build of the kernel and its workspaces), which differs between the ModelCores.
minimax_m3_nvfp4__sm_107__tp2/ops/gemm/m3_mx_gemv_bf16.py:3 differs from minimax_m3_nvfp4__sm_107__tp8/ops/gemm/m3_mx_gemv_bf16.py only in the most rows its served cells reach (32 / 8); not merged because it runs this ModelCore's GEMV host module ops/mx_gemv/op.py and projection shapes (ops/gemm/m3_mx_gemv), which differ from the TP8 ones.
minimax_m3_nvfp4__sm_107__tp4/ops/attention/m3_fullctx_decode.py:3 same code as minimax_m3_nvfp4__sm_107__tp8/ops/attention/m3_fullctx_decode.py except the head count in two error messages; not moved to the family because it imports this ModelCore's ops/m3_fullctx_decode (the full-context decode compiled for 16 query heads per rank), which differs between the ModelCores.
minimax_m3_nvfp4__sm_107__tp4/ops/gemm/m3_mx_gemv.py:3 differs from minimax_m3_nvfp4__sm_103__tp4/ops/gemm/m3_mx_gemv.py only in ARCHS; not merged because it runs this ModelCore's GEMV host module ops/mx_gemv/op.py (Rubin-measured split / ring per shape, its compile cache) and dequantizes through its own ops/moe/m3_moe_engine, which differ between the ModelCores (sm_107 is tuned separately).
minimax_m3_nvfp4__sm_107__tp4/ops/gemm/m3_mx_gemv_bf16.py:3 differs from minimax_m3_nvfp4__sm_103__tp4/ops/gemm/m3_mx_gemv_bf16.py only in ARCHS; not merged because it runs this ModelCore's GEMV host module ops/mx_gemv/op.py (Rubin-measured split / ring per shape, its compile cache) and takes its projection shapes from its own ops/gemm/m3_mx_gemv, which differ between the ModelCores (sm_107 is tuned separately).
minimax_m3_nvfp4__sm_107__tp4/ops/m3_drafter_attn.py:3 differs from minimax_m3_nvfp4__sm_107__tp8/ops/m3_drafter_attn.py only in the TP width in the drafter RoPE / FP8-KV op name (minimax_m3_sm107tp4_drafter_rope_fp8_kv) and its error text; not merged because it runs this ModelCore's ops/m3_fullctx_decode (16 query heads per rank), which differs from the TP8 one.
minimax_m3_nvfp4__sm_107__tp4/ops/moe/m3_moe16_engine.py:3 differs from minimax_m3_nvfp4__sm_103__tp4/ops/moe/m3_moe16_engine.py only in ARCHS; not merged because it binds this ModelCore's MoE16 engine ops/m3_moe/op16 (its CTA range check and INTER differ between the two) and its ops/moe/m3_moe_engine (sm_107 is tuned separately).
minimax_m3_nvfp4__sm_107__tp8/ops/attention/m3_fullctx_decode.py:3 same code as minimax_m3_nvfp4__sm_107__tp4/ops/attention/m3_fullctx_decode.py except the head count in two error messages; not moved to the family because it imports this ModelCore's ops/m3_fullctx_decode (the full-context decode compiled for 8 query heads per rank, with its own split-KV merge and MXFP8 hand-off), which differs between the ModelCores.
minimax_m3_nvfp4__sm_107__tp8/ops/comm/m3_boundary_allreduce_norm.py:3 same code as minimax_m3_nvfp4__sm_107__tp2/ops/comm/m3_boundary_allreduce_norm.py except CELLS (this target's generic boundaries: multicast up to 8 rows, worlds 4 and 8); not moved to the family because it calls this ModelCore's own multicast adapter (..m3_mc_allreduce: the TP8 copy of the kernel and its workspaces), which differs between the ModelCores.
minimax_m3_nvfp4__sm_107__tp8/ops/gemm/m3_draft_lowm.py:3 same code as minimax_m3_1_flash_nvfp4__sm_107__tp8/ops/gemm/m3_draft_lowm.py except the split-K kernel module it compiles (the M3 kernels/gemm/m3_lowm_splitk here, that ModelCore's own kernels/m3_lowm_splitk there); not merged because the two split-K kernels differ (see their headers).
minimax_m3_nvfp4__sm_107__tp8/ops/gemm/m3_mx_gemv_bf16.py:3 differs from minimax_m3_nvfp4__sm_107__tp2/ops/gemm/m3_mx_gemv_bf16.py only in the most rows its served cells reach (8 / 32); not merged because it runs this ModelCore's GEMV host module ops/mx_gemv/op.py and projection shapes (ops/gemm/m3_mx_gemv), which differ from the TP2 ones.
minimax_m3_nvfp4__sm_107__tp8/ops/m3_draft_step.py:3 same code as minimax_m3_1_flash_nvfp4__sm_107__tp8/kernels/m3_draft_step.py; not moved to the family because it imports its ModelCore's ../ops/spec/m3_draft_step and m3_shard_accept, which differ between the M3 and M3.1 TP8 ModelCores.
minimax_m3_nvfp4__sm_107__tp8/ops/m3_drafter_attn.py:3 differs from minimax_m3_nvfp4__sm_107__tp4/ops/m3_drafter_attn.py only in the TP width in the drafter RoPE / FP8-KV op name and its error text; not merged because it runs this ModelCore's ops/m3_fullctx_decode (8 query heads per rank), which differs from the TP4 one.

unit-test (39)

Where Reason
tests: minimax_m3_1_flash_nvfp4__sm_107__tp2/comm/test_modeling_v2_m31_ar_prepushed.py:27 multi-rank behaviour that is no single op's: two ranks' Lamport pushes (the stock push loop and the o_proj GEMM epilogue) feeding the prepushed all-reduce + RMSNorm + MXFP8 on one shared workspace
tests: minimax_m3_1_flash_nvfp4__sm_107__tp2/comm/test_modeling_v2_m31_s2_moe_tail.py:24 multi-rank behaviour that is no single op's: the fused MoE tail over two ranks, and its calls alternating with the built-in one-shot all-reduce on one shared Lamport workspace
tests: minimax_m3_1_flash_nvfp4__sm_107__tp2ctx/test_modeling_v2_m31_tp2ctx_gen_finalize_gpu.py:83 ModelCore configuration test: the TEP2 CTX expert shard's runner parts (their layout and MiniMax2 routing) through this target's _gen_finalize, against the runner's own finalize + shared add
tests: minimax_m3_1_flash_nvfp4__sm_107__tp2ctx/test_modeling_v2_m31_tp2ctx_sp_ipc.py:39 ModelCore configuration test: the layout the SP all-gather relies on (one mxfp8_quantize call quantizes each row on its own, so the owned half's bytes are the full step's; the test checks where they land: the half's swizzled scales are the full step's contiguous row-tile block). Same kernel on the same rows: exact.
tests: minimax_m3_1_flash_nvfp4__sm_107__tp2ctx/test_modeling_v2_m31_tp2ctx_sp_ipc.py:108 multi-rank behaviour that is no single op's: the SP exchange's owned-row pushes of two ranks (simulated on one GPU over linked buffers) put each rank's owned bytes of every kind at the peer's offsets (byte copies, compared exactly)
tests: minimax_m3_1_flash_nvfp4__sm_107__tp4/attention/test_modeling_v2_m3_index_score_t2sc.py:170 ModelCore layout test (the target's token-major score store); bit identity with the block-major store is its contract: it does no floating point arithmetic (the same kernel, split and order write the same scores to other addresses), and the selects compare those same floats, so their top-16 tables are exact against the FSEL reference fed the same scores
tests: minimax_m3_1_flash_nvfp4__sm_107__tp4/moe/test_modeling_v2_m31_vr_tp4_hoist.py:225 multi-rank behaviour that is no single op's (in _NO_CI_STAGE); the TP4WC_HOIST block on 4 ranks: residual_out against the fp64 all-reduce of the o_proj partials + residual_mid, normed2 against its RMSNorm, the published routes
tests: minimax_m3_1_flash_nvfp4__sm_107__tp4/moe/test_modeling_v2_m31_vr_tp4_hoist.py:254 multi-rank behaviour that is no single op's (in _NO_CI_STAGE); kept graph test: the block's cross-rank exchange keeps a device-side parity that must advance across replays on all 4 ranks, which no per-op test and no single-rank ModelCore graph test can see. Exact: the replay runs the same kernels on the same inputs and the all-reduce sums the ranks in a fixed order, so a wrong parity (stale or other-slot rows) is the only way bits move.
tests: minimax_m3_1_flash_nvfp4__sm_107__tp4/moe/test_modeling_v2_m31_vr_tp4_hoist.py:281 multi-rank behaviour that is no single op's (in _NO_CI_STAGE); a rank 3 s late must not trip the post's rx deadline (the reference block's 2 s trap). Exact: the same kernels on the same inputs, the ranks summed in a fixed order, so the late call's bits are the on-time call's unless a slot was dropped or read early.
tests: minimax_m3_1_flash_nvfp4__sm_107__tp8/comm/test_modeling_v2_m3_mc_allreduce_norm_op_matrix.py:30 behavior across ranks and ops that no op's reference test covers: the exchange's per-CTA parities advance across eager calls and graph replays on every rank at once (two boundaries in one graph), the Eagle3 capture norm written in the boundary, the target's bucket wrappers and the guards (each comparison's tolerance is derived in the launcher) Spawns one rank process per device of the world size; under xdist workers would fight for them.
tests: minimax_m3_nvfp4__sm_103__tp4/comm/test_modeling_v2_m3_allreduce.py:24 behavior of two ops across ranks, which no op's reference test covers: the draft loop's boundary (m3_allreduce, then the fused add + RMSNorm) under every all-reduce strategy, against an fp64 reference
tests: minimax_m3_nvfp4__sm_103__tp4/spec/test_modeling_v2_m3_exact_numerics.py:110 bit identity with the in-tree greedy acceptance (torch.argmax of the gathered logits, then the strict prefix match) is this op's contract: it does no floating point arithmetic (it widens the given BF16 logits exactly to fp32, compares them as order-preserving integer keys, exchanges the keys and matches token ids). Both sides read the same BF16 logits, so near-ties need no tolerance; exact ties go to the lowest id on both.
tests: minimax_m3_nvfp4__sm_103__tp8/comm/test_modeling_v2_m3_allreduce.py:29 behavior of two ops across ranks, which no op's reference test covers: the draft loop's boundary (m3_allreduce, then the fused add + RMSNorm) under every single-node all-reduce strategy, against an fp64 reference
tests: minimax_m3_nvfp4__sm_103__tp8/spec/test_modeling_v2_m3_exact_numerics.py:110 bit identity with the in-tree greedy acceptance (torch.argmax of the gathered logits, then the strict prefix match) is this op's contract: it does no floating point arithmetic (it widens the given BF16 logits exactly to fp32, compares them as order-preserving integer keys, exchanges the keys and matches token ids). Both sides read the same BF16 logits, so near-ties need no tolerance; exact ties go to the lowest id on both.
tests: minimax_m3_nvfp4__sm_107__tp2/comm/test_modeling_v2_m3_draft_ar_norm.py:31 behavior across ranks of the target's drafter plan, which no op's reference test covers: the 2-rank drafter boundary as the target builds it (multicast or built-in, per row count and strategy), against an fp64 reference of stock Eagle3's Spawns 2 rank processes over the visible devices; under xdist workers would fight for them.
tests: minimax_m3_nvfp4__sm_107__tp2/gemm/test_modeling_v2_m3_pinned_gemm.py:34 ModelCore configuration test: the pinned MXFP8 quantize / GEMM at the tactics this ModelCore fixes (MXFP8_DECODE_QUANT_TACTIC, MXFP8_DECODE_GEMM_TACTIC, through its modeling support state) and its TP2 projection shapes at the decode rows the GEMVs do not serve (not the family ops' own CELLS)
tests: minimax_m3_nvfp4__sm_107__tp2/ops/comm/test_modeling_v2_m3_mc_allreduce_norm_op_matrix.py:25 behavior across ranks that no op's reference test covers: the exchange's parity across graph replays on both ranks, the gate that sees a missing rank, the target's bucket wrappers and the guards
tests: minimax_m3_nvfp4__sm_107__tp2/ops/comm/test_modeling_v2_m3_moe_push_op_matrix.py:27 multi-rank behavior that is not a single op: the MoE engine's push into the 2-rank boundary exchange; bit identity with the unpushed boundary is the push's contract: it does no floating point arithmetic (pure stores of values computed elsewhere: the engine's finalize writes the same BF16 output words with or without the push and also stores each into the exchange slot the unpushed boundary would store it in itself)
tests: minimax_m3_nvfp4__sm_107__tp4/comm/test_modeling_v2_m3_draft_ar_norm.py:31 behavior across ranks of the target's drafter plan, which no op's reference test covers: the 4-rank drafter boundary as the target builds it (multicast or built-in, per row count and strategy), against an fp64 reference of stock Eagle3's Spawns 4 rank processes over the visible devices; under xdist workers would fight for them.
tests: minimax_m3_nvfp4__sm_107__tp4/ops/comm/test_modeling_v2_m3_mc_allreduce_norm_op_matrix.py:22 multi-rank behavior that is not a single op; the target's bucket / option wrappers, the exchange parities across CUDA-graph replays, and the is_valid guards Spawns 4 rank processes over the visible devices; under xdist workers would fight for them.
tests: minimax_m3_nvfp4__sm_107__tp4/spec/test_modeling_v2_m3_exact_numerics.py:112 bit identity with the in-tree greedy acceptance is this op's contract: it does no floating point arithmetic (it selects the maximum of the given BF16 logits, the lowest id on ties, and compares integer tokens); both sides read the same logits, so no near-tie tolerance applies
tests: minimax_m3_nvfp4__sm_107__tp4/spec/test_modeling_v2_m3_fold_tail.py:139 bit identity with slot_scatter + step_gather is this op's contract: it does no floating point arithmetic (it copies integer token, position and length rows between the sampler store and the step)
tests: minimax_m3_nvfp4__sm_107__tp8/attention/test_modeling_v2_m3_identity_selection.py:28 ModelCore configuration test: at this target's geometry (1 index head per rank) a short step stages the identity block table in place of the stock scorer + select_blocks_from_maxscore, which is exact only if the stock selection is that table. Its output is block ids, compared exactly: with at most 16 valid blocks every valid block is selected, so no float tie decides an id (the test also asserts every valid block scores finite).
tests: minimax_m3_nvfp4__sm_107__tp8/attention/test_modeling_v2_m3_sparse_decode.py:387 regression test; an identity step whose LC8 call read q before its grid wait (the route did not pass identity_step) computed wrong, found and fixed in #20623. The fault is in how the route calls the op (its kwargs, spied here), not in an input, so it is not a cell.
tests: minimax_m3_nvfp4__sm_107__tp8/comm/test_distributed_sampled_reference.py:81 multi-rank behavior that is not a single op; the sampled verification across the eight TP8 ranks (shard sampling, exchange, strict acceptance; the module skips at any other MPI world size) against a full-vocabulary CPU oracle, eager and replayed from a CUDA graph on live offsets
tests: minimax_m3_nvfp4__sm_107__tp8/comm/test_modeling_v2_m3_allreduce.py:31 behavior of two ops across ranks, which no op's reference test covers: the fused draft loop's boundaries (m3_allreduce, then the fused add + RMSNorm) against an fp64 reference under every single-node strategy Spawns one rank process per device of the world size; under xdist workers would fight for them.
tests: minimax_m3_nvfp4__sm_107__tp8/gemm/test_modeling_v2_m3_pinned_gemm.py:43 ModelCore configuration test: the family ops m3_mxfp8_pinned_quantize / _gemm at the tactics this ModelCore pins (MXFP8_DECODE_QUANT_TACTIC, MXFP8_DECODE_GEMM_TACTIC) and its per-rank projection shapes at the decode rows the GEMVs do not serve; the family tests drive the ops' own CELLS
tests: minimax_m3_nvfp4__sm_107__tp8/ops/comm/test_modeling_v2_m3_mc_allreduce_norm_op_matrix.py:35 behavior across ranks that no op's reference test covers: CUDA-graph replays on fresh inputs (the per-CTA exchange parity must advance across replays on every rank), the Eagle3 capture norm written in the boundary, the target's bucket wrappers and the guards Spawns one rank process per device of the world size; under xdist workers would fight for them.
tests: minimax_m3_nvfp4__sm_107__tp8/spec/test_modeling_v2_m3_fold_tail.py:138 bit identity with the sampler's slot_scatter then the engine's step_gather is this op's contract: it does no floating point arithmetic (integer copies of token ids and lengths, and kv_off = lens - T)
tests: minimax_m3_nvfp4__sm_107__tp8/spec/test_modeling_v2_m3_fold_tail.py:233 bit identity with the one-CTA-per-row fold-tail kernel is this op's contract: it does no floating point arithmetic (the in-kernel one-warp form the drafter's last draft_step pass runs writes the same integer copies)
tests: msa/test_minimax_m3_prefill_select.py:165 bit identity with select_blocks_from_maxscore is this op's contract: it does no floating point arithmetic (a top-16 index selection comparing the same fp32 scores, ties to the smaller block)
tests: msa/test_minimax_m3_prefill_select.py:180 bit identity with select_blocks_from_maxscore is this op's contract: it does no floating point arithmetic (a top-16 index selection comparing the same fp32 scores, ties to the smaller block)
tests: msa/test_minimax_m3_prefill_select.py:244 bit identity with the stock select path is this path's contract: it does no floating point arithmetic of its own (the same proxy kernel and plan score both paths; they differ in the score buffer's pre-fill and in a top-16 selection comparing the same scores)
tests: msa/test_minimax_m3_prefill_select.py:389 bit identity of the CSR with sparse.build_k2q_csr is this path's contract: it does no floating point arithmetic (an integer key-to-query CSR and work schedule)
tests: ops/attention/test_modeling_v2_m3_select_long_dsl_tp2build.py:104 bit identity with the 1024-thread m3_select_long is this op's contract: it does no floating point arithmetic (an integer top-16 ranking of the scores' bit patterns into block ids); here on both score layouts the scorer can hand over, which the cells do not vary
tests: ops/attention/test_modeling_v2_m3_select_long_sm103.py:102 bit identity with the in-tree minimax_m3_select_blocks (the op the target falls back to) is this op's contract: it does no floating point arithmetic (an index selection by comparing the given scores) -- except on rows where more than 1024 blocks tie at the 16th-largest score: there the in-tree op does not break the tie to the smallest blocks, while this op and the reference do.
tests: ops/comm/test_modeling_v2_m3_mc_allreduce_norm_sm103.py:36 behavior across ranks that no op's reference test covers: the exchange's per-CTA parities across CUDA-graph replays on fresh inputs on every rank, the targets' bucket wrappers (ops/m3_mc_allreduce) and the guards
tests: test_m31_tile_select.py:132 bit identity with the built-in minimax_m3_select_blocks is this op's contract: it does no floating point arithmetic (a top-16 index selection ranking the ordered integer key of the score bits, ties to the smaller block)
tests: test_m31_tile_select.py:219 bit identity with the head-major tile kernel and the built-in minimax_m3_select_blocks is this op's contract: it does no floating point arithmetic (the same top-16 index selection by the ordered integer key of the score bits, read through a row-major view)

Source properties the family's CMakeLists.txt sets with
set_source_files_properties (e.g. COMPILE_OPTIONS) apply to shared
and target sources alike.
and target sources alike. A .cu source's MODELING_V2_ARCHS property

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to update building cmake here?

…ting declines, test layout

- M3 sm_107 tp2 and tp4: the projection's choice between the engine
  MXFP8 GEMM and the decode GEMV by execution mode moves from the module
  into the m3_projection op, as in M3 sm_103 tp4. The kernels each step
  runs are the same (per-step kernel sequences compared before and after;
  greedy tokens identical).
- M3.1 tp8: routing declines a breakable prefill CUDA graph, and the two
  checks that raised in its Targets are deleted.
- Unit tests: regression cases become cells of their op's CELLS where they
  are inputs; one family-level copy of the sm_103 select-long and
  multicast all-reduce + RMSNorm tests replaces the per-ModelCore copies;
  a capture option joins its op's CELLS and reference; tests that run no
  kernel become CPU tests; tests no CI stage can run are registered in
  _NO_CI_STAGE; two msa sm_103 tests are listed in an sm_103 stage.
- MV2-EXCEPTION comments that mark no exception under the code rules are
  removed or reworded (142 to 100).

Signed-off-by: Wanli Jiang <35160485+Wanli-Jiang@users.noreply.github.com>

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