Skip to content

Commit b6cdccd

Browse files
kwasdpbchekin
andauthored
Add test_all_subset_models mode (#2428)
For #2246 --------- Co-authored-by: Pavel Chekin <[email protected]>
1 parent 5355880 commit b6cdccd

File tree

4 files changed

+94
-1
lines changed

4 files changed

+94
-1
lines changed

.github/workflows/e2e-accuracy.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ on:
4444
- all
4545
- subset
4646
default: all
47+
check_all_subset_models:
48+
description: In "subset" mode, check all subset models
49+
type: boolean
50+
default: false
4751
only_one_model:
4852
description: Run only this one model
4953
type: string
@@ -125,6 +129,7 @@ jobs:
125129
test_mode: accuracy
126130
dtype: ${{ matrix.dtype }}
127131
models: ${{ inputs.models }}
132+
check_all_subset_models: ${{ inputs.check_all_subset_models || false }}
128133
only_one_model: ${{ inputs.only_one_model }}
129134
runner_label: ${{ inputs.runner_label }}
130135
TORCH_COMPILE_DEBUG: ${{ inputs.TORCH_COMPILE_DEBUG }}

.github/workflows/e2e-performance.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ on:
4444
- all
4545
- subset
4646
default: subset
47+
check_all_subset_models:
48+
description: In "subset" mode, do not fail workflow if one of models failed
49+
type: boolean
50+
default: false
4751
only_one_model:
4852
description: Run only this one model
4953
type: string
@@ -136,6 +140,7 @@ jobs:
136140
test_mode: performance
137141
dtype: ${{ matrix.dtype }}
138142
models: ${{ inputs.models }}
143+
check_all_subset_models: ${{ inputs.check_all_subset_models || false }}
139144
only_one_model: ${{ inputs.only_one_model }}
140145
runner_label: ${{ inputs.runner_label }}
141146
TORCH_COMPILE_DEBUG: ${{ inputs.TORCH_COMPILE_DEBUG }}

.github/workflows/e2e-reusable.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ on:
2727
description: Run all models or a subset
2828
type: string
2929
default: all
30+
check_all_subset_models:
31+
description: In "subset" mode, check all subset models
32+
type: boolean
33+
default: false
3034
only_one_model:
3135
description: Run only this one model
3236
type: string
@@ -224,9 +228,19 @@ jobs:
224228
if [[ "${{ inputs.only_one_model }}" ]]; then
225229
bash -e $GITHUB_WORKSPACE/scripts/inductor_xpu_test.sh ${{ inputs.suite }} ${{ inputs.dtype }} ${{ inputs.mode }} ${{ inputs.test_mode }} xpu 0 static 1 0 ${{ inputs.only_one_model }}
226230
elif [[ "${{ inputs.models }}" == "subset" ]]; then
231+
models_subset_file="$GITHUB_WORKSPACE/.github/models/${{ inputs.test_mode }}/${{ inputs.suite }}.txt"
227232
while read model; do
228233
bash -e $GITHUB_WORKSPACE/scripts/inductor_xpu_test.sh ${{ inputs.suite }} ${{ inputs.dtype }} ${{ inputs.mode }} ${{ inputs.test_mode }} xpu 0 static 1 0 $model
229-
done < $GITHUB_WORKSPACE/.github/models/${{ inputs.test_mode }}/${{ inputs.suite }}.txt
234+
done < $models_subset_file
235+
if [[ "${{ inputs.check_all_subset_models }}" == true ]]; then
236+
python $GITHUB_WORKSPACE/scripts/check_inductor_report.py --models-file="$models_subset_file" \
237+
--suite=${{ inputs.suite }} \
238+
--dtype=${{ inputs.dtype }} \
239+
--mode=${{ inputs.mode }} \
240+
--test_mode=${{ inputs.test_mode }} \
241+
--device=xpu \
242+
--inductor-log-dir="${GITHUB_WORKSPACE}/inductor_log"
243+
fi
230244
else
231245
bash -e $GITHUB_WORKSPACE/scripts/inductor_xpu_test.sh ${{ inputs.suite }} ${{ inputs.dtype }} ${{ inputs.mode }} ${{ inputs.test_mode }} xpu 0 static 1 0
232246
fi

scripts/check_inductor_report.py

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

0 commit comments

Comments
 (0)