8000 [BE] Import CUDATemplateCaller non-lazily in select_algorithm.py · pytorch/pytorch@e593dcd · GitHub
[go: up one dir, main page]

Skip to content

Commit e593dcd

Browse files
committed
[BE] Import CUDATemplateCaller non-lazily in select_algorithm.py
Differential Revision: [D74911280](https://our.internmc.facebook.com/intern/diff/D74911280/) [ghstack-poisoned]
1 parent 2896e50 commit e593dcd

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

torch/_inductor/select_algorithm.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from torch._dynamo.device_interface import get_interface_for_device
3030
from torch._dynamo.testing import rand_strided
3131
from torch._dynamo.utils import counters, dynamo_timed, identity, preserve_rng_state
32+
from torch._inductor.codegen.cuda.cuda_kernel import CUDATemplateCaller
3233
from torch._inductor.utils import clear_on_fresh_inductor_cache
3334
from torch.utils._filelock import FileLock
3435
from torch.utils._ordered_set import OrderedSet
@@ -1824,8 +1825,6 @@ def __call__(
18241825
precompilation_timeout_seconds: int = 60 * 60,
18251826
return_multi_template=False,
18261827
):
1827-
from .codegen.cuda.cuda_kernel import CUDATemplateCaller
1828-
18291828
# Templates selected with input_gen_fns require specific input data to avoid IMA
18301829
# Passing custom input gen fns to benchmark_fusion NYI, so skip deferred template selection
18311830
# TODO(jgong5): support multi-template on CPU
@@ -2131,10 +2130,6 @@ def wait_on_futures():
21312130
timeout=precompilation_timeout_seconds,
21322131
):
21332132
if e := future.exception():
2134-
from torch._inductor.codegen.cuda.cuda_kernel import (
2135-
CUDATemplateCaller,
2136-
)
2137-
21382133
if isinstance(e, CUDACompileError) and isinstance(
21392134
futures[future], CUDATemplateCaller
21402135
):
@@ -2253,8 +2248,6 @@ def benchmark_choices(
22532248
try:
22542249
timing = cls.benchmark_choice(choice, autotune_args)
22552250
except CUDACompileError as e:
2256-
from torch._inductor.codegen.cuda.cuda_kernel import CUDATemplateCaller
2257-
22582251
if not isinstance(choice, CUDATemplateCaller):
22592252
log.error(
22602253
"CUDA compilation error during autotuning: \n%s. \nIgnoring this choice.",
@@ -2265,8 +2258,6 @@ def benchmark_choices(
22652258
log.warning("Not yet implemented: %s", e)
22662259
timing = float("inf")
22672260
except RuntimeError as e:
2268-
from torch._inductor.codegen.cuda.cuda_kernel import CUDATemplateCaller
2269-
22702261
if not isinstance(choice, CUDATemplateCaller):
22712262
log.error(
22722263
"CUDA runtime error during autotuning: \n%s. \nIgnoring this choice.",

0 commit comments

Comments
 (0)
0