Skip to content

Assertion failure in graph optimizer Level2 after MatmulTransposeFusion on large MoE model #28604

Description

@justinchuby

Repro

Loading a Qwen3.5-MoE (40-layer, 256-expert, MoE with shared expert) bf16 ONNX exported with mobius using --ep cuda --dtype f16 (or bf16) aborts during InferenceSession initialization right after MatmulTransposeFusion finishes.

Symptom

[I:onnxruntime:, graph_transformer.cc:15 Apply] GraphTransformer MatmulTransposeFusion modified: 0 with status: OK
/opt/rh/gcc-toolset-14/root/usr/include/c++/14/bits/stl_vector.h:1130:
  constexpr std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type)
  [... NodeArg* ...]: Assertion '__n < this->size()' failed.
Aborted (core dumped)

Env

  • onnxruntime-gpu 1.27.0.dev20260511001 (CUDA 12)
  • CUDAExecutionProvider on NVIDIA H200
  • Model: Qwen/Qwen3.6-35B-A3B exported via mobius with com.microsoft::GroupQueryAttention, com.microsoft::LinearAttention, com.microsoft::CausalConvWithState
  • 40-layer hybrid (full + linear attention) + 256-expert MoE per layer + shared expert
  • Decoder model: ~64 GB (f16 with weights, 1.6 M nodes)

What I tried

  • disabled_optimizers=['BiasGeluFusion','BiasSoftmaxFusion','BiasDropoutFusion','MatMulScaleFusion','SkipLayerNormFusion','LayerNormFusionL2','QuickGeluFusion','GeluApproximation'] — still aborts after MatmulTransposeFusion.
  • graph_optimization_level=ORT_ENABLE_BASIC avoids the abort but then fails EP placement on CausalConvWithState (needs the function-inlining transformer that only runs at higher levels).

Likely cause

Some Level2 GraphTransformer running between MatmulTransposeFusion and the next logged transformer reads past the end of a node-arg list — probably triggered by the unusual graph shape (10240+ MatMul nodes from per-expert MLPs, hybrid attention).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions