[diffusion] improve: improve fuse_scale_shift_kernel with non-blocking op (#18710)

Co-authored-by: Mick <mickjagger19@icloud.com>
This commit is contained in:
Qingfu Wen
2026-02-25 21:04:20 +08:00
committed by GitHub
parent c144e55462
commit 59b9d1e86d

View File

@@ -297,7 +297,10 @@ def fuse_scale_shift_kernel(
# If both scalars and both zero, copy fast-path
if need_scale_scalar and need_shift_scalar:
if (scale_blc.abs().max() == 0) and (shift_blc.abs().max() == 0):
if not (
scale_blc.any().to("cpu", non_blocking=True)
or shift_blc.any().to("cpu", non_blocking=True)
):
output.copy_(x)
return output