Skip to content
Closed
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
2 changes: 2 additions & 0 deletions cmake/helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ function(add_ur_target_compile_options name)
-Wformat
-Wformat-security
-Wunused-parameter
-Wno-error=unknown-pragmas

# Hardening options
-fPIC
Expand All @@ -87,6 +88,7 @@ function(add_ur_target_compile_options name)
# Colored output
$<$<CXX_COMPILER_ID:GNU>:-fdiagnostics-color=always>
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-fcolor-diagnostics>
$<$<AND:$<CXX_COMPILER_ID:Clang>,$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,13>>:-Werror=reserved-identifier>
)
if (UR_DEVELOPER_MODE)
target_compile_options(${name} PRIVATE -Werror)
Expand Down
2 changes: 1 addition & 1 deletion scripts/templates/ldrddi.cpp.mako
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace ur_loader
%if 'condition' in obj:
#if ${th.subt(n, tags, obj['condition'])}
%endif
__${x}dlllocal ${x}_result_t ${X}_APICALL
${X}_DLL_LOCAL ${x}_result_t ${X}_APICALL
${th.make_func_name(n, tags, obj)}(
%for line in th.make_param_lines(n, tags, obj):
${line}
Expand Down
2 changes: 1 addition & 1 deletion scripts/templates/libddi.cpp.mako
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace ${x}_lib
///////////////////////////////////////////////////////////////////////////////


__${x}dlllocal ${x}_result_t context_t::ddiInit()
${X}_DLL_LOCAL ${x}_result_t context_t::ddiInit()
{
${x}_result_t result = ${X}_RESULT_SUCCESS;

Expand Down
2 changes: 1 addition & 1 deletion scripts/templates/mockddi.cpp.mako
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace driver
%if 'condition' in obj:
#if ${th.subt(n, tags, obj['condition'])}
%endif
__${x}dlllocal ${x}_result_t ${X}_APICALL
${X}_DLL_LOCAL ${x}_result_t ${X}_APICALL
${fname}(
%for line in th.make_param_lines(n, tags, obj):
${line}
Expand Down
4 changes: 2 additions & 2 deletions scripts/templates/trcddi.cpp.mako
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace ur_tracing_layer
%if 'condition' in obj:
#if ${th.subt(n, tags, obj['condition'])}
%endif
__${x}dlllocal ${x}_result_t ${X}_APICALL
${X}_DLL_LOCAL ${x}_result_t ${X}_APICALL
${th.make_func_name(n, tags, obj)}(
%for line in th.make_param_lines(n, tags, obj):
${line}
Expand Down Expand Up @@ -75,7 +75,7 @@ namespace ur_tracing_layer
/// - ::${X}_RESULT_SUCCESS
/// - ::${X}_RESULT_ERROR_INVALID_NULL_POINTER
/// - ::${X}_RESULT_ERROR_UNSUPPORTED_VERSION
__${x}dlllocal ${x}_result_t ${X}_APICALL
${X}_DLL_LOCAL ${x}_result_t ${X}_APICALL
${tbl['export']['name']}(
%for line in th.make_param_lines(n, tags, tbl['export']):
${line}
Expand Down
2 changes: 1 addition & 1 deletion scripts/templates/valddi.cpp.mako
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace ur_validation_layer
%if 'condition' in obj:
#if ${th.subt(n, tags, obj['condition'])}
%endif
__${x}dlllocal ${x}_result_t ${X}_APICALL
${X}_DLL_LOCAL ${x}_result_t ${X}_APICALL
${func_name}(
%for line in th.make_param_lines(n, tags, obj):
${line}
Expand Down
11 changes: 5 additions & 6 deletions source/adapters/cuda/program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ ur_program_handle_t_::setMetadata(const ur_program_metadata_t *Metadata,

auto [Prefix, Tag] = splitMetadataName(MetadataElementName);

if (Tag == __SYCL_UR_PROGRAM_METADATA_TAG_REQD_WORK_GROUP_SIZE ||
Tag == __SYCL_UR_PROGRAM_METADATA_TAG_MAX_WORK_GROUP_SIZE) {
if (Tag == SYCL_UR_PROGRAM_METADATA_TAG_REQD_WORK_GROUP_SIZE ||
Tag == SYCL_UR_PROGRAM_METADATA_TAG_MAX_WORK_GROUP_SIZE) {
// If metadata is reqd_work_group_size/max_work_group_size, record it for
// the corresponding kernel name.
size_t MDElemsSize = MetadataElement.size - sizeof(std::uint64_t);
Expand All @@ -83,20 +83,19 @@ ur_program_handle_t_::setMetadata(const ur_program_metadata_t *Metadata,
// Read values and pad with 1's for values not present.
std::array<uint32_t, 3> WorkGroupElements = {1, 1, 1};
std::memcpy(WorkGroupElements.data(), ValuePtr, MDElemsSize);
(Tag == __SYCL_UR_PROGRAM_METADATA_TAG_REQD_WORK_GROUP_SIZE
(Tag == SYCL_UR_PROGRAM_METADATA_TAG_REQD_WORK_GROUP_SIZE
? KernelReqdWorkGroupSizeMD
: KernelMaxWorkGroupSizeMD)[Prefix] =
std::make_tuple(WorkGroupElements[0], WorkGroupElements[1],
WorkGroupElements[2]);
} else if (Tag == __SYCL_UR_PROGRAM_METADATA_GLOBAL_ID_MAPPING) {
} else if (Tag == SYCL_UR_PROGRAM_METADATA_GLOBAL_ID_MAPPING) {
const char *MetadataValPtr =
reinterpret_cast<const char *>(MetadataElement.value.pData) +
sizeof(std::uint64_t);
const char *MetadataValPtrEnd =
MetadataValPtr + MetadataElement.size - sizeof(std::uint64_t);
GlobalIDMD[Prefix] = std::string{MetadataValPtr, MetadataValPtrEnd};
} else if (Tag ==
__SYCL_UR_PROGRAM_METADATA_TAG_MAX_LINEAR_WORK_GROUP_SIZE) {
} else if (Tag == SYCL_UR_PROGRAM_METADATA_TAG_MAX_LINEAR_WORK_GROUP_SIZE) {
KernelMaxLinearWorkGroupSizeMD[Prefix] = MetadataElement.value.data64;
}
}
Expand Down
7 changes: 3 additions & 4 deletions source/adapters/hip/program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,17 @@ ur_program_handle_t_::setMetadata(const ur_program_metadata_t *Metadata,

auto [Prefix, Tag] = splitMetadataName(MetadataElementName);

if (MetadataElementName ==
__SYCL_UR_PROGRAM_METADATA_TAG_NEED_FINALIZATION) {
if (MetadataElementName == SYCL_UR_PROGRAM_METADATA_TAG_NEED_FINALIZATION) {
assert(MetadataElement.type == UR_PROGRAM_METADATA_TYPE_UINT32);
IsRelocatable = MetadataElement.value.data32;
} else if (Tag == __SYCL_UR_PROGRAM_METADATA_GLOBAL_ID_MAPPING) {
} else if (Tag == SYCL_UR_PROGRAM_METADATA_GLOBAL_ID_MAPPING) {
const char *MetadataValPtr =
reinterpret_cast<const char *>(MetadataElement.value.pData) +
sizeof(std::uint64_t);
const char *MetadataValPtrEnd =
MetadataValPtr + MetadataElement.size - sizeof(std::uint64_t);
GlobalIDMD[Prefix] = std::string{MetadataValPtr, MetadataValPtrEnd};
} else if (Tag == __SYCL_UR_PROGRAM_METADATA_TAG_REQD_WORK_GROUP_SIZE) {
} else if (Tag == SYCL_UR_PROGRAM_METADATA_TAG_REQD_WORK_GROUP_SIZE) {
// If metadata is reqd_work_group_size, record it for the corresponding
// kernel name.
size_t MDElemsSize = MetadataElement.size - sizeof(std::uint64_t);
Expand Down
4 changes: 2 additions & 2 deletions source/adapters/level_zero/command_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,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 @@ -122,7 +122,7 @@ struct ur_exp_command_buffer_handle_t_ : public _ur_object {
std::vector<ur_kernel_handle_t> KernelsList;
};

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,
uint64_t, uint32_t, bool,
ur_kernel_handle_t);
Expand Down
6 changes: 3 additions & 3 deletions source/adapters/level_zero/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,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 @@ -432,7 +432,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
2 changes: 1 addition & 1 deletion source/adapters/level_zero/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct l0_command_list_cache_info {
bool IsImmediate = false;
};

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 source/adapters/level_zero/device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,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
4 changes: 2 additions & 2 deletions source/adapters/level_zero/event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ struct _ur_ze_event_list_t {

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 @@ -216,7 +216,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
2 changes: 1 addition & 1 deletion source/adapters/level_zero/kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "memory.hpp"
#include <unordered_set>

struct ur_kernel_handle_t_ : _ur_object {
struct ur_kernel_handle_t_ : ur_object_ {
ur_kernel_handle_t_(bool OwnZeHandle, ur_program_handle_t Program)
: Context{nullptr}, Program{Program}, ZeKernel{nullptr},
SubmissionsCount{0}, MemAllocs{} {
Expand Down
2 changes: 1 addition & 1 deletion source/adapters/level_zero/memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ ur_result_t enqueueMemCopyRectHelper(
uint32_t NumEventsInWaitList, const ur_event_handle_t *EventWaitList,
ur_event_handle_t *OutEvent, bool PreferCopyEngine = false);

struct ur_mem_handle_t_ : _ur_object {
struct ur_mem_handle_t_ : ur_object_ {
// Keeps the PI context of this memory handle.
ur_context_handle_t UrContext;

Expand Down
2 changes: 1 addition & 1 deletion source/adapters/level_zero/physical_mem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "common.hpp"

struct ur_physical_mem_handle_t_ : _ur_object {
struct ur_physical_mem_handle_t_ : ur_object_ {
ur_physical_mem_handle_t_(ze_physical_mem_handle_t ZePhysicalMem,
ur_context_handle_t Context)
: ZePhysicalMem{ZePhysicalMem}, Context{Context} {}
Expand Down
2 changes: 1 addition & 1 deletion source/adapters/level_zero/platform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct ur_zes_device_handle_data_t {
ze_bool_t SubDevice = false;
};

struct ur_platform_handle_t_ : public _ur_platform {
struct ur_platform_handle_t_ : public ur_platform {
ur_platform_handle_t_(ze_driver_handle_t Driver)
: ZeDriver{Driver}, ZeApiVersion{ZE_API_VERSION_CURRENT} {}
// Performs initialization of a newly constructed PI platform.
Expand Down
2 changes: 1 addition & 1 deletion source/adapters/level_zero/program.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "common.hpp"

struct ur_program_handle_t_ : _ur_object {
struct ur_program_handle_t_ : ur_object_ {
// ur_program_handle_t_() {}

typedef enum {
Expand Down
4 changes: 2 additions & 2 deletions source/adapters/level_zero/queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ using ur_command_list_map_t =
// The iterator pointing to a specific command-list in use.
using ur_command_list_ptr_t = ur_command_list_map_t::iterator;

struct ur_queue_handle_t_ : _ur_object {
struct ur_queue_handle_t_ : ur_object_ {
ur_queue_handle_t_(std::vector<ze_command_queue_handle_t> &ComputeQueues,
std::vector<ze_command_queue_handle_t> &CopyQueues,
ur_context_handle_t Context, ur_device_handle_t Device,
Expand Down Expand Up @@ -419,7 +419,7 @@ struct ur_queue_handle_t_ : _ur_object {
active_barriers ActiveBarriers;

// Besides each PI object keeping a total reference count in
// _ur_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
2 changes: 1 addition & 1 deletion source/adapters/level_zero/sampler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "common.hpp"

struct ur_sampler_handle_t_ : _ur_object {
struct ur_sampler_handle_t_ : ur_object_ {
ur_sampler_handle_t_(ze_sampler_handle_t Sampler) : ZeSampler{Sampler} {}

// Level Zero sampler handle.
Expand Down
2 changes: 1 addition & 1 deletion source/adapters/level_zero/usm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

usm::DisjointPoolAllConfigs InitializeDisjointPoolConfig();

struct ur_usm_pool_handle_t_ : _ur_object {
struct ur_usm_pool_handle_t_ : ur_object_ {
bool zeroInit;

usm::DisjointPoolAllConfigs DisjointPoolConfigs =
Expand Down
2 changes: 1 addition & 1 deletion source/adapters/level_zero/v2/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "event_pool_cache.hpp"
#include "usm.hpp"

struct ur_context_handle_t_ : _ur_object {
struct ur_context_handle_t_ : ur_object_ {
ur_context_handle_t_(ze_context_handle_t hContext, uint32_t numDevices,
const ur_device_handle_t *phDevices, bool ownZeContext);

Expand Down
2 changes: 1 addition & 1 deletion source/adapters/level_zero/v2/event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace v2 {
class event_pool;
}

struct ur_event_handle_t_ : _ur_object {
struct ur_event_handle_t_ : ur_object_ {
public:
ur_event_handle_t_(v2::event_allocation eventAllocation,
v2::event_pool *pool);
Expand Down
2 changes: 1 addition & 1 deletion source/adapters/level_zero/v2/kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct ur_single_device_kernel_t {
mutable ZeCache<ZeStruct<ze_kernel_properties_t>> zeKernelProperties;
};

struct ur_kernel_handle_t_ : _ur_object {
struct ur_kernel_handle_t_ : ur_object_ {
private:
public:
ur_kernel_handle_t_(ur_program_handle_t hProgram, const char *kernelName);
Expand Down
2 changes: 1 addition & 1 deletion source/adapters/level_zero/v2/memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "../device.hpp"
#include "common.hpp"

struct ur_mem_handle_t_ : _ur_object {
struct ur_mem_handle_t_ : ur_object_ {
ur_mem_handle_t_(ur_context_handle_t hContext, size_t size);
virtual ~ur_mem_handle_t_() = default;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct ur_command_list_handler_t {
ze_event_handle_t lastEvent = nullptr;
};

struct ur_queue_immediate_in_order_t : _ur_object, public ur_queue_handle_t_ {
struct ur_queue_immediate_in_order_t : ur_object_, public ur_queue_handle_t_ {
private:
ur_context_handle_t hContext;
ur_device_handle_t hDevice;
Expand Down
2 changes: 1 addition & 1 deletion source/adapters/level_zero/v2/usm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "common.hpp"
#include "ur_pool_manager.hpp"

struct ur_usm_pool_handle_t_ : _ur_object {
struct ur_usm_pool_handle_t_ : ur_object_ {
ur_usm_pool_handle_t_(ur_context_handle_t hContext,
ur_usm_pool_desc_t *pPoolDes);

Expand Down
2 changes: 1 addition & 1 deletion source/adapters/mock/ur_mock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

namespace driver {
///////////////////////////////////////////////////////////////////////////////
class __urdlllocal context_t {
class UR_DLL_LOCAL context_t {
public:
ur_api_version_t version = UR_API_VERSION_CURRENT;

Expand Down
Loading
Loading