Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SkipLayerNorm fusion in transformer optimizer #17320

Merged
merged 2 commits into from
Aug 31, 2023
Merged

Conversation

tianleiwu
Copy link
Contributor

@tianleiwu tianleiwu commented Aug 28, 2023

Description

Fix issues:
(1) When the output of Add before LayerNormalization node is a graph output, we shall output it in SkipLayerNormalization, but currently not.
(2) When there is Cast before Add bias, the Cast output (instead of input) shall be used as SkipLayerNormalization input.
(3) The skip input is not at the second input of fused node. According to op spec, skip shall be the second. It could bring issue when we add skip broadcasting support later.

Motivation and Context

Fusion for Clip model of SDXL failed since the last hidden state is a graph output.

@tianleiwu tianleiwu marked this pull request as draft August 29, 2023 16:02
@tianleiwu tianleiwu marked this pull request as ready for review August 30, 2023 01:41
@tianleiwu tianleiwu merged commit c11ed06 into main Aug 31, 2023
93 of 95 checks passed
@tianleiwu tianleiwu deleted the tlwu/fix_sln_fusion branch August 31, 2023 04:12
@natke natke added the triage:approved Approved for cherrypicks for release label Sep 1, 2023
er3x3 pushed a commit that referenced this pull request Sep 1, 2023
### Description
Fix issues:
(1) When the output of Add before LayerNormalization node is a graph
output, we shall output it in SkipLayerNormalization, but currently not.
(2) When there is Cast before Add bias, the Cast output (instead of
input) shall be used as SkipLayerNormalization input.
(3) The skip input is not at the second input of fused node. According
to op spec, skip shall be the second. It could bring issue when we add
skip broadcasting support later.

### Motivation and Context

Fusion for Clip model of SDXL failed since the last hidden state is a
graph output.
snnn pushed a commit that referenced this pull request Sep 7, 2023
Cherry-pick 2nd round for 1.16.0 release.
PR List:

#17201
#17270
#17311
#17315
#17320
#17326
#17355
#17227
#17380
#17386
kleiti pushed a commit to kleiti/onnxruntime that referenced this pull request Mar 22, 2024
### Description
Fix issues:
(1) When the output of Add before LayerNormalization node is a graph
output, we shall output it in SkipLayerNormalization, but currently not.
(2) When there is Cast before Add bias, the Cast output (instead of
input) shall be used as SkipLayerNormalization input.
(3) The skip input is not at the second input of fused node. According
to op spec, skip shall be the second. It could bring issue when we add
skip broadcasting support later.

### Motivation and Context

Fusion for Clip model of SDXL failed since the last hidden state is a
graph output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage:approved Approved for cherrypicks for release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants