[diffusion] fix: fix FA3 varlen out argument handling (#24688)
This commit is contained in:
@@ -148,7 +148,7 @@ jobs:
|
|||||||
- ".github/workflows/pr-test-multimodal-gen.yml"
|
- ".github/workflows/pr-test-multimodal-gen.yml"
|
||||||
- "python/pyproject.toml"
|
- "python/pyproject.toml"
|
||||||
- "python/sglang/multimodal_gen/**/!(*.md|*.ipynb)"
|
- "python/sglang/multimodal_gen/**/!(*.md|*.ipynb)"
|
||||||
- "python/sglang/jit_kernel/diffusion/**"
|
- "python/sglang/jit_kernel/**"
|
||||||
- "python/sglang/jit_kernel/tests/diffusion/**"
|
- "python/sglang/jit_kernel/tests/diffusion/**"
|
||||||
- "python/sglang/jit_kernel/benchmark/diffusion/**"
|
- "python/sglang/jit_kernel/benchmark/diffusion/**"
|
||||||
- "python/sglang/cli/**"
|
- "python/sglang/cli/**"
|
||||||
|
|||||||
@@ -16,15 +16,15 @@ SGL_FA3_KERNEL_REVISION = "v1"
|
|||||||
DEFAULT_FA3_KERNEL_LOCKFILE = "kernels.lock"
|
DEFAULT_FA3_KERNEL_LOCKFILE = "kernels.lock"
|
||||||
|
|
||||||
|
|
||||||
def _call_fa3_kernel(kernel, *args, out=None):
|
def _call_fa3_kernel(kernel, *args, out=None, **kwargs):
|
||||||
if out is None:
|
if out is None:
|
||||||
return kernel(*args)
|
return kernel(*args, **kwargs)
|
||||||
try:
|
try:
|
||||||
return kernel(*args, out=out)
|
return kernel(*args, **kwargs, out=out)
|
||||||
except TypeError as exc:
|
except TypeError as exc:
|
||||||
if "unexpected keyword argument 'out'" not in str(exc):
|
if "unexpected keyword argument 'out'" not in str(exc):
|
||||||
raise
|
raise
|
||||||
return kernel(*args)
|
return kernel(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
@cache_once
|
@cache_once
|
||||||
@@ -212,7 +212,8 @@ def flash_attn_varlen_func(
|
|||||||
"flash_attn at sgl-kernel is only supported on sm90 and above"
|
"flash_attn at sgl-kernel is only supported on sm90 and above"
|
||||||
)
|
)
|
||||||
|
|
||||||
return _load_fa3_kernels()["flash_attn_varlen_func"](
|
return _call_fa3_kernel(
|
||||||
|
_load_fa3_kernels()["flash_attn_varlen_func"],
|
||||||
q=q,
|
q=q,
|
||||||
k=k,
|
k=k,
|
||||||
v=v,
|
v=v,
|
||||||
|
|||||||
Reference in New Issue
Block a user