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
603f5ce0
Unverified
Commit
603f5ce0
authored
Aug 03, 2025
by
Liangsheng Yin
Committed by
GitHub
Aug 02, 2025
Browse files
[Bug] fix green context's incompatibility with `cuda < 12.4` (#8701)
parent
6d4fd882
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
sgl-kernel/csrc/spatial/greenctx_stream.cu
sgl-kernel/csrc/spatial/greenctx_stream.cu
+17
-0
sgl-kernel/python/sgl_kernel/spatial.py
sgl-kernel/python/sgl_kernel/spatial.py
+5
-0
No files found.
sgl-kernel/csrc/spatial/greenctx_stream.cu
View file @
603f5ce0
...
...
@@ -7,6 +7,8 @@
#include "cuda_utils.h"
#include "greenctx_stream.h"
#if CUDA_VERSION >= 12040
static
std
::
vector
<
int64_t
>
create_greenctx_stream_fallback
(
CUgreenCtx
gctx
[
2
])
{
CUstream
streamA
,
streamB
;
CUcontext
ctx
;
...
...
@@ -94,3 +96,18 @@ std::vector<int64_t> create_greenctx_stream_by_value(int64_t smA, int64_t smB, i
return
vec
;
}
#else
std
::
vector
<
int64_t
>
create_greenctx_stream_by_value
(
int64_t
smA
,
int64_t
smB
,
int64_t
device
)
{
TORCH_CHECK
(
false
,
"Green Contexts feature requires CUDA Toolkit 12.4 or newer. Current CUDA version: "
+
std
::
to_string
(
CUDA_VERSION
));
// This is a stub function that should never be reached
// Return empty vector to satisfy return type requirement
return
{};
}
#endif
sgl-kernel/python/sgl_kernel/spatial.py
View file @
603f5ce0
...
...
@@ -14,6 +14,11 @@ def create_greenctx_stream_by_value(
Returns:
tuple[ExternalStream, ExternalStream]: The two streams.
"""
if
torch
.
version
.
cuda
<
"12.4"
:
raise
RuntimeError
(
"Green Contexts feature requires CUDA Toolkit 12.4 or newer."
)
if
device_id
is
None
:
device_id
=
torch
.
cuda
.
current_device
()
...
...
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