@@ -100,25 +100,30 @@ def display_comparison(results, threshold, xpu_file, compare_both):
100
100
# Classify records based on changes
101
101
regression_records = []
102
102
improvement_records = []
103
+ mixed_records = []
103
104
104
105
for record in results .to_dict ('records' ):
105
- has_profile_change = 'profile_change' in record and record [ 'profile_change' ] in ( '↑' , '↓ ' )
106
- has_e2e_change = 'e2e_change' in record and record [ 'e2e_change' ] in ( '↑' , '↓ ' )
106
+ profile_change = record . get ( 'profile_change ' )
107
+ e2e_change = record . get ( 'e2e_change ' )
107
108
108
- # If either metric shows regression, count as regression
109
- if (has_profile_change and record ['profile_change' ] == '↓' ) or \
110
- (has_e2e_change and record ['e2e_change' ] == '↓' ):
109
+ profile_regression = profile_change == '↓'
110
+ profile_improve = profile_change == '↑'
111
+ e2e_regression = e2e_change == '↓'
112
+ e2e_improve = e2e_change == '↑'
113
+
114
+ if (profile_regression and e2e_improve ) or (profile_improve and e2e_regression ):
115
+ mixed_records .append (record )
116
+ elif profile_regression or e2e_regression :
111
117
regression_records .append (record )
112
- # If either metric shows improvement, count as improvement
113
- elif (has_profile_change and record ['profile_change' ] == '↑' ) or \
114
- (has_e2e_change and record ['e2e_change' ] == '↑' ):
118
+ elif profile_improve or e2e_improve :
115
119
improvement_records .append (record )
116
120
117
121
# Print results
118
122
if regression_records :
119
123
print ("\n 🔴 Regression:" )
120
124
regression_display = [r for r in display_records
121
- if r ['Case Name' ] in [x ['case_name' ] for x in regression_records ]]
125
+ if (r .get ('Profile Change' , '' ) == '↓' or r .get ('E2E Change' , '' ) == '↓' )
126
+ and not (r .get ('Profile Change' , '' ) == '↑' or r .get ('E2E Change' , '' ) == '↑' )]
122
127
print (tabulate (
123
128
regression_display ,
124
129
headers = "keys" ,
@@ -130,7 +135,8 @@ def display_comparison(results, threshold, xpu_file, compare_both):
130
135
if improvement_records :
131
136
print ("\n 🟢 Improvement:" )
132
137
improvement_display = [r for r in display_records
133
- if r ['Case Name' ] in [x ['case_name' ] for x in improvement_records ]]
138
+ if (r .get ('Profile Change' , '' ) == '↑' or r .get ('E2E Change' , '' ) == '↑' )
139
+ and not (r .get ('Profile Change' , '' ) == '↓' or r .get ('E2E Change' , '' ) == '↓' )]
134
140
print (tabulate (
135
141
improvement_display ,
136
142
headers = "keys" ,
@@ -139,6 +145,19 @@ def display_comparison(results, threshold, xpu_file, compare_both):
139
145
floatfmt = ".2f"
140
146
))
141
147
148
+ if mixed_records :
149
+ print ("\n 🟡 Mixed Changes (one metric improves, another regression):" )
150
+ mixed_display = [r for r in display_records
151
+ if ((r .get ('Profile Change' , '' ) == '↑' and r .get ('E2E Change' , '' ) == '↓' ) or
152
+ (r .get ('Profile Change' , '' ) == '↓' and r .get ('E2E Change' , '' ) == '↑' ))]
153
+ print (tabulate (
154
+ mixed_display ,
155
+ headers = "keys" ,
156
+ tablefmt = 'grid' ,
157
+ showindex = False ,
158
+ floatfmt = ".2f"
159
+ ))
160
+
142
161
# Generate GitHub summary
143
162
summary_output = f"## { direction } Performance Comparison Results\n "
144
163
@@ -162,6 +181,17 @@ def display_comparison(results, threshold, xpu_file, compare_both):
162
181
floatfmt = ".2f"
163
182
) + "\n "
164
183
184
+ if mixed_records :
185
+ summary_output += "\n ### 🟡 Mixed Changes\n "
186
+ summary_output += "One metric improves while another regression\n "
187
+ summary_output += tabulate (
188
+ [r for r in display_records if r ['Case Name' ] in [x ['case_name' ] for x in mixed_records ]],
189
+ headers = "keys" ,
190
+ tablefmt = 'github' ,
191
+ showindex = False ,
192
+ floatfmt = ".2f"
193
+ ) + "\n "
194
+
165
195
write_to_github_summary (summary_output )
166
196
167
197
def compare_time_values (xpu_file , baseline_file , threshold = 0.05 , profile_only = False , e2e_only = False ):
0 commit comments