Skip to content

[SYCL] Fix various compilation warnings in plugins #2979

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 5 commits into from
Jan 16, 2021
Merged
Show file tree
Hide file tree
Changes from 4 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: 1 addition & 1 deletion sycl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ set(SYCL_VERSION_STRING "${SYCL_MAJOR_VERSION}.${SYCL_MINOR_VERSION}.${SYCL_PATC
if (MSVC)
set(CMAKE_CXX_FLAGS "/W4 ${CMAKE_CXX_FLAGS}")
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-deprecated-declarations")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-deprecated-declarations -Wno-covered-switch-default")
endif()

if(SYCL_ENABLE_WERROR)
Expand Down
77 changes: 74 additions & 3 deletions sycl/plugins/level_zero/pi_level_zero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ pi_result getInfo(size_t param_value_size, void *param_value,
size_t *param_value_size_ret, T value) {

auto assignment = [](void *param_value, T value, size_t value_size) {
(void)value_size;
*static_cast<T *>(param_value) = value;
};

Expand Down Expand Up @@ -954,8 +955,8 @@ pi_result piPlatformGetInfo(pi_platform Platform, pi_platform_info ParamName,
//
return ReturnValue(Platform->ZeDriverApiVersion.c_str());
default:
// TODO: implement other parameters
die("Unsupported ParamName in piPlatformGetInfo");
zePrint("piPlatformGetInfo: unrecognized ParamName\n");
return PI_INVALID_VALUE;
}

return PI_SUCCESS;
Expand Down Expand Up @@ -1785,6 +1786,9 @@ pi_result piContextCreate(const pi_context_properties *Properties,
const void *PrivateInfo, size_t CB,
void *UserData),
void *UserData, pi_context *RetContext) {
(void)Properties;
(void)PFnNotify;
(void)UserData;
PI_ASSERT(Devices, PI_INVALID_DEVICE);
PI_ASSERT(RetContext, PI_INVALID_VALUE);

Expand Down Expand Up @@ -1831,6 +1835,9 @@ pi_result piContextGetInfo(pi_context Context, pi_context_info ParamName,
pi_result piextContextSetExtendedDeleter(pi_context Context,
pi_context_extended_deleter Function,
void *UserData) {
(void)Context;
(void)Function;
(void)UserData;
die("piextContextSetExtendedDeleter: not supported");
return PI_SUCCESS;
}
Expand Down Expand Up @@ -2143,6 +2150,11 @@ pi_result piMemGetInfo(pi_mem Mem,
cl_mem_info ParamName, // TODO: untie from OpenCL
size_t ParamValueSize, void *ParamValue,
size_t *ParamValueSizeRet) {
(void)Mem;
(void)ParamName;
(void)ParamValueSize;
(void)ParamValue;
(void)ParamValueSizeRet;
die("piMemGetInfo: not implemented");
return {};
}
Expand Down Expand Up @@ -2345,12 +2357,16 @@ pi_result piMemImageCreate(pi_context Context, pi_mem_flags Flags,
}

pi_result piextMemGetNativeHandle(pi_mem Mem, pi_native_handle *NativeHandle) {
(void)Mem;
(void)NativeHandle;
die("piextMemGetNativeHandle: not supported");
return PI_SUCCESS;
}

pi_result piextMemCreateWithNativeHandle(pi_native_handle NativeHandle,
pi_mem *Mem) {
(void)NativeHandle;
(void)Mem;
die("piextMemCreateWithNativeHandle: not supported");
return PI_SUCCESS;
}
Expand Down Expand Up @@ -2431,6 +2447,11 @@ pi_result piclProgramCreateWithSource(pi_context Context, pi_uint32 Count,
const size_t *Lengths,
pi_program *RetProgram) {

(void)Context;
(void)Count;
(void)Strings;
(void)Lengths;
(void)RetProgram;
zePrint("piclProgramCreateWithSource: not supported in Level Zero\n");
return PI_INVALID_OPERATION;
}
Expand Down Expand Up @@ -2580,6 +2601,7 @@ pi_result piProgramLink(pi_context Context, pi_uint32 NumDevices,
const pi_program *InputPrograms,
void (*PFnNotify)(pi_program Program, void *UserData),
void *UserData, pi_program *RetProgram) {
(void)Options;

// We only support one device with Level Zero currently.
pi_device Device = Context->Devices[0];
Expand Down Expand Up @@ -2694,6 +2716,9 @@ pi_result piProgramCompile(
const char *Options, pi_uint32 NumInputHeaders,
const pi_program *InputHeaders, const char **HeaderIncludeNames,
void (*PFnNotify)(pi_program Program, void *UserData), void *UserData) {
(void)NumInputHeaders;
(void)InputHeaders;
(void)HeaderIncludeNames;

// The OpenCL spec says this should return CL_INVALID_PROGRAM, but there is
// no corresponding PI error code.
Expand Down Expand Up @@ -2819,6 +2844,7 @@ pi_result piProgramGetBuildInfo(pi_program Program, pi_device Device,
cl_program_build_info ParamName,
size_t ParamValueSize, void *ParamValue,
size_t *ParamValueSizeRet) {
(void)Device;

ReturnHelper ReturnValue(ParamValueSize, ParamValue, ParamValueSizeRet);
if (ParamName == CL_PROGRAM_BINARY_TYPE) {
Expand Down Expand Up @@ -3251,6 +3277,9 @@ pi_result piKernelGetSubGroupInfo(pi_kernel Kernel, pi_device Device,
size_t InputValueSize, const void *InputValue,
size_t ParamValueSize, void *ParamValue,
size_t *ParamValueSizeRet) {
(void)Device;
(void)InputValueSize;
(void)InputValue;

ze_kernel_properties_t ZeKernelProperties;
ZE_CALL(zeKernelGetProperties(Kernel->ZeKernel, &ZeKernelProperties));
Expand Down Expand Up @@ -3647,11 +3676,17 @@ pi_result piEventSetCallback(pi_event Event, pi_int32 CommandExecCallbackType,
pi_int32 EventCommandStatus,
void *UserData),
void *UserData) {
(void)Event;
(void)CommandExecCallbackType;
(void)PFnNotify;
(void)UserData;
die("piEventSetCallback: deprecated, to be removed");
return PI_SUCCESS;
}

pi_result piEventSetStatus(pi_event Event, pi_int32 ExecutionStatus) {
(void)Event;
(void)ExecutionStatus;
die("piEventSetStatus: deprecated, to be removed");
return PI_SUCCESS;
}
Expand Down Expand Up @@ -3685,12 +3720,16 @@ pi_result piEventRelease(pi_event Event) {

pi_result piextEventGetNativeHandle(pi_event Event,
pi_native_handle *NativeHandle) {
(void)Event;
(void)NativeHandle;
die("piextEventGetNativeHandle: not supported");
return PI_SUCCESS;
}

pi_result piextEventCreateWithNativeHandle(pi_native_handle NativeHandle,
pi_event *Event) {
(void)NativeHandle;
(void)Event;
die("piextEventCreateWithNativeHandle: not supported");
return PI_SUCCESS;
}
Expand Down Expand Up @@ -3817,6 +3856,11 @@ pi_result piSamplerCreate(pi_context Context,
pi_result piSamplerGetInfo(pi_sampler Sampler, pi_sampler_info ParamName,
size_t ParamValueSize, void *ParamValue,
size_t *ParamValueSizeRet) {
(void)Sampler;
(void)ParamName;
(void)ParamValueSize;
(void)ParamValue;
(void)ParamValueSizeRet;

die("piSamplerGetInfo: not implemented");
return {};
Expand Down Expand Up @@ -3844,6 +3888,10 @@ pi_result piSamplerRelease(pi_sampler Sampler) {
//
pi_result piEnqueueEventsWait(pi_queue Queue, pi_uint32 NumEventsInWaitList,
const pi_event *EventWaitList, pi_event *Event) {
(void)Queue;
(void)NumEventsInWaitList;
(void)EventWaitList;
(void)Event;

die("piEnqueueEventsWait: not implemented");
return {};
Expand Down Expand Up @@ -4457,6 +4505,11 @@ pi_result piEnqueueMemUnmap(pi_queue Queue, pi_mem MemObj, void *MappedPtr,
pi_result piMemImageGetInfo(pi_mem Image, pi_image_info ParamName,
size_t ParamValueSize, void *ParamValue,
size_t *ParamValueSizeRet) {
(void)Image;
(void)ParamName;
(void)ParamValueSize;
(void)ParamValue;
(void)ParamValueSizeRet;

die("piMemImageGetInfo: not implemented");
return {};
Expand Down Expand Up @@ -4712,6 +4765,13 @@ pi_result piEnqueueMemImageFill(pi_queue Queue, pi_mem Image,
pi_uint32 NumEventsInWaitList,
const pi_event *EventWaitList,
pi_event *Event) {
(void)Image;
(void)FillColor;
(void)Origin;
(void)Region;
(void)NumEventsInWaitList;
(void)EventWaitList;
(void)Event;

PI_ASSERT(Queue, PI_INVALID_QUEUE);

Expand Down Expand Up @@ -4769,6 +4829,15 @@ pi_result piEnqueueNativeKernel(pi_queue Queue, void (*UserFunc)(void *),
pi_uint32 NumEventsInWaitList,
const pi_event *EventWaitList,
pi_event *Event) {
(void)UserFunc;
(void)Args;
(void)CbArgs;
(void)NumMemObjects;
(void)MemList;
(void)ArgsMemLoc;
(void)NumEventsInWaitList;
(void)EventWaitList;
(void)Event;

PI_ASSERT(Queue, PI_INVALID_QUEUE);

Expand All @@ -4783,6 +4852,7 @@ pi_result piEnqueueNativeKernel(pi_queue Queue, void (*UserFunc)(void *),
pi_result piextGetDeviceFunctionPointer(pi_device Device, pi_program Program,
const char *FunctionName,
pi_uint64 *FunctionPointerRet) {
(void)Device;
PI_ASSERT(Program, PI_INVALID_PROGRAM);

if (Program->State != _pi_program::Exe &&
Expand Down Expand Up @@ -5216,7 +5286,7 @@ pi_result piextUSMEnqueueMemAdvise(pi_queue Queue, const void *Ptr,
return PI_SUCCESS;
}

/// API to query information about USM allocated pointers
/// API to query information about USM allocated pointers.
/// Valid Queries:
/// PI_MEM_ALLOC_TYPE returns host/device/shared pi_usm_type value
/// PI_MEM_ALLOC_BASE_PTR returns the base ptr of an allocation if
Expand Down Expand Up @@ -5294,6 +5364,7 @@ pi_result piextUSMGetMemAllocInfo(pi_context Context, const void *Ptr,

pi_result piKernelSetExecInfo(pi_kernel Kernel, pi_kernel_exec_info ParamName,
size_t ParamValueSize, const void *ParamValue) {
(void)ParamValueSize;
PI_ASSERT(Kernel, PI_INVALID_KERNEL);
PI_ASSERT(ParamValue, PI_INVALID_VALUE);

Expand Down
14 changes: 12 additions & 2 deletions sycl/plugins/opencl/pi_opencl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ CONSTFIX char clCreateBufferWithPropertiesName[] =
CONSTFIX char clSetKernelArgMemPointerName[] = "clSetKernelArgMemPointerINTEL";
CONSTFIX char clEnqueueMemsetName[] = "clEnqueueMemsetINTEL";
CONSTFIX char clEnqueueMemcpyName[] = "clEnqueueMemcpyINTEL";
CONSTFIX char clEnqueueMigrateMemName[] = "clEnqueueMigrateMemINTEL";
CONSTFIX char clEnqueueMemAdviseName[] = "clEnqueueMemAdviseINTEL";
// CONSTFIX char clEnqueueMigrateMemName[] = "clEnqueueMigrateMemINTEL";
// CONSTFIX char clEnqueueMemAdviseName[] = "clEnqueueMemAdviseINTEL";
CONSTFIX char clGetMemAllocInfoName[] = "clGetMemAllocInfoINTEL";
CONSTFIX char clSetProgramSpecializationConstantName[] =
"clSetProgramSpecializationConstant";
Expand Down Expand Up @@ -539,6 +539,8 @@ pi_result piextContextCreateWithNativeHandle(pi_native_handle nativeHandle,
pi_uint32 num_devices,
const pi_device *devices,
pi_context *piContext) {
(void)num_devices;
(void)devices;
assert(piContext != nullptr);
*piContext = reinterpret_cast<pi_context>(nativeHandle);
return PI_SUCCESS;
Expand Down Expand Up @@ -663,6 +665,7 @@ pi_result piKernelGetSubGroupInfo(pi_kernel kernel, pi_device device,
const void *input_value,
size_t param_value_size, void *param_value,
size_t *param_value_size_ret) {
(void)param_value_size;
size_t ret_val;
cl_int ret_err;
ret_err = cast<pi_result>(clGetKernelSubGroupInfo(
Expand Down Expand Up @@ -847,6 +850,7 @@ pi_result piextUSMFree(pi_context context, void *ptr) {
/// \param arg_value is the pointer argument
pi_result piextKernelSetArgPointer(pi_kernel kernel, pi_uint32 arg_index,
size_t arg_size, const void *arg_value) {
(void)arg_size;

// Size is unused in CL as pointer args are passed by value.

Expand Down Expand Up @@ -968,6 +972,9 @@ pi_result piextUSMEnqueuePrefetch(pi_queue queue, const void *ptr, size_t size,
pi_uint32 num_events_in_waitlist,
const pi_event *events_waitlist,
pi_event *event) {
(void)ptr;
(void)size;
(void)flags;

return cast<pi_result>(clEnqueueMarkerWithWaitList(
cast<cl_command_queue>(queue), num_events_in_waitlist,
Expand Down Expand Up @@ -1010,6 +1017,9 @@ pi_result piextUSMEnqueuePrefetch(pi_queue queue, const void *ptr, size_t size,
pi_result piextUSMEnqueueMemAdvise(pi_queue queue, const void *ptr,
size_t length, pi_mem_advice advice,
pi_event *event) {
(void)ptr;
(void)length;
(void)advice;

return cast<pi_result>(
clEnqueueMarkerWithWaitList(cast<cl_command_queue>(queue), 0, nullptr,
Expand Down