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
4c6675c4
Unverified
Commit
4c6675c4
authored
Jun 25, 2025
by
valarLip
Committed by
GitHub
Jun 25, 2025
Browse files
enable aiter fp8 blockscale quant (#7520)
parent
e21aa1df
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
python/sglang/srt/layers/quantization/fp8_utils.py
python/sglang/srt/layers/quantization/fp8_utils.py
+5
-4
No files found.
python/sglang/srt/layers/quantization/fp8_utils.py
View file @
4c6675c4
...
@@ -42,7 +42,10 @@ _is_fp8_fnuz = is_fp8_fnuz()
...
@@ -42,7 +42,10 @@ _is_fp8_fnuz = is_fp8_fnuz()
_use_aiter
=
get_bool_env_var
(
"SGLANG_USE_AITER"
)
and
_is_hip
_use_aiter
=
get_bool_env_var
(
"SGLANG_USE_AITER"
)
and
_is_hip
if
_use_aiter
:
if
_use_aiter
:
from
aiter
import
gemm_a8w8_blockscale_CK
import
aiter
from
aiter
import
gemm_a8w8_blockscale_CK
,
get_hip_quant
aiter_per1x128_quant
=
get_hip_quant
(
aiter
.
QuantType
.
per_1x128
)
if
_is_cuda
:
if
_is_cuda
:
from
sgl_kernel
import
fp8_blockwise_scaled_mm
,
fp8_scaled_mm
from
sgl_kernel
import
fp8_blockwise_scaled_mm
,
fp8_scaled_mm
...
@@ -271,9 +274,7 @@ def aiter_w8a8_block_fp8_linear(
...
@@ -271,9 +274,7 @@ def aiter_w8a8_block_fp8_linear(
input_2d
=
input
.
view
(
-
1
,
input
.
shape
[
-
1
])
input_2d
=
input
.
view
(
-
1
,
input
.
shape
[
-
1
])
output_shape
=
[
*
input
.
shape
[:
-
1
],
weight
.
shape
[
0
]]
output_shape
=
[
*
input
.
shape
[:
-
1
],
weight
.
shape
[
0
]]
q_input
,
x_scale
=
per_token_group_quant_fp8
(
q_input
,
x_scale
=
aiter_per1x128_quant
(
input_2d
,
quant_dtype
=
aiter
.
dtypes
.
fp8
)
input_2d
,
block_size
[
1
],
column_major_scales
=
False
)
output
=
gemm_a8w8_blockscale_CK
(
output
=
gemm_a8w8_blockscale_CK
(
q_input
,
weight
,
x_scale
,
weight_scale
,
dtype
=
input
.
dtype
q_input
,
weight
,
x_scale
,
weight_scale
,
dtype
=
input
.
dtype
)
)
...
...
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