Training ScaledSumFusion segfaults when the third term is a graph input
Summary
The CUDA-enabled training ScaledSumFusion segfaults when the third term of a three-input scaled sum is a graph input. The source graph is:
T = Add(Add(Div(A, 2), Div(B, 4)), X)
Y = Neg(T)The source model passes the ONNX checker and runs successfully. Calling the training get_optimized_model API terminates the subprocess with SIGSEGV (returncode=-11). Adding an identity X1=Identity(X) and using X1 in the second Add is an equivalent positive control: the two source models return the same output, and optimization of the control completes and emits ScaledSum.
No GPU is needed to reproduce this preprocessing crash. The published training wheel is CUDA-enabled and registers ScaledSumFusion before provider partitioning.
Reproduce
git clone https://github.com/Yuhx141/graph-optimizer-issue-reproducers.git
cd graph-optimizer-issue-reproducers/onnxruntime/ORT-TRAIN-027
python -m pip install onnx onnxruntime-training==1.19.2
python reproduce.pyExpected final line:
REPRODUCEDExpected result
ScaledSumFusion should accept the documented graph-input/initializer third term without dereferencing a missing producer, or skip the pattern.
Likely cause
The transformer explicitly allows mutable_the_other_input_node == nullptr for a graph input or initializer. In the corresponding non-scale branch it then dereferences that null pointer to obtain MutableInputDefs()[0]:
The existing comment in that branch also says graph inputs and initializers are supported, which matches the reproducer.
I searched the repository issues and PRs for ScaledSumFusion with graph inputs, null producers, training crashes, and segfaults. I found no matching report.
Affected versions
- Dynamically reproduced with the latest published
onnxruntime-trainingwheel, 1.19.2 (ffceed9d44). - The null-producer path is still present in official
mainatb2097437af1184d2c0231fca2f2e6468158494b0.
Environment
- Ubuntu 24.04, x86-64
- Python 3.11
- ONNX 1.22.0
- onnxruntime-training 1.19.2 (CUDA-enabled wheel; CPU-only host is sufficient)
- CPUExecutionProvider for source and control execution
Reproducer
Source: microsoft/onnxruntime