Skip to content

Commit 156bd2c

Browse files
committed
change resetRefCount to have a param and a default value so l0 adapter can start ref count from 0
1 parent c5be693 commit 156bd2c

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

unified-runtime/source/adapters/level_zero/adapter.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,8 @@ ur_adapter_handle_t_::ur_adapter_handle_t_()
301301
ZeInitResult = ZE_RESULT_ERROR_UNINITIALIZED;
302302
ZesResult = ZE_RESULT_ERROR_UNINITIALIZED;
303303

304+
resetRefCount(0);
305+
304306
#ifdef UR_STATIC_LEVEL_ZERO
305307
// Given static linking of the L0 Loader, we must delay the loader's
306308
// destruction of its context until after the UR Adapter is destroyed.

unified-runtime/source/ur/ur.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ template <typename getddi> struct handle_base {
233233
uint32_t incrementRefCount() { return ++Count; }
234234
uint32_t decrementRefCount() { return --Count; }
235235
bool decrementAndTest() { return --Count == 0; }
236-
void resetRefCount() { Count = 1; }
236+
void resetRefCount(uint32_t value = 1) { Count = value; }
237237

238238
private:
239239
std::atomic_uint32_t Count{1};

0 commit comments

Comments
 (0)