Skip to content

Commit ba1c3a9

Browse files
committed
display verbose message when build failed.
1 parent e8efee9 commit ba1c3a9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

python/triton/runtime/build.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
import functools
44
import hashlib
55
import importlib.util
6+
import locale
67
import logging
78
import os
89
import shutil
910
import subprocess
11+
import sys
1012
import sysconfig
1113
import tempfile
1214
import re
@@ -16,6 +18,8 @@
1618
from .cache import get_cache_manager
1719
from .. import knobs
1820

21+
_IS_WINDOWS = sys.platform == "win32"
22+
SUBPROCESS_DECODE_ARGS = (locale.getpreferredencoding(),) if _IS_WINDOWS else ()
1923

2024
def is_xpu():
2125
import torch
@@ -106,7 +110,13 @@ def _build(name: str, src: str, srcdir: str, library_dirs: list[str], include_di
106110
if os.getenv("VERBOSE"):
107111
print(" ".join(cc_cmd))
108112

109-
subprocess.check_call(cc_cmd, stdout=subprocess.DEVNULL)
113+
try:
114+
subprocess.run(
115+
cc_cmd, check=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT
116+
)
117+
except Exception as e:
118+
output = e.stdout.decode(*SUBPROCESS_DECODE_ARGS)
119+
raise RuntimeError(output)
110120
return so
111121

112122

0 commit comments

Comments
 (0)