Skip to content

Commit 555dd49

Browse files
[L0] uint_32 change
Signed-off-by: Winston Zhang <[email protected]>
1 parent a1d7d23 commit 555dd49

File tree

5 files changed

+19
-18
lines changed

5 files changed

+19
-18
lines changed

source/adapters/level_zero/common.hpp

+8-7
Original file line numberDiff line numberDiff line change
@@ -216,13 +216,14 @@ enum {
216216
UrL0SerializeBlock =
217217
2, // blocking UR calls, where supported (usually in enqueue commands)
218218
};
219-
typedef enum {
220-
COUNTER_BASED = 1 << 0,
221-
USING_IMM_CMDLIST = 1 << 1,
222-
HOST_VISIBLE = 1 << 2,
223-
ENABLE_PROFILER = 1 << 3,
224-
MULTIDEVICE = 1 << 4
225-
} EventFlags;
219+
typedef uint32_t ur_event_flags_t;
220+
typedef enum ur_event_flag_t {
221+
COUNTER_BASED = UR_BIT(0),
222+
USING_IMM_CMDLIST = UR_BIT(1),
223+
HOST_VISIBLE = UR_BIT(2),
224+
ENABLE_PROFILER = UR_BIT(3),
225+
MULTIDEVICE = UR_BIT(4)
226+
} ur_event_flag_t;
226227

227228
static const uint32_t UrL0Serialize = [] {
228229
const char *ZeSerializeMode = std::getenv("ZE_SERIALIZE");

source/adapters/level_zero/context.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ static const uint32_t MaxNumEventsPerPool = [] {
470470
}();
471471

472472
ur_result_t ur_context_handle_t_::getFreeSlotInExistingOrNewPool(
473-
ze_event_pool_handle_t &Pool, size_t &Index, EventFlags Flags,
473+
ze_event_pool_handle_t &Pool, size_t &Index, enum ur_event_flag_t Flags,
474474
ur_device_handle_t Device) {
475475
// Lock while updating event pool machinery.
476476
std::scoped_lock<ur_mutex> Lock(ZeEventPoolCacheMutex);
@@ -552,7 +552,7 @@ ur_result_t ur_context_handle_t_::getFreeSlotInExistingOrNewPool(
552552
}
553553

554554
ur_event_handle_t
555-
ur_context_handle_t_::getEventFromContextCache(EventFlags Flags,
555+
ur_context_handle_t_::getEventFromContextCache(enum ur_event_flag_t Flags,
556556
ur_device_handle_t Device) {
557557
std::scoped_lock<ur_mutex> Lock(EventCacheMutex);
558558
auto Cache = getEventCache(Flags, Device);
@@ -578,7 +578,7 @@ void ur_context_handle_t_::addEventToContextCache(ur_event_handle_t Event) {
578578
Device = Legacy(Event->UrQueue)->Device;
579579
}
580580

581-
EventFlags Flags = static_cast<EventFlags>(
581+
enum ur_event_flag_t Flags = static_cast<enum ur_event_flag_t>(
582582
Event->isHostVisible() ? HOST_VISIBLE
583583
: 0 | Event->isProfilingEnabled() ? ENABLE_PROFILER
584584
: 0);
@@ -605,7 +605,7 @@ ur_context_handle_t_::decrementUnreleasedEventsInPool(ur_event_handle_t Event) {
605605
ZeDevice = Legacy(Event->UrQueue)->Device->ZeDevice;
606606
}
607607

608-
EventFlags Flags = static_cast<EventFlags>(
608+
enum ur_event_flag_t Flags = static_cast<enum ur_event_flag_t>(
609609
Event->isHostVisible() ? HOST_VISIBLE
610610
: 0 | Event->isProfilingEnabled() ? ENABLE_PROFILER
611611
: 0 | Event->CounterBasedEventsEnabled ? COUNTER_BASED

source/adapters/level_zero/context.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,11 @@ struct ur_context_handle_t_ : _ur_object {
198198
// slot for a host-visible event. The ProfilingEnabled tells is we need a
199199
// slot for an event with profiling capabilities.
200200
ur_result_t getFreeSlotInExistingOrNewPool(ze_event_pool_handle_t &, size_t &,
201-
EventFlags Flags,
201+
enum ur_event_flag_t Flags,
202202
ur_device_handle_t Device);
203203

204204
// Get ur_event_handle_t from cache.
205-
ur_event_handle_t getEventFromContextCache(EventFlags Flags,
205+
ur_event_handle_t getEventFromContextCache(enum ur_event_flag_t Flags,
206206
ur_device_handle_t Device);
207207

208208
// Add ur_event_handle_t to cache.
@@ -218,7 +218,7 @@ struct ur_context_handle_t_ : _ur_object {
218218
};
219219

220220
std::list<ze_event_pool_handle_t> *
221-
getZeEventPoolCache(EventFlags Flags, ze_device_handle_t ZeDevice) {
221+
getZeEventPoolCache(enum ur_event_flag_t Flags, ze_device_handle_t ZeDevice) {
222222
EventPoolCacheType CacheType;
223223

224224
calculateCacheIndex(Flags, CacheType);
@@ -239,7 +239,7 @@ struct ur_context_handle_t_ : _ur_object {
239239
}
240240
}
241241

242-
ur_result_t calculateCacheIndex(EventFlags Flags,
242+
ur_result_t calculateCacheIndex(enum ur_event_flag_t Flags,
243243
EventPoolCacheType &CacheType) {
244244
if (Flags & COUNTER_BASED && Flags & HOST_VISIBLE &&
245245
!(Flags & USING_IMM_CMDLIST)) {
@@ -297,7 +297,7 @@ struct ur_context_handle_t_ : _ur_object {
297297

298298
private:
299299
// Get the cache of events for a provided scope and profiling mode.
300-
auto getEventCache(EventFlags Flags, ur_device_handle_t Device) {
300+
auto getEventCache(enum ur_event_flag_t Flags, ur_device_handle_t Device) {
301301
if (Flags & HOST_VISIBLE) {
302302
if (Device) {
303303
auto EventCachesMap = Flags & ENABLE_PROFILER

source/adapters/level_zero/event.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1236,7 +1236,7 @@ ur_result_t EventCreate(ur_context_handle_t Context,
12361236
bool ProfilingEnabled =
12371237
ForceDisableProfiling ? false : (!Queue || Queue->isProfilingEnabled());
12381238
bool UsingImmediateCommandlists = !Queue || Queue->UsingImmCmdLists;
1239-
EventFlags Flags = static_cast<EventFlags>(
1239+
enum ur_event_flag_t Flags = static_cast<enum ur_event_flag_t>(
12401240
ProfilingEnabled ? ENABLE_PROFILER
12411241
: 0 | UsingImmediateCommandlists ? USING_IMM_CMDLIST
12421242
: 0 | HostVisible ? HOST_VISIBLE

source/adapters/level_zero/event.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ struct ur_event_handle_t_ : _ur_object {
132132
OwnNativeHandle = OwnZeEvent;
133133
}
134134

135-
EventFlags flags;
135+
enum ur_event_flag_t flags;
136136
// Level Zero event handle.
137137
ze_event_handle_t ZeEvent;
138138

0 commit comments

Comments
 (0)