Skip to content

[SYCL][UR] Replace _pi_object with _ur_object #9082

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 19, 2023
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
20 changes: 10 additions & 10 deletions sycl/plugins/level_zero/pi_level_zero.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ template <> uint32_t inline pi_cast(uint64_t Value) {

// Record for a memory allocation. This structure is used to keep information
// for each memory allocation.
struct MemAllocRecord : _pi_object {
struct MemAllocRecord : _ur_object {
MemAllocRecord(pi_context Context, bool OwnZeMemHandle = true)
: Context(Context), OwnZeMemHandle(OwnZeMemHandle) {}
// Currently kernel can reference memory allocations from different contexts
Expand Down Expand Up @@ -204,7 +204,7 @@ using pi_command_list_map_t =
// The iterator pointing to a specific command-list in use.
using pi_command_list_ptr_t = pi_command_list_map_t::iterator;

struct _pi_context : _pi_object {
struct _pi_context : _ur_object {
_pi_context(ze_context_handle_t ZeContext, pi_uint32 NumDevices,
const pi_device *Devs, bool OwnZeContext)
: ZeContext{ZeContext}, OwnZeContext{OwnZeContext},
Expand Down Expand Up @@ -411,7 +411,7 @@ struct _pi_context : _pi_object {
}
};

struct _pi_queue : _pi_object {
struct _pi_queue : _ur_object {
// ForceComputeIndex, if non-negative, indicates that the queue must be fixed
// to that particular compute CCS.
_pi_queue(std::vector<ze_command_queue_handle_t> &ComputeQueues,
Expand Down Expand Up @@ -724,7 +724,7 @@ struct _pi_queue : _pi_object {
active_barriers ActiveBarriers;

// Besides each PI object keeping a total reference count in
// _pi_object::RefCount we keep special track of the queue *external*
// _ur_object::RefCount we keep special track of the queue *external*
// references. This way we are able to tell when the queue is being finished
// externally, and can wait for internal references to complete, and do proper
// cleanup of the queue.
Expand Down Expand Up @@ -832,7 +832,7 @@ struct _pi_queue : _pi_object {
bool doReuseDiscardedEvents();
};

struct _pi_mem : _pi_object {
struct _pi_mem : _ur_object {
// Keeps the PI context of this memory handle.
pi_context Context;

Expand Down Expand Up @@ -1071,7 +1071,7 @@ struct _pi_ze_event_list_t {
}
};

struct _pi_event : _pi_object {
struct _pi_event : _ur_object {
_pi_event(ze_event_handle_t ZeEvent, ze_event_pool_handle_t ZeEventPool,
pi_context Context, pi_command_type CommandType, bool OwnZeEvent)
: ZeEvent{ZeEvent}, OwnZeEvent{OwnZeEvent}, ZeEventPool{ZeEventPool},
Expand Down Expand Up @@ -1147,7 +1147,7 @@ struct _pi_event : _pi_object {
bool IsDiscarded = {false};

// Besides each PI object keeping a total reference count in
// _pi_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 All @@ -1168,7 +1168,7 @@ struct _pi_event : _pi_object {
pi_result reset();
};

struct _pi_program : _pi_object {
struct _pi_program : _ur_object {
// Possible states of a program.
typedef enum {
// The program has been created from intermediate language (SPIR-V), but it
Expand Down Expand Up @@ -1281,7 +1281,7 @@ struct _pi_program : _pi_object {
ze_module_build_log_handle_t ZeBuildLog;
};

struct _pi_kernel : _pi_object {
struct _pi_kernel : _ur_object {
_pi_kernel(ze_kernel_handle_t Kernel, bool OwnZeKernel, pi_program Program)
: ZeKernel{Kernel}, OwnZeKernel{OwnZeKernel}, Program{Program},
MemAllocs{}, SubmissionsCount{0} {}
Expand Down Expand Up @@ -1358,7 +1358,7 @@ struct _pi_kernel : _pi_object {
ZeCache<std::string> ZeKernelName;
};

struct _pi_sampler : _pi_object {
struct _pi_sampler : _ur_object {
_pi_sampler(ze_sampler_handle_t Sampler) : ZeSampler{Sampler} {}

// Level Zero sampler handle.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ enum EventsScope {
LastCommandInBatchHostVisible
};

struct _ur_device_handle_t : _pi_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
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

#include "ur_level_zero_common.hpp"

struct _ur_context_handle_t : _pi_object {
struct _ur_context_handle_t : _ur_object {
_ur_context_handle_t() {}
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

#include "ur_level_zero_common.hpp"

struct _ur_event_handle_t : _pi_object {
struct _ur_event_handle_t : _ur_object {
_ur_event_handle_t() {}
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

#include "ur_level_zero_common.hpp"

struct _ur_mem_handle_t : _pi_object {
struct _ur_mem_handle_t : _ur_object {
_ur_mem_handle_t() {}
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

#include "ur_level_zero_common.hpp"

struct _ur_module_handle_t : _pi_object {
struct _ur_module_handle_t : _ur_object {
_ur_module_handle_t() {}
};

struct _ur_kernel_handle_t : _pi_object {
struct _ur_kernel_handle_t : _ur_object {
_ur_kernel_handle_t() {}
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

#include "ur_level_zero_common.hpp"

struct _ur_program_handle_t : _pi_object {
struct _ur_program_handle_t : _ur_object {
_ur_program_handle_t() {}
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

#include "ur_level_zero_common.hpp"

struct _ur_queue_handle_t : _pi_object {
struct _ur_queue_handle_t : _ur_object {
_ur_queue_handle_t() {}
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

#include "ur_level_zero_common.hpp"

struct _ur_sampler_handle_t : _pi_object {
struct _ur_sampler_handle_t : _ur_object {
_ur_sampler_handle_t() {}
};
4 changes: 2 additions & 2 deletions sycl/plugins/unified_runtime/ur/ur.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ struct ReferenceCounter {
};

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

// Must be atomic to prevent data race when incrementing/decrementing.
ReferenceCounter RefCount;
Expand Down