[ONNX] Support Mod opset 28 - #32369
Justin Chu (justinchuby) wants to merge 2 commits into
Conversation
Add native CPU and CUDA floor-mod behavior, register DirectML support, and cap uncertified EPs at opset 27 fallback. Cover mixed signs, signed zero, infinities, NaNs, zero divisors, and signed overflow. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
CUDA’s integer fmod=1 path still performs undefined INT_MIN % -1 despite the new overflow hardening.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds ONNX Mod opset 28 semantics while preserving prior behavior and restricting unverified execution providers.
Changes:
- Adds CPU/CUDA floating floor-mod implementations and edge-case tests.
- Splits registrations at opset 28 and updates DirectML support.
- Prevents unsupported providers from claiming Mod-28 nodes.
File summaries
| File | Description |
|---|---|
onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc |
Adds Mod-28 semantic and overflow tests. |
onnxruntime/core/providers/qnn/builder/opbuilder/mod_op_builder.cc |
Rejects Mod-28 partitioning. |
onnxruntime/core/providers/openvino/ov_versions/data_ops.cc |
Excludes Mod-28 nodes. |
onnxruntime/core/providers/migraphx/migraphx_execution_provider.cc |
Excludes Mod-28 nodes. |
onnxruntime/core/providers/dml/OperatorAuthorHelper/OperatorVersions.h |
Defines the Mod-28 version. |
onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/OperatorRegistration.cpp |
Registers DirectML Mod-28. |
onnxruntime/core/providers/cuda/math/binary_elementwise_ops.h |
Tracks Mod-28 floor-mod support. |
onnxruntime/core/providers/cuda/math/binary_elementwise_ops.cc |
Splits registrations and dispatches floating floor-mod. |
onnxruntime/core/providers/cuda/math/binary_elementwise_ops_impl.cu |
Instantiates floating Mod kernels. |
onnxruntime/core/providers/cuda/cuda_execution_provider.cc |
Registers versioned CUDA kernels. |
onnxruntime/core/providers/cuda/cu_inc/common.cuh |
Implements CUDA floor-mod and integer overflow handling. |
onnxruntime/core/providers/cpu/math/element_wise_ops.cc |
Implements CPU Mod-28 semantics. |
onnxruntime/core/providers/cpu/cpu_execution_provider.cc |
Registers versioned CPU kernels. |
onnxruntime/core/providers/cann/cann_graph.cc |
Excludes Mod-28 nodes. |
docs/OperatorKernels.md |
Documents updated registrations. |
Review details
- Files reviewed: 15/15 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Opset 28 is the first Mod spec whose text defines
uint64
To be clear about what I ran: I read the source at head and reproduced the numbers on the 1.23.2 wheel on CPU, where |
Summary
min % -1Stacked on #32359 /
justinchuby-onnx-1-23-opset-28-baseat checkpoint92853202d4cb2bd7b9c20f1ba3abf1427980cf31.Validation
git diff --checkpassedA first-time local
onnxruntime_test_allbuild was stopped after spending about an hour compiling unrelated dependencies; a provider-only compile was also gated on unfinished protobuf-generated headers. No changed-file compiler error was observed. CUDA and provider-specific builds remain for CI.