@@ -219,46 +219,19 @@ struct ur_context_handle_t_ : _ur_object {
219
219
220
220
std::list<ze_event_pool_handle_t > *
221
221
getZeEventPoolCache (enum ur_event_flag_t Flags, ze_device_handle_t ZeDevice) {
222
- EventPoolCacheType CacheType;
223
-
224
- calculateCacheIndex (Flags, CacheType);
222
+ Flags = static_cast <ur_event_flag_t >(Flags & ~MULTIDEVICE);
225
223
if (ZeDevice) {
226
224
auto ZeEventPoolCacheMap =
227
- Flags & ENABLE_PROFILER
228
- ? &ZeEventPoolCacheDeviceMap[CacheType * 2 ]
229
- : &ZeEventPoolCacheDeviceMap[CacheType * 2 + 1 ];
225
+ &ZeEventPoolCacheDeviceMap[static_cast <int >(Flags)];
230
226
if (ZeEventPoolCacheMap->find (ZeDevice) == ZeEventPoolCacheMap->end ()) {
231
227
ZeEventPoolCache.emplace_back ();
232
228
ZeEventPoolCacheMap->insert (
233
229
std::make_pair (ZeDevice, ZeEventPoolCache.size () - 1 ));
234
230
}
235
231
return &ZeEventPoolCache[(*ZeEventPoolCacheMap)[ZeDevice]];
236
232
} else {
237
- return Flags & ENABLE_PROFILER ? &ZeEventPoolCache[CacheType * 2 ]
238
- : &ZeEventPoolCache[CacheType * 2 + 1 ];
239
- }
240
- }
241
-
242
- ur_result_t calculateCacheIndex (enum ur_event_flag_t Flags,
243
- EventPoolCacheType &CacheType) {
244
- if (Flags & COUNTER_BASED && Flags & HOST_VISIBLE &&
245
- !(Flags & USING_IMM_CMDLIST)) {
246
- CacheType = HostVisibleCounterBasedRegularCacheType;
247
- } else if (Flags & COUNTER_BASED && !(Flags & HOST_VISIBLE) &&
248
- !(Flags & USING_IMM_CMDLIST)) {
249
- CacheType = HostInvisibleCounterBasedRegularCacheType;
250
- } else if (Flags & COUNTER_BASED && Flags & HOST_VISIBLE &&
251
- Flags & USING_IMM_CMDLIST) {
252
- CacheType = HostVisibleCounterBasedImmediateCacheType;
253
- } else if (Flags & COUNTER_BASED && !(Flags & HOST_VISIBLE) &&
254
- Flags & USING_IMM_CMDLIST) {
255
- CacheType = HostInvisibleCounterBasedImmediateCacheType;
256
- } else if (!(Flags & COUNTER_BASED) && Flags & HOST_VISIBLE) {
257
- CacheType = HostVisibleCacheType;
258
- } else {
259
- CacheType = HostInvisibleCacheType;
233
+ return &ZeEventPoolCache[static_cast <int >(Flags)];
260
234
}
261
- return UR_RESULT_SUCCESS;
262
235
}
263
236
264
237
// Decrement number of events living in the pool upon event destroy
0 commit comments