10000 [cutlass backend] Reduce log level for cutlass runtime error · pytorch/pytorch@c94a2f6 · GitHub
[go: up one dir, main page]

Skip to content

Commit c94a2f6

Browse files
committed
[cutlass backend] Reduce log level for cutlass runtime error
Differential Revision: [D74629230](https://our.internmc.facebook.com/intern/diff/D74629230/) ghstack-source-id: 283608237 Pull Request resolved: #153457
1 parent c2e601c commit c94a2f6

File tree

2 files changed

+33
-7
lines changed

2 files changed

+33
-7
lines changed

torch/_inductor/autotune_process.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ def make_run_fn(
721721
workspace_ptr = c_void_p(self.workspace.data_ptr())
722722

723723
# Generate partial function.
724-
return functools.partial(
724+
ret = functools.partial(
725725
run_method,
726726
*args,
727727
*self.extra_args,
@@ -730,6 +730,18 @@ def make_run_fn(
730730
stream_ptr,
731731
)
732732

733+
# sanity check to make sure we cleanup run fn properly
734+
try:
735+
ret()
736+
except RuntimeError as e:
737+
err_msg = str(e)
738+
def dummy_function():
739+
raise RuntimeError(err_msg)
740+
self.cleanup_run_fn()
741+
return dummy_function
742+
743+
return ret
744+
733745
def update_workspace_size(self) -> None:
734746
if self._workspace_size_updated:
735747
return

torch/_inductor/select_algorithm.py

+20-6
Original file line numberDiff line numberDiff line change
@@ -2265,16 +2265,30 @@ def benchmark_choices(
22652265
log.warning("Not yet implemented: %s", e)
22662266
timing = float("inf")
22672267
except RuntimeError as e:
2268+
from torch._inductor.codegen.cuda.cuda_kernel import CUDATemplateCaller
2269+
2270+
if not isinstance(choice, CUDATemplateCaller):
2271+
log.error(
2272+
"CUDA compilation error during autotuning: \n%s. \nIgnoring this choice.",
2273+
e,
2274+
)
22682275
msg = str(e)
22692276
if "invalid argument" in msg:
22702277
msg += "\n\nThis may mean this GPU is too small for max_autotune mode.\n\n"
2278+
elif "illegal memory access" in msg:
2279+
msg += "\n\nEither error in template or triton bug.\n"
2280+
2281+
if isinstance(choice, CUDATemplateCaller):
2282+
log.debug(
2283+
"Runtime error during autotuning: \n%s. \nIgnoring this choice.",
2284+
msg,
2285+
exc_info=True,
2286+
)
22712287
else:
2272-
if "illegal memory access" in msg:
2273-
msg += "\n\nEither error in template or triton bug.\n"
2274-
log.error(
2275-
"Runtime error during autotuning: \n%s. \nIgnoring this choice.",
2276-
msg,
2277-
)
2288+
log.error(
2289+
"Runtime error during autotuning: \n%s. \nIgnoring this choice.",
2290+
msg,
2291+
)
22782292
timing = float("inf")
22792293
except AssertionError as e:
22802294
raise AssertionError( # noqa: B904

0 commit comments

Comments
 (0)
0