From d8db41b3b6a53138c42b552131b0051050bc9bc1 Mon Sep 17 00:00:00 2001 From: Stella Laurenzo Date: Sun, 22 Aug 2021 20:26:03 -0700 Subject: [PATCH] Make verbose testing also report compile/trace/run messages. Helped with #287. --- frontends/pytorch/e2e_testing/torchscript/main.py | 5 +++-- .../python/torch_mlir_torchscript/e2e_test/framework.py | 9 ++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/frontends/pytorch/e2e_testing/torchscript/main.py b/frontends/pytorch/e2e_testing/torchscript/main.py index f2dbd0a98..01deb4eb7 100644 --- a/frontends/pytorch/e2e_testing/torchscript/main.py +++ b/frontends/pytorch/e2e_testing/torchscript/main.py @@ -104,10 +104,11 @@ def main(): sys.exit(1) # Run the tests. - results = run_tests(tests, config) + results = run_tests(tests, config, verbose=args.verbose) # Report the test results. - failed = report_results(results, XFAIL_SETS[args.config], args.verbose) + failed = report_results( + results, XFAIL_SETS[args.config], verbose=args.verbose) sys.exit(1 if failed else 0) if __name__ == '__main__': diff --git a/frontends/pytorch/python/torch_mlir_torchscript/e2e_test/framework.py b/frontends/pytorch/python/torch_mlir_torchscript/e2e_test/framework.py index 1c5a25498..2ec6145f8 100644 --- a/frontends/pytorch/python/torch_mlir_torchscript/e2e_test/framework.py +++ b/frontends/pytorch/python/torch_mlir_torchscript/e2e_test/framework.py @@ -284,13 +284,16 @@ def generate_golden_trace(test: Test) -> Trace: return trace -def run_tests(tests: List[Test], config: TestConfig) -> List[TestResult]: +def run_tests(tests: List[Test], config: TestConfig, + verbose=False) -> List[TestResult]: """Invoke the given `Test`'s with the provided `TestConfig`.""" results = [] for test in tests: # TODO: Precompile everything in parallel. try: + print(f"GENERATE TRACE: {test}") golden_trace = generate_golden_trace(test) + print(f"COMPILE: {test}") compiled = config.compile(test.program_factory()) except Exception as e: # Useful for debugging: @@ -307,7 +310,11 @@ def run_tests(tests: List[Test], config: TestConfig) -> List[TestResult]: golden_trace=None)) continue # TODO: Run in parallel. + if verbose: + print(f"RUN: {test}") trace = config.run(compiled, golden_trace) + if verbose: + print(f"FINISHED: {test}") results.append( TestResult(unique_name=test.unique_name, compilation_error=None,