[Fix] diffusion: Keep the linear-GELU verdict cache out of torch.compile traces (#45944)
Co-authored-by: Mick Qian <mickqian@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Mick Qian
Claude Opus 5.5
parent
f9129915a3
commit
494eeecb6c
@@ -138,6 +138,9 @@ def can_use_linear_gelu(linear: Any, x: torch.Tensor) -> bool:
|
||||
return False
|
||||
if getattr(linear, "weight", None) is None or x.dtype != linear.weight.dtype:
|
||||
return False
|
||||
if torch.compiler.is_compiling():
|
||||
# dynamo guards on the cache's size, so reading it recompiles per linear
|
||||
return _input_independent_ok(linear)
|
||||
verdict = _VERDICTS.get(linear)
|
||||
if verdict is None:
|
||||
verdict = _VERDICTS[linear] = _input_independent_ok(linear)
|
||||
|
||||
Reference in New Issue
Block a user