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
18c27131
Unverified
Commit
18c27131
authored
Mar 13, 2025
by
yiakwy-xpu-ml-framework-team
Committed by
GitHub
Mar 12, 2025
Browse files
[tools] add fp8 max/min constant in utils (#3959)
parent
ccdd10c8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
python/sglang/srt/utils.py
python/sglang/srt/utils.py
+14
-0
No files found.
python/sglang/srt/utils.py
View file @
18c27131
...
...
@@ -14,6 +14,7 @@
"""Common utilities."""
import
base64
import
builtins
import
ctypes
import
dataclasses
import
io
...
...
@@ -72,12 +73,25 @@ logger = logging.getLogger(__name__)
show_time_cost
=
False
time_infos
=
{}
HIP_FP8_E4M3_FNUZ_MAX
=
224.0
# https://pytorch.org/docs/stable/notes/hip.html#checking-for-hip
def
is_hip
()
->
bool
:
return
torch
.
version
.
hip
is
not
None
if
is_hip
():
FP8_E4M3_MAX
=
HIP_FP8_E4M3_FNUZ_MAX
else
:
FP8_E4M3_MAX
=
torch
.
finfo
(
torch
.
float8_e4m3fn
).
max
FP8_E4M3_MIN
=
-
FP8_E4M3_MAX
builtins
.
FP8_E4M3_MAX
=
FP8_E4M3_MAX
builtins
.
FP8_E4M3_MIN
=
FP8_E4M3_MIN
def
is_rocm
()
->
bool
:
return
torch
.
cuda
.
is_available
()
and
torch
.
version
.
hip
...
...
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