Register SimplifiedLayerNormalization to MS domain - #26033
Conversation
Register SimplifiedLayerNormalization to MS domain. Previously it was incorrectly registered to the ONNX domain, causing onnx models to be invalid.
|
There are errors
Is it the way I registered the ops? |
|
Is there any following up for this PR? |
|
I still want to merge but there’s some build errors I don’t understand. Any pointers you can share? |
|
maybe merge to latest main and check latest error message (if any)? the current code is a little bit out of date |
|
@justinchuby (cleanup) - can we close this issue / unassign me pls :) |
|
@MaanavD can you unsubscribe from the pr for now? The reviewer list doesn't load for me so I am not able to make changes. |
|
@copilot please update from main and fix breaking tests. |
# Conflicts: # onnxruntime/contrib_ops/rocm/rocm_contrib_kernels.cc # onnxruntime/contrib_ops/webgpu/webgpu_contrib_kernels.cc Co-authored-by: justinchuby <11205048+justinchuby@users.noreply.github.com>
Updated from main and resolved conflicts in |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR corrects the operator domain for SimplifiedLayerNormalization so it is registered in the MS contrib domain (kMSDomain) instead of only (incorrectly) being exposed as an ONNX-domain op, while keeping ONNX-domain registrations for backward compatibility with existing (invalid) models.
Changes:
- Register
SimplifiedLayerNormalizationkernels for MS domain in CUDA, JS, and WebGPU contrib registries (and keep ONNX-domain registrations for compatibility). - Add MS-domain kernel definitions for
SimplifiedLayerNormalizationin the JS and WebGPU implementations. - Add CUDA MS-domain kernel registry entries for all supported type combinations.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| onnxruntime/contrib_ops/webgpu/webgpu_contrib_kernels.cc | Adds MS-domain SimplifiedLayerNormalization to the WebGPU contrib kernel table; retains ONNX-domain entry for compatibility. |
| onnxruntime/contrib_ops/webgpu/bert/layer_norm.cc | Adds MS-domain kernel definition for SimplifiedLayerNormalization on WebGPU. |
| onnxruntime/contrib_ops/js/layer_norm.cc | Adds MS-domain kernel definition for SimplifiedLayerNormalization on JS EP. |
| onnxruntime/contrib_ops/js/js_contrib_kernels.cc | Registers MS-domain SimplifiedLayerNormalization in the JS contrib kernel registry. |
| onnxruntime/contrib_ops/cuda/layer_norm.cc | Adds MS-domain typed kernel registrations for SimplifiedLayerNormalization in CUDA. |
| onnxruntime/contrib_ops/cuda/cuda_contrib_kernels.cc | Registers MS-domain typed kernels for SimplifiedLayerNormalization in CUDA contrib kernel registry. |
| onnxruntime/contrib_ops/cpu/layer_norm.cc | Adds MS-domain typed kernel registrations for SimplifiedLayerNormalization in CPU contrib implementation (but registry wiring still needed). |
Suppressed comments (1)
onnxruntime/contrib_ops/cpu/layer_norm.cc:29
- This adds an MS-domain kernel registration for SimplifiedLayerNormalization, but the CPU contrib kernel registry (onnxruntime/contrib_ops/cpu/cpu_contrib_kernels.cc) still only registers the kOnnxDomain versions. As-is, MS-domain SimplifiedLayerNormalization will fail to resolve on CPU (fallback) despite having a kernel implementation here.
Please add the corresponding class declarations and BuildKernelCreateInfo entries for kMSDomain, while keeping the kOnnxDomain entries for backward compatibility.
ONNX_OPERATOR_TYPED_KERNEL_EX(SimplifiedLayerNormalization, kMSDomain, 1, T, kCpuExecutionProvider, \
KernelDefBuilder() \
.TypeConstraint("T", DataTypeImpl::GetTensorType<T>()) \
.TypeConstraint("U", DataTypeImpl::GetTensorType<T>()) \
.TypeConstraint("V", DataTypeImpl::GetTensorType<T>()), \
| BuildKernelCreateInfo<CUDA_MS_OP_TYPED_CLASS_NAME(1, float_float_float, SimplifiedLayerNormalization)>, | ||
| BuildKernelCreateInfo<CUDA_MS_OP_TYPED_CLASS_NAME(1, double_double_double, SimplifiedLayerNormalization)>, | ||
| BuildKernelCreateInfo<CUDA_MS_OP_TYPED_CLASS_NAME(1, MLFloat16_float_MLFloat16, SimplifiedLayerNormalization)>, | ||
| BuildKernelCreateInfo<CUDA_MS_OP_TYPED_CLASS_NAME(1, float_float_MLFloat16, SimplifiedLayerNormalization)>, | ||
| BuildKernelCreateInfo<CUDA_MS_OP_TYPED_CLASS_NAME(1, MLFloat16_float_float, SimplifiedLayerNormalization)>, |
|
@copilot also npm run build:doc |
|
@justinchuby, you can use ort-ci skill to fix the doc gen CI. |
Register SimplifiedLayerNormalization to MS domain. Previously it was incorrectly registered to the ONNX domain, causing onnx models to be invalid.
Fix #7573