Skip to content

Commit 9848d9f

Browse files
[SYCL] Fix various compilation warnings in plugins (#2979)
* [SYCL] Fix various compilation warnings in plugins - default label in switch which covers all enumeration items; - add -Wno-covered-switch-default to plugin compilation switches on Linux - unused variables Signed-off-by: Chris Perkins <[email protected]>
1 parent d43b92a commit 9848d9f

File tree

3 files changed

+90
-5
lines changed

3 files changed

+90
-5
lines changed

sycl/plugins/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
22

3+
if(NOT MSVC)
4+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-covered-switch-default")
5+
endif()
6+
37
if(SYCL_BUILD_PI_CUDA)
48
add_subdirectory(cuda)
59
endif()

sycl/plugins/level_zero/pi_level_zero.cpp

Lines changed: 74 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ pi_result getInfo(size_t param_value_size, void *param_value,
117117
size_t *param_value_size_ret, T value) {
118118

119119
auto assignment = [](void *param_value, T value, size_t value_size) {
120+
(void)value_size;
120121
*static_cast<T *>(param_value) = value;
121122
};
122123

@@ -1089,8 +1090,8 @@ pi_result piPlatformGetInfo(pi_platform Platform, pi_platform_info ParamName,
10891090
//
10901091
return ReturnValue(Platform->ZeDriverApiVersion.c_str());
10911092
default:
1092-
// TODO: implement other parameters
1093-
die("Unsupported ParamName in piPlatformGetInfo");
1093+
zePrint("piPlatformGetInfo: unrecognized ParamName\n");
1094+
return PI_INVALID_VALUE;
10941095
}
10951096

10961097
return PI_SUCCESS;
@@ -1912,6 +1913,9 @@ pi_result piContextCreate(const pi_context_properties *Properties,
19121913
const void *PrivateInfo, size_t CB,
19131914
void *UserData),
19141915
void *UserData, pi_context *RetContext) {
1916+
(void)Properties;
1917+
(void)PFnNotify;
1918+
(void)UserData;
19151919
PI_ASSERT(Devices, PI_INVALID_DEVICE);
19161920
PI_ASSERT(RetContext, PI_INVALID_VALUE);
19171921

@@ -1958,6 +1962,9 @@ pi_result piContextGetInfo(pi_context Context, pi_context_info ParamName,
19581962
pi_result piextContextSetExtendedDeleter(pi_context Context,
19591963
pi_context_extended_deleter Function,
19601964
void *UserData) {
1965+
(void)Context;
1966+
(void)Function;
1967+
(void)UserData;
19611968
die("piextContextSetExtendedDeleter: not supported");
19621969
return PI_SUCCESS;
19631970
}
@@ -2294,6 +2301,11 @@ pi_result piMemGetInfo(pi_mem Mem,
22942301
cl_mem_info ParamName, // TODO: untie from OpenCL
22952302
size_t ParamValueSize, void *ParamValue,
22962303
size_t *ParamValueSizeRet) {
2304+
(void)Mem;
2305+
(void)ParamName;
2306+
(void)ParamValueSize;
2307+
(void)ParamValue;
2308+
(void)ParamValueSizeRet;
22972309
die("piMemGetInfo: not implemented");
22982310
return {};
22992311
}
@@ -2496,12 +2508,16 @@ pi_result piMemImageCreate(pi_context Context, pi_mem_flags Flags,
24962508
}
24972509

24982510
pi_result piextMemGetNativeHandle(pi_mem Mem, pi_native_handle *NativeHandle) {
2511+
(void)Mem;
2512+
(void)NativeHandle;
24992513
die("piextMemGetNativeHandle: not supported");
25002514
return PI_SUCCESS;
25012515
}
25022516

25032517
pi_result piextMemCreateWithNativeHandle(pi_native_handle NativeHandle,
25042518
pi_mem *Mem) {
2519+
(void)NativeHandle;
2520+
(void)Mem;
25052521
die("piextMemCreateWithNativeHandle: not supported");
25062522
return PI_SUCCESS;
25072523
}
@@ -2582,6 +2598,11 @@ pi_result piclProgramCreateWithSource(pi_context Context, pi_uint32 Count,
25822598
const size_t *Lengths,
25832599
pi_program *RetProgram) {
25842600

2601+
(void)Context;
2602+
(void)Count;
2603+
(void)Strings;
2604+
(void)Lengths;
2605+
(void)RetProgram;
25852606
zePrint("piclProgramCreateWithSource: not supported in Level Zero\n");
25862607
return PI_INVALID_OPERATION;
25872608
}
@@ -2731,6 +2752,7 @@ pi_result piProgramLink(pi_context Context, pi_uint32 NumDevices,
27312752
const pi_program *InputPrograms,
27322753
void (*PFnNotify)(pi_program Program, void *UserData),
27332754
void *UserData, pi_program *RetProgram) {
2755+
(void)Options;
27342756

27352757
// We only support one device with Level Zero currently.
27362758
pi_device Device = Context->Devices[0];
@@ -2845,6 +2867,9 @@ pi_result piProgramCompile(
28452867
const char *Options, pi_uint32 NumInputHeaders,
28462868
const pi_program *InputHeaders, const char **HeaderIncludeNames,
28472869
void (*PFnNotify)(pi_program Program, void *UserData), void *UserData) {
2870+
(void)NumInputHeaders;
2871+
(void)InputHeaders;
2872+
(void)HeaderIncludeNames;
28482873

28492874
// The OpenCL spec says this should return CL_INVALID_PROGRAM, but there is
28502875
// no corresponding PI error code.
@@ -2970,6 +2995,7 @@ pi_result piProgramGetBuildInfo(pi_program Program, pi_device Device,
29702995
cl_program_build_info ParamName,
29712996
size_t ParamValueSize, void *ParamValue,
29722997
size_t *ParamValueSizeRet) {
2998+
(void)Device;
29732999

29743000
ReturnHelper ReturnValue(ParamValueSize, ParamValue, ParamValueSizeRet);
29753001
if (ParamName == CL_PROGRAM_BINARY_TYPE) {
@@ -3402,6 +3428,9 @@ pi_result piKernelGetSubGroupInfo(pi_kernel Kernel, pi_device Device,
34023428
size_t InputValueSize, const void *InputValue,
34033429
size_t ParamValueSize, void *ParamValue,
34043430
size_t *ParamValueSizeRet) {
3431+
(void)Device;
3432+
(void)InputValueSize;
3433+
(void)InputValue;
34053434

34063435
ze_kernel_properties_t ZeKernelProperties;
34073436
ZE_CALL(zeKernelGetProperties(Kernel->ZeKernel, &ZeKernelProperties));
@@ -3795,11 +3824,17 @@ pi_result piEventSetCallback(pi_event Event, pi_int32 CommandExecCallbackType,
37953824
pi_int32 EventCommandStatus,
37963825
void *UserData),
37973826
void *UserData) {
3827+
(void)Event;
3828+
(void)CommandExecCallbackType;
3829+
(void)PFnNotify;
3830+
(void)UserData;
37983831
die("piEventSetCallback: deprecated, to be removed");
37993832
return PI_SUCCESS;
38003833
}
38013834

38023835
pi_result piEventSetStatus(pi_event Event, pi_int32 ExecutionStatus) {
3836+
(void)Event;
3837+
(void)ExecutionStatus;
38033838
die("piEventSetStatus: deprecated, to be removed");
38043839
return PI_SUCCESS;
38053840
}
@@ -3838,12 +3873,16 @@ pi_result piEventRelease(pi_event Event) {
38383873

38393874
pi_result piextEventGetNativeHandle(pi_event Event,
38403875
pi_native_handle *NativeHandle) {
3876+
(void)Event;
3877+
(void)NativeHandle;
38413878
die("piextEventGetNativeHandle: not supported");
38423879
return PI_SUCCESS;
38433880
}
38443881

38453882
pi_result piextEventCreateWithNativeHandle(pi_native_handle NativeHandle,
38463883
pi_event *Event) {
3884+
(void)NativeHandle;
3885+
(void)Event;
38473886
die("piextEventCreateWithNativeHandle: not supported");
38483887
return PI_SUCCESS;
38493888
}
@@ -3970,6 +4009,11 @@ pi_result piSamplerCreate(pi_context Context,
39704009
pi_result piSamplerGetInfo(pi_sampler Sampler, pi_sampler_info ParamName,
39714010
size_t ParamValueSize, void *ParamValue,
39724011
size_t *ParamValueSizeRet) {
4012+
(void)Sampler;
4013+
(void)ParamName;
4014+
(void)ParamValueSize;
4015+
(void)ParamValue;
4016+
(void)ParamValueSizeRet;
39734017

39744018
die("piSamplerGetInfo: not implemented");
39754019
return {};
@@ -3997,6 +4041,10 @@ pi_result piSamplerRelease(pi_sampler Sampler) {
39974041
//
39984042
pi_result piEnqueueEventsWait(pi_queue Queue, pi_uint32 NumEventsInWaitList,
39994043
const pi_event *EventWaitList, pi_event *Event) {
4044+
(void)Queue;
4045+
(void)NumEventsInWaitList;
4046+
(void)EventWaitList;
4047+
(void)Event;
40004048

40014049
die("piEnqueueEventsWait: not implemented");
40024050
return {};
@@ -4572,6 +4620,11 @@ pi_result piEnqueueMemUnmap(pi_queue Queue, pi_mem MemObj, void *MappedPtr,
45724620
pi_result piMemImageGetInfo(pi_mem Image, pi_image_info ParamName,
45734621
size_t ParamValueSize, void *ParamValue,
45744622
size_t *ParamValueSizeRet) {
4623+
(void)Image;
4624+
(void)ParamName;
4625+
(void)ParamValueSize;
4626+
(void)ParamValue;
4627+
(void)ParamValueSizeRet;
45754628

45764629
die("piMemImageGetInfo: not implemented");
45774630
return {};
@@ -4823,6 +4876,13 @@ pi_result piEnqueueMemImageFill(pi_queue Queue, pi_mem Image,
48234876
pi_uint32 NumEventsInWaitList,
48244877
const pi_event *EventWaitList,
48254878
pi_event *Event) {
4879+
(void)Image;
4880+
(void)FillColor;
4881+
(void)Origin;
4882+
(void)Region;
4883+
(void)NumEventsInWaitList;
4884+
(void)EventWaitList;
4885+
(void)Event;
48264886

48274887
PI_ASSERT(Queue, PI_INVALID_QUEUE);
48284888

@@ -4880,6 +4940,15 @@ pi_result piEnqueueNativeKernel(pi_queue Queue, void (*UserFunc)(void *),
48804940
pi_uint32 NumEventsInWaitList,
48814941
const pi_event *EventWaitList,
48824942
pi_event *Event) {
4943+
(void)UserFunc;
4944+
(void)Args;
4945+
(void)CbArgs;
4946+
(void)NumMemObjects;
4947+
(void)MemList;
4948+
(void)ArgsMemLoc;
4949+
(void)NumEventsInWaitList;
4950+
(void)EventWaitList;
4951+
(void)Event;
48834952

48844953
PI_ASSERT(Queue, PI_INVALID_QUEUE);
48854954

@@ -4894,6 +4963,7 @@ pi_result piEnqueueNativeKernel(pi_queue Queue, void (*UserFunc)(void *),
48944963
pi_result piextGetDeviceFunctionPointer(pi_device Device, pi_program Program,
48954964
const char *FunctionName,
48964965
pi_uint64 *FunctionPointerRet) {
4966+
(void)Device;
48974967
PI_ASSERT(Program, PI_INVALID_PROGRAM);
48984968

48994969
if (Program->State != _pi_program::Exe &&
@@ -5317,7 +5387,7 @@ pi_result piextUSMEnqueueMemAdvise(pi_queue Queue, const void *Ptr,
53175387
return PI_SUCCESS;
53185388
}
53195389

5320-
/// API to query information about USM allocated pointers
5390+
/// API to query information about USM allocated pointers.
53215391
/// Valid Queries:
53225392
/// PI_MEM_ALLOC_TYPE returns host/device/shared pi_usm_type value
53235393
/// PI_MEM_ALLOC_BASE_PTR returns the base ptr of an allocation if
@@ -5395,6 +5465,7 @@ pi_result piextUSMGetMemAllocInfo(pi_context Context, const void *Ptr,
53955465

53965466
pi_result piKernelSetExecInfo(pi_kernel Kernel, pi_kernel_exec_info ParamName,
53975467
size_t ParamValueSize, const void *ParamValue) {
5468+
(void)ParamValueSize;
53985469
PI_ASSERT(Kernel, PI_INVALID_KERNEL);
53995470
PI_ASSERT(ParamValue, PI_INVALID_VALUE);
54005471

sycl/plugins/opencl/pi_opencl.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ CONSTFIX char clCreateBufferWithPropertiesName[] =
6060
CONSTFIX char clSetKernelArgMemPointerName[] = "clSetKernelArgMemPointerINTEL";
6161
CONSTFIX char clEnqueueMemsetName[] = "clEnqueueMemsetINTEL";
6262
CONSTFIX char clEnqueueMemcpyName[] = "clEnqueueMemcpyINTEL";
63-
CONSTFIX char clEnqueueMigrateMemName[] = "clEnqueueMigrateMemINTEL";
64-
CONSTFIX char clEnqueueMemAdviseName[] = "clEnqueueMemAdviseINTEL";
63+
// CONSTFIX char clEnqueueMigrateMemName[] = "clEnqueueMigrateMemINTEL";
64+
// CONSTFIX char clEnqueueMemAdviseName[] = "clEnqueueMemAdviseINTEL";
6565
CONSTFIX char clGetMemAllocInfoName[] = "clGetMemAllocInfoINTEL";
6666
CONSTFIX char clSetProgramSpecializationConstantName[] =
6767
"clSetProgramSpecializationConstant";
@@ -539,6 +539,8 @@ pi_result piextContextCreateWithNativeHandle(pi_native_handle nativeHandle,
539539
pi_uint32 num_devices,
540540
const pi_device *devices,
541541
pi_context *piContext) {
542+
(void)num_devices;
543+
(void)devices;
542544
assert(piContext != nullptr);
543545
*piContext = reinterpret_cast<pi_context>(nativeHandle);
544546
return PI_SUCCESS;
@@ -663,6 +665,7 @@ pi_result piKernelGetSubGroupInfo(pi_kernel kernel, pi_device device,
663665
const void *input_value,
664666
size_t param_value_size, void *param_value,
665667
size_t *param_value_size_ret) {
668+
(void)param_value_size;
666669
size_t ret_val;
667670
cl_int ret_err;
668671
ret_err = cast<pi_result>(clGetKernelSubGroupInfo(
@@ -847,6 +850,7 @@ pi_result piextUSMFree(pi_context context, void *ptr) {
847850
/// \param arg_value is the pointer argument
848851
pi_result piextKernelSetArgPointer(pi_kernel kernel, pi_uint32 arg_index,
849852
size_t arg_size, const void *arg_value) {
853+
(void)arg_size;
850854

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

@@ -968,6 +972,9 @@ pi_result piextUSMEnqueuePrefetch(pi_queue queue, const void *ptr, size_t size,
968972
pi_uint32 num_events_in_waitlist,
969973
const pi_event *events_waitlist,
970974
pi_event *event) {
975+
(void)ptr;
976+
(void)size;
977+
(void)flags;
971978

972979
return cast<pi_result>(clEnqueueMarkerWithWaitList(
973980
cast<cl_command_queue>(queue), num_events_in_waitlist,
@@ -1010,6 +1017,9 @@ pi_result piextUSMEnqueuePrefetch(pi_queue queue, const void *ptr, size_t size,
10101017
pi_result piextUSMEnqueueMemAdvise(pi_queue queue, const void *ptr,
10111018
size_t length, pi_mem_advice advice,
10121019
pi_event *event) {
1020+
(void)ptr;
1021+
(void)length;
1022+
(void)advice;
10131023

10141024
return cast<pi_result>(
10151025
clEnqueueMarkerWithWaitList(cast<cl_command_queue>(queue), 0, nullptr,

0 commit comments

Comments
 (0)