Skip to content

[WS1][CUDA][MiniMax-H3] token_refiner_block: two refiner blocks over the strict operator rows (RFC #420 stack 4/7) - #570

Merged
maxiaosong1124 merged 33 commits into
RL-Align:test-h3from
fusheng-ji:feat/h3-token-refiner
Nov 5, 2026
Merged

maxiaosong1124 merged 33 commits into
RL-Align:test-h3from
fusheng-ji:feat/h3-token-refiner

Conversation

@fusheng-ji

@fusheng-ji fusheng-ji commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

RFC #420 stack 4/7 (base test-h3, merge bottom-up): #483 → #484 → #485 → #486 → #487 → #488 → #489 → #493 → #494 → #586 → #587 → #588 → {#567, #568} → {#569, #570 (on #568)} → #571 (on #570) → #574 → #575. This PR sits on #568; until the lower PRs merge, GitHub also shows their commits. This PR's own diff.

Evidence location: the measurement outputs of this PR (JSON, figures) are not part of its diff. They are on the fork's pr_assets branch under pending/h3-token-refiner/ (links in this description are fixed to that commit). Paths such as reports/experiments/... below name where a runner writes its output.

What

Depends on #568 (projection rows) and, through it, #586 → #587 → #588 (the foundation).

  • The text-stream refiner (token_refiner.blocks.0/1, 14 nodes each, no AdaLN, no RoPE, then final_norm) as a node graph in h3_refiner.py, with forward and backward,
    provider and FP64 golden replays, and the same per-node comparison harness as the transformer block.
  • The row owns the two residual adds (FP32 add, one rounding). Every other node is bound to an existing row (h3_rmsnorm, h3_qkv_gemm) or stays interim for rows
    other contributors own (attention, SwiGLU, O / gate_up / down).
  • Operator trace gets a token_refiner stage; h3_weights.load_h3_tensors reads real tensors from the sharded checkpoint.
  • The node vocabulary equals fingerprint.REFINER_NODES (checked by a test).

Prior art & reuse decision

diffusers MiniMaxH3TokenRefiner is the reference graph; vLLM-Omni reuses its generic block, so there is no separate fused implementation to adopt. No new kernel is written here.
Decision: compose existing rows; do not re-implement attention or the FFN GEMMs.

Results (H100 / Hopper)

Hopper pytest summary: tests.json (132 collected, 132 passed @ 6de320dc, H100 sm90).

Hopper test gate (PR head 6de320dc): test_h3_token_refiner.py and the stacked files in Tests below — 132/132 pass on H100 per tests.json (including test_nodes_accuracy_repeat_batch_and_isolated[1-257] / swiglu). The six-case chained bound matrix is swiglu_tolerance_matrix.json (candidate ~0.0121 at block 1 / 257 tokens; provider chain matches on H100).

Measured on NVIDIA H100 (93 GiB, sm90), driver 580, CUDA 13.0, torch 2.13.0+cu130, pinned MiniMax-H3@42ed227 weights, at head 17d0e9e9 (forward path unchanged, numbers not re-measured). Real block-0 weights, one block, forward.

Tokens RL-Kernel graph Provider Ratio Output error vs FP64 (RL-Kernel) (provider)
12 3.68 ms 0.54 ms 6.8x 2.92e-03 2.92e-03
257 8.49 ms 0.62 ms 13.7x 5.72e-03 5.72e-03
925 32.28 ms 1.42 ms 22.8x 6.65e-03 6.65e-03

refiner accuracy and performance

Numbers: report.json. Repeat and batch invariance hold at every node. The first node that differs from the
provider is the attention node. The time gap is almost entirely the interim bindings of rows other contributors own; the nodes this PR and the projection rows add are within about 2x of the provider.

Results (B200 / Blackwell) — supplementary, not Hopper acceptance

Measured on NVIDIA B200 (179 GiB, sm100), driver 580.126, CUDA 13.0, torch 2.13.0+cu130, pinned MiniMax-H3@42ed227 weights, clean tree at 6de320dc.

One test fails on B200. test_h3_token_refiner.py::test_nodes_accuracy_repeat_batch_and_isolated[1-257] (block 1, 257 tokens), at the swiglu node: the candidate chain's relative error against the FP64 golden is 0.01211 and the bound is 1.25 x provider + 1e-3 = 0.01116, with the provider at 0.00816. Result of the test file: 131 passed, 1 failed (132 collected); tests.json. The bound was not changed. On H100 the same case passes (candidate and provider chains both 0.012117; the six-case matrix is swiglu_tolerance_matrix.json).

What a diagnostic on the B200 showed (separate runs, not part of the result above):

  • The candidate's swiglu error is the same on both devices (0.01211 on B200, 0.012117 on H100); what differs is the provider chain (0.00816 on B200, 0.012117 on H100), which lowers the bound.
  • The swiglu kernel is not less accurate than the provider: given the same input its error equals the provider's (0.00816), and on random BF16 input against FP64 it is more accurate (0.0017 against 0.0024) because it rounds once after FP32 math where the provider rounds twice.
  • The test compares chained graphs, so a node's error includes everything upstream. In this case ffn_gate_up is equal for both chains (0.00818) and swiglu is 0.01211 (candidate) against 0.00816 (provider). The direction is not systematic: block 0 with 257 tokens has the candidate below the provider (0.00829 against 0.01081) on the same device.

Forward time of one refiner block (report.json):

tokens candidate ms provider ms ratio
12 2.19 0.23 9.4x
257 4.88 0.34 14.3x
925 23.37 0.69 33.7x

token refiner on B200: accuracy per node and forward time

Repeat and batch invariance hold in every case (first_repeat_drift and first_batch_drift are none); the first difference from the provider is the interim attention node, as on H100.

Status

Hopper (merge gate): graph vocabulary pinned to the fingerprint; forward and backward on real weights; repeat/batch invariance on H100; refiner pytest 132/132 pass on H100 at head 6de320dc.

B200 (supplementary): 131/132 pytest pass; one chained-graph swiglu bound fail (provider chain lower than on H100, not a worse candidate kernel — see swiglu_tolerance_matrix.json). No bound was widened; not treated as blocking Hopper review.

History

Tests

python -m pytest tests/models/minimax_h3/test_h3_token_refiner.py tests/models/minimax_h3/test_h3_operator_trace.py \
    tests/models/minimax_h3/test_h3_arch_fingerprint.py tests/models/minimax_h3/test_h3_projection_rows.py \
    tests/models/minimax_h3/test_h3_one_block.py -q                                                    # 126 passed

B200: same files, 131 passed, 1 failed (see Results (B200 / Blackwell)).

Measured on the synced branches (2 × NVIDIA RTX PRO 6000 Blackwell, sm120, pinned MiniMax-H3@42ed227 weights incl. block 0, each build compiled in place from the checked-out commit):

Commit Command Default build, passed / skipped / failed
672c1b36 (#575, the top of this chain, contains this PR) pytest tests/models/minimax_h3 1046 / 38 / 0
672c1b36 pytest tests/models/minimax_h3 tests/build tests/runtime/test_dispatch.py tests/validation 1611 / 45 / 7 (4 failures needed the block-0 weights file, which was not installed in that run and is now; the other 3 are the known baseline failures)

Skips are environment only: no matplotlib, diffusers or sglang; tests that need 4 or 8 GPUs (2 were visible); no full-transformer shard index; no VERL_OMNI_PATH. The KERNEL_ALIGN_USE_FAST_MATH=1 build was not run on these heads. The per-device results under Results were measured at the heads named there, before this sync.

H100 (sm90) on the synced head e2db5d42 (evidence: tests.json, environment header and the raw pytest logs). H100-94GB, driver 580.173.02, CUDA 13.0, torch 2.13.0+cu130, triton 3.7.1, Python 3.12, pinned MiniMax-H3@42ed227 weights incl. block 0, 4 GPUs visible, extension built in place from this commit:

Build Command passed / skipped / failed
default pytest tests/models/minimax_h3 tests/build tests/runtime/test_dispatch.py tests/validation 1566 / 6 / 1 (of 1573)
KERNEL_ALIGN_USE_FAST_MATH=1 same 960 / 611 / 2 (of 1573)
default the per-PR test files listed above 132 passed

The one default-build failure is tests/validation/operators/test_ws1_candidate_evidence.py::test_ws1_cuda_and_triton_candidate_runtime_provenance: it asks for the strict SM90 GEMM and this build was made without KERNEL_ALIGN_DET_GEMM_SM90=1 ("refusing naive fallback"). It fails the same way on the other test machine and is not an H3 test. The fast-math build has the same failure plus TestCuda::test_unsupported_device_is_refused_at_construction in tests/models/minimax_h3/test_h3_final_adaln_out.py (#489): with the H3 kernels excluded, the op constructor raises "rl_engine._C lacks the h3_det_linear_* / h3_rmsnorm_* ops" before the SM80 check the test expects. Default-build skips (6): the 8-GPU cases (4 GPUs here), sglang not installed, ROCm-only, CI-only extension enforcement, and the SM90 log-prob backend not compiled; fast-math skips (611) are the H3 kernel tests the build leaves out.

Scope / Known limitations

Evidence priority: maintainers reviewing RFC #420 on CUDA should use H100 sections and JSON under pr_assets@ed888b31. B200 numbers document sm100 behaviour only.

Strict mode is fail-closed: no TF32, no fast-math, no split-K; FP32 accumulation with one final rounding; unsupported shapes, dtypes and devices raise instead of falling back. Not part of this PR: video projections (#562), O / gate_up / down GEMMs (#554, #535), full attention (#553), ROCm, SGLang adapter, pipeline parallel. Replacing the interim bindings is tracked by those rows.

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

This review ran on the open-source allowance, not this organization's plan, because the pull request author doesn't have an assigned seat. Waiting won't change this — ask an organization admin to assign them a seat, or add seats in Billing if every seat is already assigned, then retry.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between fc6e29d and adc8117.

Files selected for processing: 20

  • docs/operators/README.md
  • docs/operators/h3-operator-trace.md
  • docs/operators/h3-projection-rows.md
  • docs/operators/h3-token-refiner.md
  • rl_engine/backends/cuda/model_specific/minimax_h3/projection.py
  • rl_engine/backends/shared/triton/gemm/h3_projection.py
  • rl_engine/models/minimax_h3/operator_trace.py
  • rl_engine/reference/minimax_h3/projection.py
  • rl_engine/runtime/registry.py
  • rl_engine/validation/models/h3_block.py
  • rl_engine/validation/models/h3_refiner.py
  • rl_engine/validation/models/h3_weights.py
  • tests/models/minimax_h3/test_h3_one_block.py
  • tests/models/minimax_h3/test_h3_operator_trace.py
  • tests/models/minimax_h3/test_h3_projection_rows.py
  • tests/models/minimax_h3/test_h3_token_refiner.py
  • tools/validation/models/h3_operator_trace.py
  • tools/validation/models/h3_projection_bench.py
  • tools/validation/models/h3_projection_charts.py
  • tools/validation/models/h3_refiner_report.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

fusheng-ji and others added 15 commits October 22, 2026 22:54
…fixed-order Triton GEMM

Signed-off-by: Wenbo Ji <[email protected]>
(cherry picked from commit 650e2148c6f0e5dcdef136537e0e62f745020273)
Signed-off-by: Wenbo Ji <[email protected]>
(cherry picked from commit d099c0b)
Signed-off-by: Wenbo Ji <[email protected]>
(cherry picked from commit b41f868)
…il-closed test instead of a skip

Signed-off-by: Wenbo Ji <[email protected]>
(cherry picked from commit 74e5b83)
…l keys

Review finding (RL-Align#568): jointly permuting x and g changed dW/dbias because the token axis
was reduced in call order. All projection ops (audio in/out, text context, Q/K/V) now take an
optional logical_keys [T,2|3] (negative first column = padding); rows are reduced in ascending
key order with padding dropped, active keys must be unique. Key format follows RL-Align#562.
Adds the reviewer's repro plus permutation/padding tests for every row and Q/K/V.

Co-authored-by: Yitao Wang <[email protected]>
Signed-off-by: Wenbo Ji <[email protected]>
(cherry picked from commit d2941f0)
…ready ordered rows

Follows the canonical-row design of RL-Align#562: the Q/K/V node of the block graph supplies
(batch row, position) keys so its dW is reduced in logical order, and rows that already arrive in
canonical order are reduced in place (same bytes, no gather of x and g).

Co-authored-by: Yitao Wang <[email protected]>
Signed-off-by: Wenbo Ji <[email protected]>
(cherry picked from commit 0da0583)
Signed-off-by: Wenbo Ji <[email protected]>
(cherry picked from commit eaba5efe3df971ea9d1a969f53e48f09e09ed176)
Signed-off-by: Wenbo Ji <[email protected]>
(cherry picked from commit 7da0574)
Signed-off-by: Wenbo Ji <[email protected]>
(cherry picked from commit b45190d08fc033c7e63ad821d3918eb32dd454f6)
Signed-off-by: Wenbo Ji <[email protected]>
(cherry picked from commit b5536d6)
Signed-off-by: Wenbo Ji <[email protected]>
(cherry picked from commit ad1925045b522772bf56f8468b23cca47f04156b)
Signed-off-by: Wenbo Ji <[email protected]>
(cherry picked from commit f9041e8)
Signed-off-by: Wenbo Ji <[email protected]>
(cherry picked from commit b44540e)
…ody)

Signed-off-by: Wenbo Ji <[email protected]>
(cherry picked from commit eab901b)
… weight loader, tests, doc

Signed-off-by: Wenbo Ji <[email protected]>
(cherry picked from commit d12a6bb26566fae58a309e76916af9aae767d487)
Signed-off-by: Wenbo Ji <[email protected]>
(cherry picked from commit b316869)
Signed-off-by: Wenbo Ji <[email protected]>
(cherry picked from commit 1e3a2ea)
Signed-off-by: Wenbo Ji <[email protected]>
(cherry picked from commit 67af796)
@fusheng-ji
fusheng-ji force-pushed the feat/h3-token-refiner branch from 67af796 to 6de320d Compare October 22, 2026 21:04
fusheng-ji added a commit to fusheng-ji/RL-Kernel that referenced this pull request Oct 22, 2026
…#570

Add a sanitized JSON replay of all six accuracy-test swiglu nodes on Hopper,
with a cross-device reference to the B200 block=1/257 bound failure.
fusheng-ji added a commit to fusheng-ji/RL-Kernel that referenced this pull request Oct 23, 2026
…#567 RL-Align#568 RL-Align#570 RL-Align#571 RL-Align#574 RL-Align#575

Test summaries (tests.json), runner outputs and figures measured on NVIDIA B200 (sm100),
driver 580, CUDA 13.0, torch 2.13.0+cu130, MiniMax-H3@42ed227, clean trees at the PR heads
eab901b, 3cf51bf, 6de320d, eb7840b, af3dcae and 4f7c5d1. Figures use B200 axis labels.
No host names, paths or scheduler identifiers.

Signed-off-by: Wenbo Ji <[email protected]>
fusheng-ji added a commit to fusheng-ji/RL-Kernel that referenced this pull request Oct 29, 2026
@fusheng-ji fusheng-ji changed the title [WS1][CUDA][MiniMax-H3] token_refiner_block: two refiner blocks over the strict operator rows (RFC #420 stack 4/5) [WS1][CUDA][MiniMax-H3] token_refiner_block: two refiner blocks over the strict operator rows (RFC #420 stack 14/17) Oct 30, 2026
@fusheng-ji fusheng-ji changed the title [WS1][CUDA][MiniMax-H3] token_refiner_block: two refiner blocks over the strict operator rows (RFC #420 stack 14/17) [WS1][CUDA][MiniMax-H3] token_refiner_block: two refiner blocks over the strict operator rows (RFC #420 stack 4/7) Oct 30, 2026
fusheng-ji added a commit to fusheng-ji/RL-Kernel that referenced this pull request Oct 30, 2026
@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

🔍 OpenCodeReview found 5 issue(s) in this PR.

  • ✅ Successfully posted inline: 1 comment(s)
  • 📋 Routed to summary by policy: 4 comment(s)

⚠️ 4 warning(s) occurred during review.


bug · medium

📄 tests/models/minimax_h3/test_h3_projection_rows.py (L188-L193)

⚠️ GitHub could not post this as an inline comment: Routed to summary (severity medium · category bug)

The TF32 guard uses torch.backends.cuda.matmul.flags(...), which is not a PyTorch API (the real knob is the boolean torch.backends.cuda.matmul.allow_tf32, as used everywhere else in this repo). hasattr is therefore always False, _noop() wins, and the provider runs with whatever ambient matmul precision is set. The reference _NativeProjection.forward explicitly documents "run with TF32 disabled on CUDA" and leaves that to the caller, and other tests in this suite (test_h3_review_fixes.py, test_attention.py) deliberately exercise a "hostile ambient" TF32 state. If TF32 is enabled, _rel(provider, golden) inflates and the acceptance bound 1.25 * _rel(provider, golden) + _floor becomes loose enough that a kernel far less accurate than IEEE FP32 passes — a false pass. The two pinned-checkpoint tests below (test_forward_on_pinned_checkpoint_weights / test_qkv_on_pinned_checkpoint_weights) use bare F.linear with no guard at all. Disable TF32 explicitly (save/restore) around every provider call.

💡 Suggested Change

Before:

    with (
        torch.backends.cuda.matmul.flags(allow_tf32=False)
        if hasattr(torch.backends.cuda.matmul, "flags")
        else _noop()
    ):
        provider = native.forward(x, w, b)

After:

    prev_tf32 = torch.backends.cuda.matmul.allow_tf32
    torch.backends.cuda.matmul.allow_tf32 = False
    try:
        provider = native.forward(x, w, b)
    finally:
        torch.backends.cuda.matmul.allow_tf32 = prev_tf32

bug · medium

📄 tools/validation/models/h3_projection_bench.py (L78-L81)

⚠️ GitHub could not post this as an inline comment: Routed to summary (severity medium · category bug)

For h3_qkv_gemm, cand() and prov() each return three tensors (Q, K, V), but the code keeps only element [0] and builds gold from ws[0]. The relative error for the K and V projections is never computed or written to the JSON report, even though the record is labelled h3_qkv_gemm. A regression in the K/V path (or in the fused-weight layout) would pass this validation tool silently. Compute/store the relative error for all three projections.


documentation · low

📄 tools/validation/models/h3_projection_bench.py (L9-L9)

⚠️ GitHub could not post this as an inline comment: Routed to summary (severity low · category documentation)

The docstring advertises "median forward and forward+backward milliseconds", but the code only times the forward-only lambdas cand/prov; no .backward() is ever invoked and the report has no backward timing fields. The emitted report misrepresents what was actually measured. Either implement the forward+backward timing or correct the docstring/field expectations.


bug · medium

📄 rl_engine/backends/cuda/model_specific/minimax_h3/projection.py (L94-L96)

⚠️ GitHub could not post this as an inline comment: Routed to summary (severity medium · category bug)

When every row carries a negative first logical-key component (a fully masked/padding batch), canonical_row_order returns an empty order (all rows dropped). _weight_grads then gathers to 0 rows and calls gemm.linear_backward_weight, which forwards to gemm(...) where k == 0 (reduction over an empty token axis for dW, and k == 0 for the grad @ ones bias term) and raises ValueError("h3 projection GEMM needs non-empty operands"). The documented contract is that padding rows are dropped from parameter gradients, so an all-padding batch should yield zero dW/db, not a crash in backward. Short-circuit the empty-active-rows case to zero gradients.

💡 Suggested Change

Before:

    if order is not None:
        grad_out, x = grad_out[order].contiguous(), x[order].contiguous()
    return gemm.linear_backward_weight(grad_out, x, with_bias=with_bias)

After:

    if order is not None:
        grad_out, x = grad_out[order].contiguous(), x[order].contiguous()
        if grad_out.shape[0] == 0:  # every row is padding: gradients are zero, not a crash
            dweight = torch.zeros(grad_out.shape[1], x.shape[1], device=x.device, dtype=x.dtype)
            dbias = (
                torch.zeros(grad_out.shape[1], device=x.device, dtype=x.dtype)
                if with_bias
                else None
            )
            return dweight, dbias
    return gemm.linear_backward_weight(grad_out, x, with_bias=with_bias)

⚠️ Warnings:

  • tests/models/minimax_h3/test_h3_projection_rows.py (token_budget_reached): skipped round 2 of group "tests/models/minimax_h3/test_h3_projection_rows.py,tools/validation/models/h3_projection_bench.py,tools/validation/models/h3_projection_charts.py": used 617272 tokens exceeds budget 500000
  • rl_engine/validation/models/h3_block.py (token_budget_reached): stopped dispatch: used 617272 tokens + group estimate 202032 = projected 819304 exceeds budget 500000
  • rl_engine/backends/cuda/model_specific/minimax_h3/projection.py,rl_engine/backends/shared/triton/gemm/h3_projection.py,rl_engine/reference/minimax_h3/projection.py,rl_engine/runtime/registry.py (review_limit_reached): reached the aggregate token budget before finishing; the grace round did not complete the task
  • rl_engine/models/minimax_h3/operator_trace.py,tests/models/minimax_h3/test_h3_operator_trace.py,tools/validation/models/h3_operator_trace.py (review_limit_reached): reached the aggregate token budget before finishing; the grace round did not complete the task

@@ -0,0 +1,2346 @@
{
"status": "frozen_ensemble_rule",
"rule": "relative_l2 <= k * max over provider configurations + floor; max_abs reported",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

bug · high
The declared rule references a floor that is never recorded in this file, and the stored bounds actually use two different implicit floors. Verifying every entry against factor_k = 2.6:

  • forward node outputs use floor = 0.001: nodes.block.0 0.007637028339181236 × 2.6 + 0.001 = 0.020856273681871214 ✓; nodes.audio_proj_in 0.0 × 2.6 + 0.001 = 0.001 ✓; nodes.time_embedder 0.0 → 0.001 ✓
  • gradients / parameters use floor = 0.005: nodes.block.0.grad 0.8528404577370075 × 2.6 + 0.005 = 2.2223851901162193 ✓; parameter.norm_out.norm.weight 0.011882855956542197 × 2.6 + 0.005 = 0.03589542548700971 ✓; input_gradients.audio_hidden_states 0.20277222521992394 × 2.6 + 0.005 = 0.5322077855718023 ✓

So a consumer that reconstructs a bound from factor_k alone, or that assumes a single global floor, will disagree with bounds_relative_l2 on essentially every entry (nodes.block.* and any 0-valued forward node are off by 0.001; every .grad/parameter.*/input_gradients.* entry is off by 0.005), and the reconstructed check will accept/reject the wrong values. The floors must be recorded explicitly (and the rule string updated) so the frozen artifact is self-describing.

Suggestion:

Suggested change
"rule": "relative_l2 <= k * max over provider configurations + floor; max_abs reported",
"rule": "relative_l2 <= k * max over provider configurations + floor; max_abs reported",
"floor_forward": 0.001,
"floor_gradient": 0.005,

@github-actions

Copy link
Copy Markdown

@fusheng-ji The automated OCR review has completed.

Please review and address all automated review bot findings, then push your updates. Maintainers will begin manual review after the bot findings have been addressed.

@maxiaosong1124

Copy link
Copy Markdown
Collaborator

please resolve conflicts first ,thx! @fusheng-ji

…o feat/h3-projection-rows

Signed-off-by: Wenbo Ji <[email protected]>
RL-Align#588) into feat/h3-token-refiner

operator_trace.py and h3-operator-trace.md: take the merged RL-Align#567 version and reapply this branch's refiner stage on top.

Signed-off-by: Wenbo Ji <[email protected]>
record_node filled the accumulator in from the row contract, and
trace_call_from_resolution and the default split policy did the same, so a
trace from block_observer always passed those checks: a run that
accumulated in BF16 or used split-K would still verify as strict.

They are now recorded only when the caller supplies them; an unset value is
"not observed" and violations reports it. block_observer only learns the
node name, so it also records the fallback state as not observed (None).
violations(require_observed=False) and verify --allow-unobserved check the
bindings alone, by explicit request; such a trace is not strict evidence.

Reported by OpenCodeReview on RL-Align#567 after it merged.

Signed-off-by: Wenbo Ji <[email protected]>
topology: Mapping[str, Any] = field(default_factory=dict) # e.g. {"tp": 4, "cp": 2, "sp": True}
shapes: tuple[tuple[int, ...], ...] = () # input shapes, when known
fallback: bool = False # True if any fallback path was taken
fallback: bool | None = False # True if any fallback path was taken; None: not observed

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

bug · high
The type now admits None ("nobody observed it"), but the constructor default is still False. OperatorCall instances created without an explicit fallback — e.g. record_node(path, status=..., backend=...) in the new tests, direct OperatorCall(...) construction, or a loads/from_dict path that omits falsy fields — therefore assert "no fallback taken" even though no operator reported anything. violations() then skips the fallback not observed branch, so the strict gate passes on an unobserved state, which is exactly what the change is meant to prevent. Make the unobserved state the default so only an explicit report can claim False:

    fallback: bool | None = None  # True if any fallback path was taken; None: not observed

and confirm to_dict/loads round-trips None distinctly from False (otherwise a replayed trace silently claims an observed no-fallback).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in #699, commit ff395298.

  • Default: OperatorCall.fallback now defaults to None (not observed). Only an explicit report can claim False, and record_node records fallback only if it is given.
  • Strict gate: an unrecorded fallback now fails violations() with "fallback not observed".
  • Round trip: None survives dumps / loads as distinct from False. A dict written without the field reads back as None.

The assertions are in test_h3_operator_trace.py.

@maxiaosong1124
maxiaosong1124 merged commit 644da96 into RL-Align:test-h3 Nov 5, 2026
6 checks passed
fusheng-ji added a commit to fusheng-ji/RL-Kernel that referenced this pull request Nov 6, 2026
Flink-ddd added a commit that referenced this pull request Nov 16, 2026
[WS1][CUDA][MiniMax-H3] Review follow-up for #568 / #570 / #571 / #574 and the strict full-model backward session (RFC #420 follow-up 1/3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

MiniMax-H3 new-model platform: cuda Specific optimizations or bugs in NVIDIA graphics cards (such as FlashInfer, TMA optimizations) WS1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants