Skip to content

Register SimplifiedLayerNormalization to MS domain - #26033

Open
justinchuby wants to merge 12 commits into
mainfrom
justinchu/SimplifiedLayerNormalization
Open

Register SimplifiedLayerNormalization to MS domain#26033
justinchuby wants to merge 12 commits into
mainfrom
justinchu/SimplifiedLayerNormalization

Conversation

@justinchuby

Copy link
Copy Markdown
Contributor

Register SimplifiedLayerNormalization to MS domain. Previously it was incorrectly registered to the ONNX domain, causing onnx models to be invalid.

Fix #7573

Register SimplifiedLayerNormalization to MS domain. Previously it was incorrectly registered to the ONNX domain, causing onnx models to be invalid.
@justinchuby

justinchuby commented Sep 12, 2025

Copy link
Copy Markdown
Contributor Author

There are errors

cuda_contrib_kernels.obj : error LNK2001: unresolved external symbol "struct onnxruntime::KernelCreateInfo __cdecl onnxruntime::contrib::cuda::BuildKernelCreateInfo<class onnxruntime::contrib::cuda::kCudaExecutionProvider_SimplifiedLayerNormalization_kMSDomain_ver1_float_float_float>(void)" (??$BuildKernelCreateInfo@VkCudaExecutionProvider_SimplifiedLayerNormalization_kMSDomain_ver1_float_float_float@cuda@contrib@onnxruntime@@@cuda@contrib@onnxruntime@@YA?AUKernelCreateInfo@2@XZ) [E:\_work\_temp\build\RelWithDebInfo\onnxruntime_providers_cuda.vcxproj]

Is it the way I registered the ops?

Comment thread onnxruntime/contrib_ops/webgpu/webgpu_contrib_kernels.cc Outdated

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can commit the suggested changes from lintrunner.

Comment thread onnxruntime/contrib_ops/js/js_contrib_kernels.cc Outdated
@fs-eire

fs-eire commented Oct 22, 2025

Copy link
Copy Markdown
Contributor

Is there any following up for this PR?

@justinchuby

Copy link
Copy Markdown
Contributor Author

I still want to merge but there’s some build errors I don’t understand. Any pointers you can share?

@fs-eire

fs-eire commented Oct 22, 2025

Copy link
Copy Markdown
Contributor

maybe merge to latest main and check latest error message (if any)? the current code is a little bit out of date

@MaanavD

MaanavD commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

@justinchuby (cleanup) - can we close this issue / unassign me pls :)

@justinchuby

Copy link
Copy Markdown
Contributor Author

@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.

@justinchuby

Copy link
Copy Markdown
Contributor Author

@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>

Copilot AI commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

@copilot please update from main and fix breaking tests.

Updated from main and resolved conflicts in onnxruntime/contrib_ops/webgpu/webgpu_contrib_kernels.cc and onnxruntime/contrib_ops/rocm/rocm_contrib_kernels.cc (ROCm contrib ops were removed entirely on main, so that file is deleted). Verified the CUDA kernel declarations/registrations for SimplifiedLayerNormalization in both kMSDomain and the backward-compat kOnnxDomain are still consistent (15 declarations match 15 registrations).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@justinchuby justinchuby self-assigned this Aug 5, 2026
@justinchuby
justinchuby requested a lite review from Copilot and removed request for MaanavD and jywu-mysoft August 5, 2026 15:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 SimplifiedLayerNormalization kernels for MS domain in CUDA, JS, and WebGPU contrib registries (and keep ONNX-domain registrations for compatibility).
  • Add MS-domain kernel definitions for SimplifiedLayerNormalization in 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>()),                 \

Comment on lines +448 to +452
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)>,
@justinchuby

Copy link
Copy Markdown
Contributor Author

@copilot also npm run build:doc

@tianleiwu

Copy link
Copy Markdown
Contributor

@justinchuby, you can use ort-ci skill to fix the doc gen CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LayerNormalization operator is not in onnx domain

6 participants