Skip to content

Commit eea69a3

Browse files
committed
check-inductor-report.py
1 parent 4a96f07 commit eea69a3

File tree

2 files changed

+67
-1
lines changed

2 files changed

+67
-1
lines changed

.github/workflows/e2e-reusable.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ jobs:
233233
bash -e $GITHUB_WORKSPACE/scripts/inductor_xpu_test.sh ${{ inputs.suite }} ${{ inputs.dtype }} ${{ inputs.mode }} ${{ inputs.test_mode }} xpu 0 static 1 0 $model
234234
done < $models_subset_file
235235
if [[ "${{ inputs.check_all_subset_models }}" == true ]]
236-
python $GITHUB_WORKSPACE/scripts/check-inductor-logs.py --models-file="$models_subset_file" \
236+
python $GITHUB_WORKSPACE/scripts/check_inductor_report.py --models-file="$models_subset_file" \
237237
--suite=${{ inputs.suite }} \
238238
--dtype=${{ inputs.dtype }} \
239239
--mode=${{ inputs.mode }} \

scripts/check_inductor_report.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/usr/bin/env python
2+
import argparse
3+
from pathlib import Path
4+
import csv
5+
6+
7+
def check_report(suite, dtype, mode, test_mode, device, models_file):
8+
inductor_log_dir = Path("inductor_log") / suite / dtype
9+
inductor_report_filename = f"inductor_{suite}_{dtype}_{mode}_{device}_{test_mode}.csv"
10+
inductor_report_path = Path(inductor_log_dir / inductor_report_filename)
11+
12+
subset = []
13+
report = []
14+
exitcode = 0
15+
16+
with open(models_file) as f:
17+
subset = f.read().strip().split('\n')
18+
19+
with open(inductor_report_path) as f:
20+
reader = csv.reader(f)
21+
report_with_header = []
22+
for l in reader:
23+
report_with_header.append(l)
24+
for r in report_with_header[1:]:
25+
if r[0] == device:
26+
report.append(r)
27+
28+
test_list = [r[1] for r in report]
29+
30+
if test_mode == "performance":
31+
for m in subset:
32+
if m not in test_list:
33+
exitcode = 1
34+
print(f"Test is not found in report: {m}")
35+
36+
if test_mode == "accuracy":
37+
test_statuses = [r[3] for r in report]
38+
for m in subset:
39+
try:
40+
idx = test_list.index(m)
41+
except ValueError:
42+
exitcode = 1
43+
print(f"Test is NOT FOUND: {m}")
44+
continue
45+
if test_statuses[idx] != "pass":
46+
exitcode = 1
47+
print(f"Test is NOT PASSED: {m}")
48+
return exitcode
49+
50+
51+
def main():
52+
argparser = argparse.ArgumentParser()
53+
argparser.add_argument("--suite', required=True)
54+
argparser.add_argument("--dtype", required=True)
55+
argparser.add_argument("--mode", required=True, choices=("training", "inference"))
56+
argparser.add_argument("--test_mode", required=True, choices=("performance", "accuracy"))
57+
argparser.add_argument("--device", help="i.e. xpu", required=True)
58+
argparser.add_argument("--models-file", help="Subset of models list", required=True)
59+
args = argparser.parse_args()
60+
exitcode = check_report(args.suite, args.dtype, args.mode, args.test_mode, args.device, args.models_file)
61+
print(f"Report check result: {'SUCCESS' if exitcode == 0 else 'FAIL'}")
62+
exit(exitcode)
63+
64+
65+
if __name__ == "__main__":
66+
main()

0 commit comments

Comments
 (0)