You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ONNX function-expanded reference decomposition of the Attention op fails at runtime with a TensorShape::SizeFromDimension underflow (a shape dimension computed as -1, surfaced as the unsigned value 18446744073709551615 = SIZE_MAX). It is currently masked by a skip added in PR #28754 and should be removed once the underlying bug is fixed.
This was unmasked by the ONNX 1.22 / opset-27 integration. Note: the ONNX-domain Attention op itself (opset 23/24) was not changed by the opset-27 bump — the bump simply enabled running the expanded reference for these node tests.
Both are ONNX backend node-model tests run via onnx_backend_test_series.py on the CPU EP.
Observed error
Non-zero status code returned while running Add node. Name:''
onnxruntime/core/framework/tensor_shape.cc:77
int64_t onnxruntime::TensorShape::SizeFromDimension(size_t) const
dimension <= num_dims was false.
Invalid dimension of 18446744073709551615 for SizeFromDimension. Tensor has 2 dimensions.
First seen on the webgpu / build-and-test (arm64, arm64, Release) leg (macOS-arm64 build, onnxruntime_USE_WEBGPU=ON), run 27243073719.
Root cause (current understanding)
The failure is in the EXPANDED (ONNX function-decomposed reference) Attention graph, not the native fused Attention kernel.
A shape dimension is computed as -1 somewhere downstream of the bias Add in the expanded decomposition and then passed into SizeFromDimension, where the unsigned underflow trips the dimension <= num_dims enforce in core/framework/tensor_shape.cc:73.
The _poison variant (identical graph, -inf mask values swapped in) fails identically, so the -inf/softcap mask values are not the trigger — it is the shape flow of the expanded decomposition. Prime suspect: the bias-Add → softmax shape handling path.
The native fused Attention kernel passes on every architecture (test_attention_4d_softcap_neginf_mask and _poison, without _expanded).
The CPU EP passes these expanded tests on x64 and Linux-arm64, and the ONNX ReferenceEvaluator passes them — the failure only reproduces on the macOS-arm64-webgpu build.
Production inference uses the fused kernel; the expanded decomposition is a conformance-reference artifact. So there is no known user-facing regression — but the underflow is a genuine latent correctness/robustness bug worth root-causing.
Current mitigation (to be removed when fixed)
Skipped via the global current_failing_tests list in onnxruntime/test/testdata/onnx_backend_test_series_filters.jsonc (lines 43–44), added in commit 027820e7e6 on PR #28754:
Summary
The ONNX function-expanded reference decomposition of the
Attentionop fails at runtime with aTensorShape::SizeFromDimensionunderflow (a shape dimension computed as-1, surfaced as the unsigned value18446744073709551615=SIZE_MAX). It is currently masked by a skip added in PR #28754 and should be removed once the underlying bug is fixed.This was unmasked by the ONNX 1.22 / opset-27 integration. Note: the ONNX-domain
Attentionop itself (opset 23/24) was not changed by the opset-27 bump — the bump simply enabled running the expanded reference for these node tests.Failing tests
test_attention_4d_softcap_neginf_mask_expanded_cputest_attention_4d_softcap_neginf_mask_poison_expanded_cpuBoth are ONNX backend node-model tests run via
onnx_backend_test_series.pyon the CPU EP.Observed error
First seen on the
webgpu / build-and-test (arm64, arm64, Release)leg (macOS-arm64 build,onnxruntime_USE_WEBGPU=ON), run 27243073719.Root cause (current understanding)
-1somewhere downstream of the biasAddin the expanded decomposition and then passed intoSizeFromDimension, where the unsigned underflow trips thedimension <= num_dimsenforce incore/framework/tensor_shape.cc:73._poisonvariant (identical graph,-infmask values swapped in) fails identically, so the-inf/softcap mask values are not the trigger — it is the shape flow of the expanded decomposition. Prime suspect: the bias-Add → softmax shape handling path.Why it is NOT user-facing today
Attentionkernel passes on every architecture (test_attention_4d_softcap_neginf_maskand_poison, without_expanded).Current mitigation (to be removed when fixed)
Skipped via the global
current_failing_testslist inonnxruntime/test/testdata/onnx_backend_test_series_filters.jsonc(lines 43–44), added in commit027820e7e6on PR #28754:Action when fixed: remove these two skip entries and confirm the tests pass on macOS-arm64-webgpu.
Repro
--use_webgpuon macOS-arm64 Release (or reproduce the expanded reference graph on the affected build).onnx_backend_test_series.pyfiltering totest_attention_4d_softcap_neginf_mask_expanded_cpu.SizeFromDimensionSIZE_MAX error at theAddnode.References
027820e7e6onnxruntime/core/framework/tensor_shape.cc:73(SizeFromDimension)webgpu / build-and-test (arm64, arm64, Release))