@@ -684,6 +684,7 @@ class BenchmarkOperator(metaclass=PostInitProcessor):
684
684
DEFAULT_METRICS = ["latency" ]
685
685
required_metrics : List [str ]
686
686
_cur_input_id : Optional [int ] = None
687
+ _cur_backend_name : Optional [str ] = None
687
688
_input_iter : Optional [Generator ] = None
688
689
extra_args : List [str ] = []
689
690
example_inputs : Any = None
@@ -980,6 +981,7 @@ def run(
980
981
981
982
current_pos = 0
982
983
for input_id in input_id_range :
984
+ self ._cur_backend_name = None
983
985
# Skip to the correct position if there are gaps
984
986
while current_pos < input_id :
985
987
self .example_inputs = self .get_example_inputs ()
@@ -1078,6 +1080,7 @@ def run(
1078
1080
1079
1081
# get metrics for for each registered benchmark
1080
1082
def _reduce_benchmarks (acc , bm_name : str ):
1083
+ self ._cur_backend_name = bm_name
1081
1084
baseline = (
1082
1085
bm_name == BASELINE_BENCHMARKS [self .name ]
1083
1086
if self .name in BASELINE_BENCHMARKS
@@ -1101,6 +1104,7 @@ def _reduce_benchmarks(acc, bm_name: str):
1101
1104
y_vals : Dict [str , BenchmarkOperatorMetrics ] = functools .reduce (
1102
1105
_reduce_benchmarks , benchmarks , {}
1103
1106
)
1107
+ self ._cur_backend_name = None
1104
1108
metrics .append ((x_val , y_vals ))
1105
1109
del self .example_inputs # save some memory
1106
1110
if "proton" in self .required_metrics :
@@ -1112,10 +1116,21 @@ def _reduce_benchmarks(acc, bm_name: str):
1112
1116
proton .exit_scope ()
1113
1117
proton .finalize ()
1114
1118
except (KeyboardInterrupt , Exception ):
1119
+ backend_suffix = (
1120
+ f" on backend { self ._cur_backend_name } "
1121
+ if self ._cur_backend_name is not None
1122
+ else ""
1123
+ )
1115
1124
logger .warning (
1116
- "Caught exception, terminating early with partial results" ,
1125
+ "Caught exception%s, terminating early with partial results" ,
1126
+ backend_suffix ,
1117
1127
exc_info = True ,
1118
1128
)
1129
+ if getattr (self , "_cur_input_id" , None ) is not None :
1130
+ logger .warning (
1131
+ "Failing input: --input-id %s --num-inputs 1" ,
1132
+ self ._cur_input_id ,
1133
+ )
1119
1134
if self .tb_args .exit_on_exception :
1120
1135
os ._exit (1 )
1121
1136
raise
0 commit comments