maybe_compile#
- torchspin.maybe_compile(fn=None, **compile_kwargs)[source]#
Conditionally apply
torch.compileto a function.Usage:
@maybe_compile def my_kernel(x: torch.Tensor) -> torch.Tensor: ... # With options: @maybe_compile(mode="reduce-overhead") def my_kernel(x: torch.Tensor) -> torch.Tensor: ...
The decorated function behaves identically to the original when compilation is disabled or unavailable.