[AOTI] Print out error msg when nvcc compiler fails (#157203)

Summary: To debug https://github.com/pytorch/pytorch/issues/156930. Not able to reproduce the problem locally.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/157203
Approved by: https://github.com/jansel

Co-authored-by: Jason Ansel <jansel@meta.com>
This commit is contained in:
Bin Bao 2025-06-29 08:31:41 -07:00 committed by PyTorch MergeBot
parent 86ced14453
commit 771be85704

View File

@ -2143,9 +2143,19 @@ class AotCodeCompiler:
# Include SASS for the current specific arch
f"-gencode arch=compute_{current_arch},code=sm_{current_arch} "
)
subprocess.run(
cmd.split(), capture_output=True, text=True, check=True
)
try:
subprocess.run(
cmd.split(),
capture_output=True,
text=True,
check=True,
)
except subprocess.CalledProcessError as e:
print(
f"{cmd} failed with:\nstdout:\n{e.stdout}\nstderr:\n{e.stderr}",
file=sys.stderr,
)
raise
if config.aot_inductor.embed_kernel_binary:
# Embed cubin files into model.so using objcopy