Skip to content

[UR] Change names starting in _ur_ -> ur_ #18134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions unified-runtime/source/adapters/level_zero/async_alloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static ur_result_t enqueueUSMAllocHelper(
}

bool UseCopyEngine = false;
_ur_ze_event_list_t TmpWaitList;
ur_ze_event_list_t TmpWaitList;
UR_CALL(TmpWaitList.createAndRetainUrZeEventList(
NumEventsInWaitList, EventWaitList, Queue, UseCopyEngine));

Expand Down Expand Up @@ -206,7 +206,7 @@ ur_result_t urEnqueueUSMFreeExp(
std::scoped_lock<ur_shared_mutex> lock(Queue->Mutex);

bool UseCopyEngine = false;
_ur_ze_event_list_t TmpWaitList;
ur_ze_event_list_t TmpWaitList;
UR_CALL(TmpWaitList.createAndRetainUrZeEventList(
NumEventsInWaitList, EventWaitList, Queue, UseCopyEngine));

Expand Down
14 changes: 7 additions & 7 deletions unified-runtime/source/adapters/level_zero/command_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1179,8 +1179,8 @@ ur_result_t urCommandBufferAppendMemBufferCopyExp(
ur_exp_command_buffer_sync_point_t *SyncPoint,
ur_event_handle_t * /*Event*/,
ur_exp_command_buffer_command_handle_t * /*Command*/) {
auto SrcBuffer = ur_cast<_ur_buffer *>(SrcMem);
auto DstBuffer = ur_cast<_ur_buffer *>(DstMem);
auto SrcBuffer = ur_cast<ur_buffer *>(SrcMem);
auto DstBuffer = ur_cast<ur_buffer *>(DstMem);

std::shared_lock<ur_shared_mutex> SrcLock(SrcBuffer->Mutex, std::defer_lock);
std::scoped_lock<std::shared_lock<ur_shared_mutex>, ur_shared_mutex> LockAll(
Expand Down Expand Up @@ -1215,8 +1215,8 @@ ur_result_t urCommandBufferAppendMemBufferCopyRectExp(
ur_exp_command_buffer_sync_point_t *SyncPoint,
ur_event_handle_t * /*Event*/,
ur_exp_command_buffer_command_handle_t * /*Command*/) {
auto SrcBuffer = ur_cast<_ur_buffer *>(SrcMem);
auto DstBuffer = ur_cast<_ur_buffer *>(DstMem);
auto SrcBuffer = ur_cast<ur_buffer *>(SrcMem);
auto DstBuffer = ur_cast<ur_buffer *>(DstMem);

std::shared_lock<ur_shared_mutex> SrcLock(SrcBuffer->Mutex, std::defer_lock);
std::scoped_lock<std::shared_lock<ur_shared_mutex>, ur_shared_mutex> LockAll(
Expand Down Expand Up @@ -1462,7 +1462,7 @@ ur_result_t urCommandBufferAppendMemBufferFillExp(
std::scoped_lock<ur_shared_mutex> Lock(Buffer->Mutex);

char *ZeHandleDst = nullptr;
_ur_buffer *UrBuffer = reinterpret_cast<_ur_buffer *>(Buffer);
ur_buffer *UrBuffer = reinterpret_cast<ur_buffer *>(Buffer);
UR_CALL(UrBuffer->getZeHandle(ZeHandleDst, ur_mem_handle_t_::write_only,
CommandBuffer->Device, nullptr, 0u));

Expand Down Expand Up @@ -1542,7 +1542,7 @@ ur_result_t waitForDependencies(ur_exp_command_buffer_handle_t CommandBuffer,
const bool UseCopyEngine = false;
bool MustSignalWaitEvent = true;
if (NumEventsInWaitList) {
_ur_ze_event_list_t TmpWaitList;
ur_ze_event_list_t TmpWaitList;
UR_CALL(TmpWaitList.createAndRetainUrZeEventList(
NumEventsInWaitList, EventWaitList, Queue, UseCopyEngine));

Expand Down Expand Up @@ -1636,7 +1636,7 @@ ur_result_t enqueueImmediateAppendPath(
assert(CommandListHelper->second.IsImmediate);
assert(Platform->ZeCommandListImmediateAppendExt.Supported);

_ur_ze_event_list_t UrZeEventList;
ur_ze_event_list_t UrZeEventList;
if (NumEventsInWaitList) {
UR_CALL(UrZeEventList.createAndRetainUrZeEventList(
NumEventsInWaitList, EventWaitList, Queue, false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct command_buffer_profiling_t {
ze_kernel_timestamp_result_t *Timestamps;
};

struct ur_exp_command_buffer_handle_t_ : public _ur_object {
struct ur_exp_command_buffer_handle_t_ : public ur_object {
ur_exp_command_buffer_handle_t_(
ur_context_handle_t Context, ur_device_handle_t Device,
ze_command_list_handle_t CommandList,
Expand Down Expand Up @@ -149,7 +149,7 @@ struct ur_exp_command_buffer_handle_t_ : public _ur_object {
CommandHandles;
};

struct ur_exp_command_buffer_command_handle_t_ : public _ur_object {
struct ur_exp_command_buffer_command_handle_t_ : public ur_object {
ur_exp_command_buffer_command_handle_t_(
ur_exp_command_buffer_handle_t CommandBuffer, uint64_t CommandId)
: CommandBuffer(CommandBuffer), CommandId(CommandId) {}
Expand Down
8 changes: 4 additions & 4 deletions unified-runtime/source/adapters/level_zero/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ struct ReferenceCounter {
};

// Base class to store common data
struct _ur_object {
_ur_object() : RefCount{} {}
struct ur_object {
ur_object() : RefCount{} {}

// Must be atomic to prevent data race when incrementing/decrementing.
ReferenceCounter RefCount;
Expand All @@ -284,7 +284,7 @@ struct _ur_object {

// Record for a memory allocation. This structure is used to keep information
// for each memory allocation.
struct MemAllocRecord : _ur_object {
struct MemAllocRecord : ur_object {
MemAllocRecord(ur_context_handle_t Context, bool OwnZeMemHandle = true)
: Context(Context) {
OwnNativeHandle = OwnZeMemHandle;
Expand Down Expand Up @@ -380,4 +380,4 @@ extern thread_local int32_t ErrorAdapterNativeCode;
// Utility function for setting a message and warning
[[maybe_unused]] void setErrorMessage(const char *pMessage,
ur_result_t ErrorCode,
int32_t AdapterErrorCode);
int32_t AdapterErrorCode);
2 changes: 1 addition & 1 deletion unified-runtime/source/adapters/level_zero/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ typedef struct _ze_intel_event_sync_mode_exp_desc_t {

extern const bool UseUSMAllocator;

struct ur_context_handle_t_ : _ur_object {
struct ur_context_handle_t_ : ur_object {
ur_context_handle_t_(ze_context_handle_t ZeContext, uint32_t NumDevices,
const ur_device_handle_t *Devs, bool OwnZeContext)
: ZeContext{ZeContext}, Devices{Devs, Devs + NumDevices},
Expand Down
2 changes: 1 addition & 1 deletion unified-runtime/source/adapters/level_zero/device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct ur_ze_external_memory_data {
size_t size;
};

struct ur_device_handle_t_ : _ur_object {
struct ur_device_handle_t_ : ur_object {
ur_device_handle_t_(ze_device_handle_t Device, ur_platform_handle_t Plt,
ur_device_handle_t ParentDevice = nullptr)
: ZeDevice{Device}, Platform{Plt}, RootDevice{ParentDevice},
Expand Down
26 changes: 13 additions & 13 deletions unified-runtime/source/adapters/level_zero/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "ur_interface_loader.hpp"
#include "ur_level_zero.hpp"

void printZeEventList(const _ur_ze_event_list_t &UrZeEventList) {
void printZeEventList(const ur_ze_event_list_t &UrZeEventList) {
if (UrL0Debug & UR_L0_DEBUG_BASIC) {
std::stringstream ss;
ss << " NumEventsInWaitList " << UrZeEventList.Length << ":";
Expand Down Expand Up @@ -81,7 +81,7 @@ ur_result_t urEnqueueEventsWait(
// Lock automatically releases when this goes out of scope.
std::scoped_lock<ur_shared_mutex> lock(Queue->Mutex);

_ur_ze_event_list_t TmpWaitList = {};
ur_ze_event_list_t TmpWaitList = {};
UR_CALL(TmpWaitList.createAndRetainUrZeEventList(
NumEventsInWaitList, EventWaitList, Queue, UseCopyEngine));

Expand Down Expand Up @@ -198,9 +198,9 @@ ur_result_t urEnqueueEventsWaitWithBarrierExt(

// Helper function for appending a barrier to a command list.
auto insertBarrierIntoCmdList =
[&Queue](ur_command_list_ptr_t CmdList,
_ur_ze_event_list_t &EventWaitList, ur_event_handle_t &Event,
bool IsInternal, bool InterruptBasedEventsEnabled) {
[&Queue](ur_command_list_ptr_t CmdList, ur_ze_event_list_t &EventWaitList,
ur_event_handle_t &Event, bool IsInternal,
bool InterruptBasedEventsEnabled) {
UR_CALL(createEventAndAssociateQueue(
Queue, &Event, UR_COMMAND_EVENTS_WAIT_WITH_BARRIER, CmdList,
IsInternal, InterruptBasedEventsEnabled));
Expand Down Expand Up @@ -281,7 +281,7 @@ ur_result_t urEnqueueEventsWaitWithBarrierExt(
if (NumEventsInWaitList || !UseMultipleCmdlistBarriers ||
Queue->isInOrderQueue()) {
// Retain the events as they will be owned by the result event.
_ur_ze_event_list_t TmpWaitList;
ur_ze_event_list_t TmpWaitList;
UR_CALL(TmpWaitList.createAndRetainUrZeEventList(
NumEventsInWaitList, EventWaitList, Queue, false /*UseCopyEngine=*/));

Expand Down Expand Up @@ -377,7 +377,7 @@ ur_result_t urEnqueueEventsWaitWithBarrierExt(
// command-lists.
std::vector<ur_event_handle_t> EventWaitVector(CmdLists.size());
for (size_t I = 0; I < CmdLists.size(); ++I) {
_ur_ze_event_list_t waitlist;
ur_ze_event_list_t waitlist;
UR_CALL(insertBarrierIntoCmdList(CmdLists[I], waitlist,
EventWaitVector[I], true /*IsInternal*/,
InterruptBasedEventsEnabled));
Expand All @@ -390,7 +390,7 @@ ur_result_t urEnqueueEventsWaitWithBarrierExt(

// Create an event list. It will take ownership over all relevant events so
// we relinquish ownership and let it keep all events it needs.
_ur_ze_event_list_t BaseWaitList;
ur_ze_event_list_t BaseWaitList;
UR_CALL(BaseWaitList.createAndRetainUrZeEventList(
EventWaitVector.size(),
reinterpret_cast<const ur_event_handle_t *>(EventWaitVector.data()),
Expand All @@ -406,7 +406,7 @@ ur_result_t urEnqueueEventsWaitWithBarrierExt(
// If there is only a single queue then insert a barrier and the single
// result event can be used as our active barrier and used as the return
// event. Take into account whether output event is discarded or not.
_ur_ze_event_list_t waitlist;
ur_ze_event_list_t waitlist;
UR_CALL(insertBarrierIntoCmdList(CmdLists[0], waitlist, ResultEvent,
IsInternal, InterruptBasedEventsEnabled));
}
Expand Down Expand Up @@ -743,7 +743,7 @@ ur_result_t urEnqueueTimestampRecordingExp(
ur_device_handle_t Device = Queue->Device;

bool UseCopyEngine = false;
_ur_ze_event_list_t TmpWaitList;
ur_ze_event_list_t TmpWaitList;
UR_CALL(TmpWaitList.createAndRetainUrZeEventList(
NumEventsInWaitList, EventWaitList, Queue, UseCopyEngine));

Expand Down Expand Up @@ -1438,7 +1438,7 @@ ur_result_t ur_event_handle_t_::reset() {
return UR_RESULT_SUCCESS;
}

ur_result_t _ur_ze_event_list_t::createAndRetainUrZeEventList(
ur_result_t ur_ze_event_list_t::createAndRetainUrZeEventList(
uint32_t EventListLength, const ur_event_handle_t *EventList,
ur_queue_handle_t CurQueue, bool UseCopyEngine) {
this->Length = 0;
Expand Down Expand Up @@ -1697,7 +1697,7 @@ ur_result_t _ur_ze_event_list_t::createAndRetainUrZeEventList(
return UR_RESULT_SUCCESS;
}

ur_result_t _ur_ze_event_list_t::insert(_ur_ze_event_list_t &Other) {
ur_result_t ur_ze_event_list_t::insert(ur_ze_event_list_t &Other) {
if (this != &Other) {
// save of the previous object values
uint32_t PreLength = this->Length;
Expand Down Expand Up @@ -1735,7 +1735,7 @@ ur_result_t _ur_ze_event_list_t::insert(_ur_ze_event_list_t &Other) {
return UR_RESULT_SUCCESS;
}

ur_result_t _ur_ze_event_list_t::collectEventsForReleaseAndDestroyUrZeEventList(
ur_result_t ur_ze_event_list_t::collectEventsForReleaseAndDestroyUrZeEventList(
std::list<ur_event_handle_t> &EventsToBeReleased) {
// event wait lists are owned by events, this function is called with owning
// event lock taken, hence it is thread safe
Expand Down
18 changes: 9 additions & 9 deletions unified-runtime/source/adapters/level_zero/event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const bool FilterEventWaitList = [] {
return RetVal;
}();

struct _ur_ze_event_list_t {
struct ur_ze_event_list_t {
// List of level zero events for this event list.
ze_event_handle_t *ZeEventList = {nullptr};

Expand All @@ -95,15 +95,15 @@ struct _ur_ze_event_list_t {
bool UseCopyEngine);

// Add all the events in this object's UrEventList to the end
// of the list EventsToBeReleased. Destroy ur_ze_event_list_t data
// of the list EventsToBeReleased. Destroy ur_ze_event_list_t_t data
// structure fields making it look empty.
ur_result_t collectEventsForReleaseAndDestroyUrZeEventList(
std::list<ur_event_handle_t> &EventsToBeReleased);

// Had to create custom assignment operator because the mutex is
// not assignment copyable. Just field by field copy of the other
// fields.
_ur_ze_event_list_t &operator=(const _ur_ze_event_list_t &other) {
ur_ze_event_list_t &operator=(const ur_ze_event_list_t &other) {
if (this != &other) {
this->ZeEventList = other.ZeEventList;
this->UrEventList = other.UrEventList;
Expand All @@ -112,19 +112,19 @@ struct _ur_ze_event_list_t {
return *this;
}

// This function allows to merge two _ur_ze_event_lists
// This function allows to merge two ur_ze_event_lists
// The ur_ze_event_list "other" is added to the caller list.
// Note that new containers are allocated to contains the additional elements.
// Elements are moved to the new containers.
// other list can not be used after the call to this function.
ur_result_t insert(_ur_ze_event_list_t &Other);
ur_result_t insert(ur_ze_event_list_t &Other);

bool isEmpty() const { return (this->ZeEventList == nullptr); }
};

void printZeEventList(const _ur_ze_event_list_t &PiZeEventList);
void printZeEventList(const ur_ze_event_list_t &PiZeEventList);

struct ur_event_handle_t_ : _ur_object {
struct ur_event_handle_t_ : ur_object {
ur_event_handle_t_(ze_event_handle_t ZeEvent,
ze_event_pool_handle_t ZeEventPool,
ur_context_handle_t Context, ur_command_t CommandType,
Expand Down Expand Up @@ -179,7 +179,7 @@ struct ur_event_handle_t_ : _ur_object {
// signal this event. These events must be retained when the command is
// enqueued, and must then be released when this event has signalled.
// This list must be destroyed once the event has signalled.
_ur_ze_event_list_t WaitList;
ur_ze_event_list_t WaitList;

// Tracks if the needed cleanup was already performed for
// a completed event. This allows to control that some cleanup
Expand Down Expand Up @@ -220,7 +220,7 @@ struct ur_event_handle_t_ : _ur_object {
uint64_t RecordEventEndTimestamp = 0;

// Besides each PI object keeping a total reference count in
// _ur_object::RefCount we keep special track of the event *external*
// ur_object::RefCount we keep special track of the event *external*
// references. This way we are able to tell when the event is not referenced
// externally anymore, i.e. it can't be passed as a dependency event to
// piEnqueue* functions and explicitly waited meaning that we can do some
Expand Down
18 changes: 9 additions & 9 deletions unified-runtime/source/adapters/level_zero/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ ur_result_t bindlessImagesCreateImpl(ur_context_handle_t hContext,
(hContext->ZeContext, reinterpret_cast<const void *>(hImageMem),
&MemAllocProperties, nullptr));
if (MemAllocProperties.type == ZE_MEMORY_TYPE_UNKNOWN) {
_ur_image *UrImage = reinterpret_cast<_ur_image *>(hImageMem);
ur_image *UrImage = reinterpret_cast<ur_image *>(hImageMem);

ZE2UR_CALL(zeImageViewCreateExt,
(hContext->ZeContext, hDevice->ZeDevice, &ZeImageDesc,
Expand Down Expand Up @@ -429,7 +429,7 @@ ur_result_t urBindlessImagesImageCopyExp(
UseCopyEngine = false;
}

_ur_ze_event_list_t TmpWaitList;
ur_ze_event_list_t TmpWaitList;
UR_CALL(TmpWaitList.createAndRetainUrZeEventList(
numEventsInWaitList, phEventWaitList, hQueue, UseCopyEngine));

Expand Down Expand Up @@ -467,7 +467,7 @@ ur_result_t urBindlessImagesImageCopyExp(
ze_image_region_t DstRegion;
UR_CALL(getImageRegionHelper(ZeImageDesc, &pCopyRegion->dstOffset,
&pCopyRegion->copyExtent, DstRegion));
auto *UrImage = static_cast<_ur_image *>(pDst);
auto *UrImage = static_cast<ur_image *>(pDst);
const char *SrcPtr =
static_cast<const char *>(pSrc) +
pCopyRegion->srcOffset.z * SrcSlicePitch +
Expand Down Expand Up @@ -507,7 +507,7 @@ ur_result_t urBindlessImagesImageCopyExp(
ze_image_region_t SrcRegion;
UR_CALL(getImageRegionHelper(ZeImageDesc, &pCopyRegion->srcOffset,
&pCopyRegion->copyExtent, SrcRegion));
auto *UrImage = static_cast<const _ur_image *>(pSrc);
auto *UrImage = static_cast<const ur_image *>(pSrc);
char *DstPtr =
static_cast<char *>(pDst) + pCopyRegion->dstOffset.z * DstSlicePitch +
pCopyRegion->dstOffset.y * DstRowPitch +
Expand Down Expand Up @@ -544,8 +544,8 @@ ur_result_t urBindlessImagesImageCopyExp(
ze_image_region_t SrcRegion;
UR_CALL(getImageRegionHelper(ZeImageDesc, &pCopyRegion->srcOffset,
&pCopyRegion->copyExtent, SrcRegion));
auto *UrImageDst = static_cast<_ur_image *>(pDst);
auto *UrImageSrc = static_cast<const _ur_image *>(pSrc);
auto *UrImageDst = static_cast<ur_image *>(pDst);
auto *UrImageSrc = static_cast<const ur_image *>(pSrc);
ZE2UR_CALL(zeCommandListAppendImageCopyRegion,
(ZeCommandList, UrImageDst->ZeImage, UrImageSrc->ZeImage,
&DstRegion, &SrcRegion, ZeEvent, WaitList.Length,
Expand All @@ -568,7 +568,7 @@ ur_result_t urBindlessImagesImageGetInfoExp(
UR_RESULT_ERROR_INVALID_ENUMERATION);
UR_ASSERT(pPropValue || pPropSizeRet, UR_RESULT_ERROR_INVALID_NULL_POINTER);

auto *UrImage = reinterpret_cast<_ur_image *>(hImageMem);
auto *UrImage = reinterpret_cast<ur_image *>(hImageMem);
ze_image_desc_t &Desc = UrImage->ZeImageDesc;
switch (propName) {
case UR_IMAGE_INFO_WIDTH:
Expand Down Expand Up @@ -963,7 +963,7 @@ ur_result_t urBindlessImagesWaitExternalSemaphoreExp(
// We want to batch these commands to avoid extra submissions (costly)
bool OkToBatch = true;

_ur_ze_event_list_t TmpWaitList;
ur_ze_event_list_t TmpWaitList;
UR_CALL(TmpWaitList.createAndRetainUrZeEventList(
numEventsInWaitList, phEventWaitList, hQueue, UseCopyEngine));

Expand Down Expand Up @@ -1047,7 +1047,7 @@ ur_result_t urBindlessImagesSignalExternalSemaphoreExp(
// We want to batch these commands to avoid extra submissions (costly)
bool OkToBatch = true;

_ur_ze_event_list_t TmpWaitList;
ur_ze_event_list_t TmpWaitList;
UR_CALL(TmpWaitList.createAndRetainUrZeEventList(
numEventsInWaitList, phEventWaitList, hQueue, UseCopyEngine));

Expand Down
4 changes: 2 additions & 2 deletions unified-runtime/source/adapters/level_zero/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ ur_result_t urEnqueueKernelLaunch(
ZE2UR_CALL(zeKernelSetGroupSize, (ZeKernel, WG[0], WG[1], WG[2]));

bool UseCopyEngine = false;
_ur_ze_event_list_t TmpWaitList;
ur_ze_event_list_t TmpWaitList;
UR_CALL(TmpWaitList.createAndRetainUrZeEventList(
NumEventsInWaitList, EventWaitList, Queue, UseCopyEngine));

Expand Down Expand Up @@ -385,7 +385,7 @@ ur_result_t urEnqueueCooperativeKernelLaunchExp(
ZE2UR_CALL(zeKernelSetGroupSize, (ZeKernel, WG[0], WG[1], WG[2]));

bool UseCopyEngine = false;
_ur_ze_event_list_t TmpWaitList;
ur_ze_event_list_t TmpWaitList;
UR_CALL(TmpWaitList.createAndRetainUrZeEventList(
NumEventsInWaitList, EventWaitList, Queue, UseCopyEngine));

Expand Down
Loading