Skip to content

Commit b2ec053

Browse files
authored
[CI][E2E-accuracy] Fix bug with aggregation of 1 result (#5169)
Closes #5158 The issue appeared because [download artifact](https://github.com/actions/download-artifact?tab=readme-ov-file#v5---whats-new) will change it's behavior if only one artefact is available. In this case the we will loose the artifact name and extract it's content into selected folder. So it's `separate-reports/contentA` instead of `separate-reports/artifactA/contentA;separate-reports/artifactB/contentB`. The change is that we now always merge artifacts and lose names like `artifactA`. So we have to change result parsing as well.
1 parent eab348f commit b2ec053

File tree

3 files changed

+55
-42
lines changed

3 files changed

+55
-42
lines changed

.github/workflows/e2e-accuracy.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ jobs:
151151
uses: actions/download-artifact@v5
152152
with:
153153
path: separate-reports
154+
merge-multiple: true
154155

155156
- name: Run aggregation script
156157
run: |
@@ -164,13 +165,14 @@ jobs:
164165
165166
- name: Upload aggregated results
166167
uses: actions/upload-artifact@v4
168+
if: ${{ !cancelled() }}
167169
with:
168170
name: aggregated-results-${{ github.run_id }}
169171
path: aggregated-results
170172
include-hidden-files: true
171173

172174
- name: Check results against reference
173-
if: ${{ inputs.models == 'all' && inputs.only_one_model == '' }}
175+
if: ${{ inputs.models == 'all' && inputs.only_one_model == '' && !cancelled()}}
174176
run: |
175177
PYTORCH_XPU_OPS_REF="$(<.github/pins/e2e_reference_torch-xpu-ops.txt)"
176178
git clone https://github.com/intel/torch-xpu-ops.git

scripts/e2e_checks/aggregate_e2e_results.py

Lines changed: 51 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,6 @@ def parse_args():
1010
return parser.parse_args()
1111

1212

13-
def parse_folder_name(folder_name):
14-
"""
15-
Parse folder name to extract suite and dtype.
16-
17-
Expected format: logs-{suite}-{dtype}-{mode}-accuracy, where mode can contain `-` characters
18-
Examples:
19-
- logs-torchbench-float32-inference-accuracy -> suite=torchbench, dtype=float32
20-
- logs-huggingface-amp_bf16-training-accuracy -> suite=huggingface, dtype=amp_bf16
21-
"""
22-
parts = folder_name.split('-')
23-
24-
# Check if it follows the expected pattern
25-
if len(parts) < 4 or parts[0] != 'logs' or parts[-1] != 'accuracy':
26-
return None, None, None
27-
28-
suite = parts[1]
29-
dtype = parts[2]
30-
# Extract mode, can include dashes
31-
mode = '-'.join(parts[3:-1])
32-
33-
return suite, dtype, mode
34-
35-
3613
def build_suite_report(combined_df, output_path):
3714
print('=======================================')
3815
print('= SUMMARY REPORT =')
@@ -110,6 +87,50 @@ def build_pytorch_report(combined_df, output_path):
11087
pivoted_df.to_csv(torch_report_dir / f'inductor_{suite}_{mode}.csv', index=False)
11188

11289

90+
def parse_mode(report_path):
91+
"""
92+
Parse report file path to extract `mode`.
93+
94+
Expected filename: 'inductor_{suite}_{dtype}_{mode}_xpu_accuracy.csv', where mode can contain `-` characters
95+
and dtype can contain `_` characters (e.g., `amp_bf16`).
96+
97+
Returns:
98+
mode (str): Extracted mode from the filename
99+
error (str or None): Error message if parsing fails, otherwise None
100+
"""
101+
parts = report_path.name.split('_')
102+
103+
# Check if it follows the expected pattern
104+
if len(parts) < 6 or parts[0] != 'inductor' or parts[-1] != 'accuracy.csv':
105+
txt = f'Unexpected filename format: {report_path.name}, parsed parts: {parts}'
106+
print(txt)
107+
return None, txt
108+
return parts[-3], None
109+
110+
111+
def load_reports(input_path):
112+
dfs = []
113+
problems = []
114+
for suite_path in filter(Path.is_dir, input_path.iterdir()):
115+
suite = suite_path.name
116+
117+
for dtype_path in filter(Path.is_dir, suite_path.iterdir()):
118+
dtype = dtype_path.name
119+
120+
for report_path in dtype_path.glob('inductor_*_xpu_accuracy.csv'):
121+
print(f'Reading {report_path}')
122+
mode, problem = parse_mode(report_path)
123+
if mode is None:
124+
problems.append(problem)
125+
continue
126+
df = pd.read_csv(report_path)
127+
df['suite'] = suite
128+
df['mode'] = mode
129+
df['dtype'] = dtype
130+
dfs.append(df)
131+
return dfs, problems
132+
133+
113134
def main(input_dir, output_dir):
114135
"""
115136
Main function to aggregate end-to-end test results.
@@ -129,23 +150,7 @@ def main(input_dir, output_dir):
129150
print(f'Processing results from: {input_path}')
130151
print(f'Output will be saved to: {output_path}')
131152

132-
dfs = []
133-
for item_path in input_path.iterdir():
134-
name = item_path.name
135-
if not item_path.is_dir():
136-
continue
137-
138-
suite, dtype, mode = parse_folder_name(name)
139-
if suite is None:
140-
print(f'Folder name \'{name}\' does not match expected pattern, skipping')
141-
continue
142-
filepath = item_path / suite / dtype / f'inductor_{suite}_{dtype}_{mode}_xpu_accuracy.csv'
143-
df = pd.read_csv(filepath)
144-
df['suite'] = suite
145-
df['mode'] = mode
146-
df['dtype'] = dtype
147-
dfs.append(df)
148-
153+
dfs, problems = load_reports(input_path)
149154
combined_df = pd.concat(dfs, ignore_index=True)
150155
combined_df = combined_df.sort_values(['suite', 'mode', 'dtype'])
151156

@@ -157,6 +162,12 @@ def main(input_dir, output_dir):
157162
# 3. Agg report with 45 rows (suite, mode, dtype, passed, failed_REASON, failed_REASON model list)
158163
build_suite_report(combined_df, output_path=output_path)
159164

165+
if problems:
166+
print('Problems found during parsing:')
167+
for problem in problems:
168+
print(problem)
169+
raise RuntimeError('Errors found during parsing, see above')
170+
160171

161172
if __name__ == '__main__':
162173
args = parse_args()

scripts/e2e_checks/compare_reference.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ for suite in "${suites[@]}"; do
8080
fi
8181

8282
for dtype in "${dtypes[@]}"; do
83-
CSV_FILE="$RESULT_DIR/logs-$suite-$dtype-$mode-accuracy/$suite/$dtype/inductor_${suite}_${dtype}_${mode}_xpu_accuracy.csv"
83+
CSV_FILE="$RESULT_DIR/$suite/$dtype/inductor_${suite}_${dtype}_${mode}_xpu_accuracy.csv"
8484

8585
# Check if CSV file exists
8686
if [ ! -f "$CSV_FILE" ]; then

0 commit comments

Comments
 (0)