Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
bc5fc332
Unverified
Commit
bc5fc332
authored
Sep 08, 2025
by
fzyzcjy
Committed by
GitHub
Sep 07, 2025
Browse files
Fix slow fused add RMSNorm (#10141)
parent
f3440adc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
+5
-7
python/sglang/srt/layers/layernorm.py
python/sglang/srt/layers/layernorm.py
+5
-7
No files found.
python/sglang/srt/layers/layernorm.py
View file @
bc5fc332
...
@@ -39,12 +39,8 @@ _is_cpu_amx_available = cpu_has_amx_support()
...
@@ -39,12 +39,8 @@ _is_cpu_amx_available = cpu_has_amx_support()
_is_cpu
=
is_cpu
()
_is_cpu
=
is_cpu
()
if
_is_cuda
:
if
_is_cuda
:
from
sgl_kernel
import
(
from
flashinfer.norm
import
fused_add_rmsnorm
as
flashinfer_fused_add_rmsnorm
fused_add_rmsnorm
,
from
sgl_kernel
import
gemma_fused_add_rmsnorm
,
gemma_rmsnorm
,
rmsnorm
gemma_fused_add_rmsnorm
,
gemma_rmsnorm
,
rmsnorm
,
)
if
_use_aiter
:
if
_use_aiter
:
from
aiter
import
rmsnorm2d_fwd
as
rms_norm
from
aiter
import
rmsnorm2d_fwd
as
rms_norm
...
@@ -86,7 +82,9 @@ class RMSNorm(CustomOp):
...
@@ -86,7 +82,9 @@ class RMSNorm(CustomOp):
if
self
.
variance_size_override
is
not
None
:
if
self
.
variance_size_override
is
not
None
:
return
self
.
forward_native
(
x
,
residual
)
return
self
.
forward_native
(
x
,
residual
)
if
residual
is
not
None
:
if
residual
is
not
None
:
fused_add_rmsnorm
(
x
,
residual
,
self
.
weight
.
data
,
self
.
variance_epsilon
)
flashinfer_fused_add_rmsnorm
(
x
,
residual
,
self
.
weight
.
data
,
self
.
variance_epsilon
)
return
x
,
residual
return
x
,
residual
out
=
rmsnorm
(
x
,
self
.
weight
.
data
,
self
.
variance_epsilon
)
out
=
rmsnorm
(
x
,
self
.
weight
.
data
,
self
.
variance_epsilon
)
return
out
return
out
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment