Skip to content

Commit cd86cce

Browse files
improve JIT extension failure diagnostics for CI flakiness
1 parent 2e8c549 commit cd86cce

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

gptqmodel/utils/cpp.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import logging
1010
import math
1111
import os
12+
import platform
1213
import shutil
1314
import subprocess
1415
import sys
@@ -928,7 +929,30 @@ def load(self) -> bool:
928929
elapsed = time.perf_counter() - started
929930
self._load_attempted = True
930931
self._load_result = False
931-
self._last_error = f"{self.display_name}: failed to build torch.ops JIT extension: {exc}"
932+
diagnostic_lines = [
933+
f"{self.display_name}: failed to build torch.ops JIT extension: {exc}",
934+
f"build_root={build_root}",
935+
f"base_build_root={base_build_root}",
936+
f"python={platform.python_version()}",
937+
f"pid={os.getpid()}",
938+
f"TORCH_EXTENSIONS_DIR={os.getenv('TORCH_EXTENSIONS_DIR', '')}",
939+
f"GPTQMODEL_TORCH_EXTENSIONS_DIR={os.getenv('GPTQMODEL_TORCH_EXTENSIONS_DIR', '')}",
940+
]
941+
candidate_paths = self._candidate_binary_paths(build_root)
942+
if candidate_paths:
943+
diagnostic_lines.append(
944+
"candidate_binaries="
945+
+ ", ".join(f"{path}:{'exists' if path.exists() else 'missing'}" for path in candidate_paths)
946+
)
947+
try:
948+
entries = sorted(build_root.iterdir())
949+
preview = ", ".join(entry.name for entry in entries[:24])
950+
if len(entries) > 24:
951+
preview += f", ... (+{len(entries) - 24} more)"
952+
diagnostic_lines.append(f"build_root_entries=[{preview}]")
953+
except OSError as snapshot_exc:
954+
diagnostic_lines.append(f"build_root_entries=<unavailable: {snapshot_exc}>")
955+
self._last_error = " | ".join(diagnostic_lines)
932956
log.debug("%s", self._last_error, exc_info=True)
933957
logger.info(
934958
f"{self.display_name}: torch.ops JIT compilation failed "

0 commit comments

Comments
 (0)