Skip to content

Commit b2f8817

Browse files
committed
Address feedback: rename URRefCount to RefCount and put inside ur namespace. Add a constructor for the class with a default value and remove use of reset() inside the Adapter constructor, using the RefCount constructor to set default value instead.
1 parent 93fcb7f commit b2f8817

22 files changed

+51
-45
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,13 +296,11 @@ Behavior Summary:
296296
SysMan initialization is skipped.
297297
*/
298298
ur_adapter_handle_t_::ur_adapter_handle_t_()
299-
: handle_base(), logger(logger::get_logger("level_zero")) {
299+
: handle_base(), logger(logger::get_logger("level_zero")), RefCount(0) {
300300
ZeInitDriversResult = ZE_RESULT_ERROR_UNINITIALIZED;
301301
ZeInitResult = ZE_RESULT_ERROR_UNINITIALIZED;
302302
ZesResult = ZE_RESULT_ERROR_UNINITIALIZED;
303303

304-
RefCount.reset(0);
305-
306304
#ifdef UR_STATIC_LEVEL_ZERO
307305
// Given static linking of the L0 Loader, we must delay the loader's
308306
// destruction of its context until after the UR Adapter is destroyed.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ struct ur_adapter_handle_t_ : ur::handle_base<ur::level_zero::ddi_getter> {
4545
logger::Logger &logger;
4646
HMODULE processHandle = nullptr;
4747

48-
URRefCount &getRefCount() noexcept { return RefCount; }
48+
ur::RefCount &getRefCount() noexcept { return RefCount; }
4949

5050
private:
51-
URRefCount RefCount;
51+
ur::RefCount RefCount;
5252
};
5353

5454
extern ur_adapter_handle_t_ *GlobalAdapter;

unified-runtime/source/adapters/level_zero/command_buffer.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ struct ur_exp_command_buffer_handle_t_ : public ur_object {
151151
std::vector<std::unique_ptr<ur_exp_command_buffer_command_handle_t_>>
152152
CommandHandles;
153153

154-
URRefCount &getRefCount() noexcept { return RefCount; }
154+
ur::RefCount &getRefCount() noexcept { return RefCount; }
155155

156156
private:
157-
URRefCount RefCount;
157+
ur::RefCount RefCount;
158158
};

unified-runtime/source/adapters/level_zero/common.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,10 @@ struct MemAllocRecord : ur_object {
259259
// Zero runtime.
260260
ur_context_handle_t Context;
261261

262-
URRefCount &getRefCount() noexcept { return RefCount; }
262+
ur::RefCount &getRefCount() noexcept { return RefCount; }
263263

264264
private:
265-
URRefCount RefCount;
265+
ur::RefCount RefCount;
266266
};
267267

268268
extern usm::DisjointPoolAllConfigs DisjointPoolConfigInstance;

unified-runtime/source/adapters/level_zero/context.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ struct ur_context_handle_t_ : ur_object {
359359
// Get handle to the L0 context
360360
ze_context_handle_t getZeHandle() const;
361361

362-
URRefCount &getRefCount() noexcept { return RefCount; }
362+
ur::RefCount &getRefCount() noexcept { return RefCount; }
363363

364364
private:
365365
enum EventFlags {
@@ -408,7 +408,7 @@ struct ur_context_handle_t_ : ur_object {
408408
return &EventCaches[index];
409409
}
410410

411-
URRefCount RefCount;
411+
ur::RefCount RefCount;
412412
};
413413

414414
// Helper function to release the context, a caller must lock the platform-level

unified-runtime/source/adapters/level_zero/device.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,10 @@ struct ur_device_handle_t_ : ur_object {
244244
// unique ephemeral identifer of the device in the adapter
245245
std::optional<DeviceId> Id;
246246

247-
URRefCount &getRefCount() noexcept { return RefCount; }
247+
ur::RefCount &getRefCount() noexcept { return RefCount; }
248248

249249
private:
250-
URRefCount RefCount;
250+
ur::RefCount RefCount;
251251
};
252252

253253
inline std::vector<ur_device_handle_t>

unified-runtime/source/adapters/level_zero/event.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,10 @@ struct ur_event_handle_t_ : ur_object {
264264
// on async free to indicate when the allocation can be used again.
265265
ur_event_handle_t OriginAllocEvent = nullptr;
266266

267-
URRefCount &getRefCount() noexcept { return RefCount; }
267+
ur::RefCount &getRefCount() noexcept { return RefCount; }
268268

269269
private:
270-
URRefCount RefCount;
270+
ur::RefCount RefCount;
271271
};
272272

273273
// Helper function to implement zeHostSynchronize.

unified-runtime/source/adapters/level_zero/kernel.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ struct ur_kernel_handle_t_ : ur_object {
109109
ZeCache<ZeStruct<ze_kernel_properties_t>> ZeKernelProperties;
110110
ZeCache<std::string> ZeKernelName;
111111

112-
URRefCount &getRefCount() noexcept { return RefCount; }
112+
ur::RefCount &getRefCount() noexcept { return RefCount; }
113113

114114
private:
115-
URRefCount RefCount;
115+
ur::RefCount RefCount;
116116
};
117117

118118
ur_result_t getZeKernel(ze_device_handle_t hDevice, ur_kernel_handle_t hKernel,

unified-runtime/source/adapters/level_zero/memory.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ struct ur_mem_handle_t_ : ur_object {
9191
// Method to get type of the derived object (image or buffer)
9292
bool isImage() const { return mem_type == mem_type_t::image; }
9393

94-
URRefCount &getRefCount() noexcept { return RefCount; }
94+
ur::RefCount &getRefCount() noexcept { return RefCount; }
9595

9696
protected:
9797
ur_mem_handle_t_(mem_type_t type, ur_context_handle_t Context)
@@ -106,7 +106,7 @@ struct ur_mem_handle_t_ : ur_object {
106106
~ur_mem_handle_t_() {};
107107

108108
private:
109-
URRefCount RefCount;
109+
ur::RefCount RefCount;
110110
};
111111

112112
struct ur_buffer final : ur_mem_handle_t_ {

unified-runtime/source/adapters/level_zero/physical_mem.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ struct ur_physical_mem_handle_t_ : ur_object {
2323
// Keeps the PI context of this memory handle.
2424
ur_context_handle_t Context;
2525

26-
URRefCount &getRefCount() noexcept { return RefCount; }
26+
ur::RefCount &getRefCount() noexcept { return RefCount; }
2727

2828
private:
29-
URRefCount RefCount;
29+
ur::RefCount RefCount;
3030
};

0 commit comments

Comments
 (0)