@@ -169,8 +169,10 @@ struct UfuncInputCache {
169
169
}
170
170
171
171
// Otherwise, we missed the cache. Load in the target tensor and process it.
172
- this ->lastPath = path;
173
172
this ->lastLoaded = taco::read (path, format);
173
+ // We assign lastPath after lastLoaded so that if taco::read throws an exception
174
+ // then lastPath isn't updated to the new path.
175
+ this ->lastPath = path;
174
176
this ->inputTensor = castToType<int64_t >(" A" , this ->lastLoaded );
175
177
this ->otherTensor = shiftLastMode<int64_t , int64_t >(" B" , this ->inputTensor );
176
178
return std::make_pair (this ->inputTensor , this ->otherTensor );
@@ -288,6 +290,9 @@ struct SuiteSparseTensors {
288
290
SuiteSparseTensors ssTensors;
289
291
290
292
static void bench_suitesparse_ufunc (benchmark::State& state, Func op) {
293
+ // Counters must be present in every run to get reported to the CSV.
294
+ state.counters [" dimx" ] = 0 ;
295
+ state.counters [" dimy" ] = 0 ;
291
296
if (ssTensors.tensors .size () == 0 ) {
292
297
state.error_occurred ();
293
298
return ;
@@ -300,7 +305,14 @@ static void bench_suitesparse_ufunc(benchmark::State& state, Func op) {
300
305
state.SetLabel (tensorName);
301
306
302
307
taco::Tensor<int64_t > ssTensor, other;
303
- std::tie (ssTensor, other) = inputCache.getUfuncInput (tensorPath, CSR);
308
+ try {
309
+ std::tie (ssTensor, other) = inputCache.getUfuncInput (tensorPath, CSR);
310
+ } catch (TacoException& e) {
311
+ // Counters don't show up in the generated CSV if we used SkipWithError, so
312
+ // just add in the label that this run is skipped.
313
+ state.SetLabel (tensorName+" -SKIPPED-FAILED-READ" );
314
+ return ;
315
+ }
304
316
305
317
state.counters [" dimx" ] = ssTensor.getDimension (0 );
306
318
state.counters [" dimy" ] = ssTensor.getDimension (1 );
0 commit comments