fix gemm segfault
print exit signals on validation failure
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import shlex
|
||||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
@@ -8,6 +10,37 @@ from colorama import Style, Fore
|
||||
from validate_one import ProgressReporter, clean_workspace_artifacts, validate_network
|
||||
|
||||
|
||||
def format_command(cmd):
|
||||
if isinstance(cmd, (list, tuple)):
|
||||
return shlex.join(str(arg) for arg in cmd)
|
||||
return str(cmd)
|
||||
|
||||
|
||||
def format_return_status(returncode):
|
||||
if returncode < 0:
|
||||
signal_num = -returncode
|
||||
try:
|
||||
signal_name = signal.Signals(signal_num).name
|
||||
except ValueError:
|
||||
signal_name = "UNKNOWN"
|
||||
return f"Program terminated by signal {signal_name} ({signal_num})."
|
||||
return f"Program exited with code {returncode}."
|
||||
|
||||
|
||||
def print_validation_error(reporter, rel, exc):
|
||||
reporter.suspend()
|
||||
print(Style.BRIGHT + Fore.RED + f"Exception while validating {rel}" + Style.RESET_ALL,
|
||||
file=sys.stderr, flush=True)
|
||||
if isinstance(exc, subprocess.CalledProcessError):
|
||||
print(format_return_status(exc.returncode), file=sys.stderr, flush=True)
|
||||
print("Retry command:", file=sys.stderr, flush=True)
|
||||
print(format_command(exc.cmd), file=sys.stderr, flush=True)
|
||||
else:
|
||||
print(f"{type(exc).__name__}: {exc}", file=sys.stderr, flush=True)
|
||||
print("=" * 72, file=sys.stderr, flush=True)
|
||||
reporter.resume()
|
||||
|
||||
|
||||
def main():
|
||||
ap = argparse.ArgumentParser(description="Validate all ONNX operations under the operations/ directory.")
|
||||
ap.add_argument("--raptor-path", help="Path to the Raptor compiler binary.")
|
||||
@@ -70,8 +103,12 @@ def main():
|
||||
model_total=len(onnx_files),
|
||||
)
|
||||
results[str(rel)] = passed
|
||||
except (subprocess.CalledProcessError, Exception):
|
||||
except subprocess.CalledProcessError as exc:
|
||||
results[str(rel)] = False
|
||||
print_validation_error(reporter, rel, exc)
|
||||
except Exception as exc:
|
||||
results[str(rel)] = False
|
||||
print_validation_error(reporter, rel, exc)
|
||||
|
||||
reporter.finish()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user