Skip to content

Add SimplifiedLayerNormToRMSNorm surgery#2348

Open
unnim-qti wants to merge 4 commits intomicrosoft:mainfrom
CodeLinaro:dev/unnim-qti/qnn-gpu-simplifiedlayernorm-to-rmsnorm-surgery
Open

Add SimplifiedLayerNormToRMSNorm surgery#2348
unnim-qti wants to merge 4 commits intomicrosoft:mainfrom
CodeLinaro:dev/unnim-qti/qnn-gpu-simplifiedlayernorm-to-rmsnorm-surgery

Conversation

@unnim-qti
Copy link
Copy Markdown

@unnim-qti unnim-qti commented Mar 5, 2026

Describe your changes

Checklist before requesting a review

  • Add unit tests for this change.
  • Make sure all tests can pass.
  • Update documents if necessary.
  • Lint and apply fixes to your code by running lintrunner -a
  • Is this a user-facing change? If yes, give a description of this change to be included in the release notes.

(Optional) Issue link

Comment thread olive/passes/onnx/graph_surgeries.py
@xiaoyu-work
Copy link
Copy Markdown
Collaborator

@unnim-qti can you please update this PR? We are going to release new Olive version this Friday and this PR will be included

@unnim-qti unnim-qti force-pushed the dev/unnim-qti/qnn-gpu-simplifiedlayernorm-to-rmsnorm-surgery branch from 63ebd29 to bd06441 Compare April 12, 2026 20:55
@justinchuby
Copy link
Copy Markdown
Contributor

Why not make this a rewrite rule, out of curiosity?

@unnim-qti
Copy link
Copy Markdown
Author

Why not make this a rewrite rule, out of curiosity?

I considered a rewrite rule, but this transform isn’t purely structural.

  • It has opset‑dependent ReduceMean semantics, handles two operator variants and requires conditional rewiring of an optional second output with ValueInfo preservation, which is cumbersome to express in a pattern rewrite.
  • A ProtoSurgeon was therefore a cleaner and safer fit.

@justinchuby
Copy link
Copy Markdown
Contributor

Handling value infos and optional output handling should be straightforward with the onnxscript rewriter. I wonder if you saw any blockers?

@unnim-qti
Copy link
Copy Markdown
Author

unnim-qti commented Apr 23, 2026

I didn’t see any hard blockers in the rewriter, but I followed the existing pattern SimplifiedLayerNormToL2Norm, which use ProtoSurgeon to handle variant‑specific wiring, and optional outputs explicitly. Given that precedent and the comparable complexity here, I kept this transform in the ProtoSurgeon style for the consistency.

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.

4 participants