@@ -235,6 +235,8 @@ struct ur_context_handle_t_ : _ur_object {
235
235
HostInvisibleRegularCacheType,
236
236
CounterBasedImmediateCacheType,
237
237
CounterBasedRegularCacheType,
238
+ CounterBasedImmediateProfilingCacheType,
239
+ CounterBasedRegularProfilingCacheType,
238
240
EventCacheTypeCount
239
241
};
240
242
@@ -359,33 +361,41 @@ struct ur_context_handle_t_ : _ur_object {
359
361
}
360
362
}
361
363
};
362
- auto getCounterBasedEventCache (bool UsingImmediateCmdList,
364
+ auto getCounterBasedEventCache (bool WithProfiling, bool UsingImmediateCmdList,
363
365
ur_device_handle_t Device) {
364
366
if (UsingImmediateCmdList) {
365
367
if (Device) {
366
368
auto EventCachesMap =
367
- &EventCachesDeviceMap[CounterBasedImmediateCacheType];
369
+ WithProfiling
370
+ ? &EventCachesDeviceMap[CounterBasedImmediateProfilingCacheType]
371
+ : &EventCachesDeviceMap[CounterBasedImmediateCacheType];
368
372
if (EventCachesMap->find (Device) == EventCachesMap->end ()) {
369
373
EventCaches.emplace_back ();
370
374
EventCachesMap->insert (
371
375
std::make_pair (Device, EventCaches.size () - 1 ));
372
376
}
373
377
return &EventCaches[(*EventCachesMap)[Device]];
374
378
} else {
375
- return &EventCaches[CounterBasedImmediateCacheType];
379
+ return WithProfiling
380
+ ? &EventCaches[CounterBasedImmediateProfilingCacheType]
381
+ : &EventCaches[CounterBasedImmediateCacheType];
376
382
}
377
383
} else {
378
384
if (Device) {
379
385
auto EventCachesMap =
380
- &EventCachesDeviceMap[CounterBasedRegularCacheType];
386
+ WithProfiling
387
+ ? &EventCachesDeviceMap[CounterBasedRegularProfilingCacheType]
388
+ : &EventCachesDeviceMap[CounterBasedRegularCacheType];
381
389
if (EventCachesMap->find (Device) == EventCachesMap->end ()) {
382
390
EventCaches.emplace_back ();
383
391
EventCachesMap->insert (
384
392
std::make_pair (Device, EventCaches.size () - 1 ));
385
393
}
386
394
return &EventCaches[(*EventCachesMap)[Device]];
387
395
} else {
388
- return &EventCaches[CounterBasedRegularCacheType];
396
+ return WithProfiling
397
+ ? &EventCaches[CounterBasedRegularProfilingCacheType]
398
+ : &EventCaches[CounterBasedRegularCacheType];
389
399
}
390
400
}
391
401
}
0 commit comments