Commit 8700af6
Fix audio encoder SkipSimplifiedLayerNormalization CUDA crash
ORT fuses Add(output_proj.bias) + RMSNormalization into
SkipSimplifiedLayerNormalization, placing the 1D bias as the 'skip'
input. ORT's CUDA kernel rejects 1D skip (requires 2D+), while the
CPU kernel accepts it.
This fusion was enabled by PR #253 which changed _Gemma4ScaleFreeRMSNorm
from manual primitive ops to op.RMSNormalization(stash_type=1). The
RMSNormalization op is recognized by ORT's SkipLayerNorm fusion pattern.
Fix: inline manual RMSNorm ops in _Gemma4AudioEncoderModel.forward()
for the pre_projection_norm, preventing ORT from recognizing the fusion
pattern. This preserves the FP32 accumulation for numerical stability.
Tested: audio encoder runs on CUDA with correct output (standalone ORT
and GenAI at 117 tok/s).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Justin Chu <justinchu@microsoft.com>1 parent 90385c6 commit 8700af6
2 files changed
Lines changed: 21 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
784 | 784 | | |
785 | 785 | | |
786 | 786 | | |
787 | | - | |
788 | | - | |
789 | | - | |
790 | | - | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
791 | 793 | | |
792 | 794 | | |
793 | 795 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1970 | 1970 | | |
1971 | 1971 | | |
1972 | 1972 | | |
1973 | | - | |
| 1973 | + | |
| 1974 | + | |
| 1975 | + | |
| 1976 | + | |
1974 | 1977 | | |
1975 | 1978 | | |
1976 | 1979 | | |
| |||
1985 | 1988 | | |
1986 | 1989 | | |
1987 | 1990 | | |
1988 | | - | |
1989 | | - | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
1990 | 2002 | | |
1991 | 2003 | | |
1992 | 2004 | | |
| |||
0 commit comments