From c99199c51ca871466102c832f2ad1fee879c2acb Mon Sep 17 00:00:00 2001 From: Alexander Batashev Date: Mon, 18 Jan 2021 13:31:49 +0300 Subject: [PATCH 1/4] [SYCL][NFC] Fix warnings reported by Clang --- .../include/CL/sycl/INTEL/online_compiler.hpp | 2 +- sycl/plugins/level_zero/pi_level_zero.cpp | 172 +++++++++--------- sycl/plugins/opencl/pi_opencl.cpp | 30 +-- sycl/source/detail/device_info.hpp | 2 - sycl/source/detail/plugin_printers.hpp | 2 +- 5 files changed, 102 insertions(+), 106 deletions(-) diff --git a/sycl/include/CL/sycl/INTEL/online_compiler.hpp b/sycl/include/CL/sycl/INTEL/online_compiler.hpp index f8bb63bc79dc5..53f1b7efbab07 100644 --- a/sycl/include/CL/sycl/INTEL/online_compiler.hpp +++ b/sycl/include/CL/sycl/INTEL/online_compiler.hpp @@ -94,7 +94,7 @@ template class online_compiler { // TODO: the initial version generates the generic code (SKL now), need // to do additional device::info calls to determine the device by it's // features. - online_compiler(const sycl::device &dev) + online_compiler(const sycl::device &) : OutputFormat(compiled_code_format::spir_v), OutputFormatVersion({0, 0}), DeviceType(sycl::info::device_type::all), DeviceArch(device_arch::any), Is64Bit(true), DeviceStepping("") {} diff --git a/sycl/plugins/level_zero/pi_level_zero.cpp b/sycl/plugins/level_zero/pi_level_zero.cpp index bca5e1010b1de..581a8e9e0a61e 100644 --- a/sycl/plugins/level_zero/pi_level_zero.cpp +++ b/sycl/plugins/level_zero/pi_level_zero.cpp @@ -28,6 +28,12 @@ #include "usm_allocator.hpp" +#if defined(__clang__) || defined(__GNUC__) +#define UNUSED __attribute__((unused)) +#else +#define UNUSED +#endif + namespace { // Controls Level Zero calls serialization to w/a Level Zero driver being not MT @@ -116,7 +122,7 @@ template 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) { + auto assignment = [](void *param_value, T value, UNUSED size_t value_size) { *static_cast(param_value) = value; }; @@ -1088,9 +1094,6 @@ pi_result piPlatformGetInfo(pi_platform Platform, pi_platform_info ParamName, // information>. Follow the same notation here. // return ReturnValue(Platform->ZeDriverApiVersion.c_str()); - default: - // TODO: implement other parameters - die("Unsupported ParamName in piPlatformGetInfo"); } return PI_SUCCESS; @@ -1906,12 +1909,13 @@ pi_result piextDeviceCreateWithNativeHandle(pi_native_handle NativeHandle, return PI_INVALID_VALUE; } -pi_result piContextCreate(const pi_context_properties *Properties, - pi_uint32 NumDevices, const pi_device *Devices, - void (*PFnNotify)(const char *ErrInfo, - const void *PrivateInfo, size_t CB, - void *UserData), - void *UserData, pi_context *RetContext) { +pi_result +piContextCreate(UNUSED const pi_context_properties *Properties, + pi_uint32 NumDevices, const pi_device *Devices, + UNUSED void (*PFnNotify)(const char *ErrInfo, + UNUSED const void *PrivateInfo, + size_t CB, void *UserData), + UNUSED void *UserData, pi_context *RetContext) { PI_ASSERT(Devices, PI_INVALID_DEVICE); PI_ASSERT(RetContext, PI_INVALID_VALUE); @@ -1955,9 +1959,10 @@ pi_result piContextGetInfo(pi_context Context, pi_context_info ParamName, } // FIXME: Dummy implementation to prevent link fail -pi_result piextContextSetExtendedDeleter(pi_context Context, - pi_context_extended_deleter Function, - void *UserData) { +pi_result +piextContextSetExtendedDeleter(UNUSED pi_context Context, + UNUSED pi_context_extended_deleter Function, + UNUSED void *UserData) { die("piextContextSetExtendedDeleter: not supported"); return PI_SUCCESS; } @@ -2098,10 +2103,6 @@ pi_result piQueueGetInfo(pi_queue Queue, pi_queue_info ParamName, case PI_QUEUE_INFO_DEVICE_DEFAULT: die("PI_QUEUE_INFO_DEVICE_DEFAULT in piQueueGetInfo not implemented\n"); break; - default: - zePrint("Unsupported ParamName in piQueueGetInfo: ParamName=%d(0x%x)\n", - ParamName, ParamName); - return PI_INVALID_VALUE; } return PI_SUCCESS; @@ -2290,10 +2291,10 @@ pi_result piMemBufferCreate(pi_context Context, pi_mem_flags Flags, size_t Size, return PI_SUCCESS; } -pi_result piMemGetInfo(pi_mem Mem, - cl_mem_info ParamName, // TODO: untie from OpenCL - size_t ParamValueSize, void *ParamValue, - size_t *ParamValueSizeRet) { +pi_result piMemGetInfo(UNUSED pi_mem Mem, + UNUSED cl_mem_info ParamName, // TODO: untie from OpenCL + UNUSED size_t ParamValueSize, UNUSED void *ParamValue, + UNUSED size_t *ParamValueSizeRet) { die("piMemGetInfo: not implemented"); return {}; } @@ -2495,13 +2496,14 @@ pi_result piMemImageCreate(pi_context Context, pi_mem_flags Flags, return PI_SUCCESS; } -pi_result piextMemGetNativeHandle(pi_mem Mem, pi_native_handle *NativeHandle) { +pi_result piextMemGetNativeHandle(UNUSED pi_mem Mem, + UNUSED pi_native_handle *NativeHandle) { die("piextMemGetNativeHandle: not supported"); return PI_SUCCESS; } -pi_result piextMemCreateWithNativeHandle(pi_native_handle NativeHandle, - pi_mem *Mem) { +pi_result piextMemCreateWithNativeHandle(UNUSED pi_native_handle NativeHandle, + UNUSED pi_mem *Mem) { die("piextMemCreateWithNativeHandle: not supported"); return PI_SUCCESS; } @@ -2577,10 +2579,11 @@ pi_result piProgramCreateWithBinary(pi_context Context, pi_uint32 NumDevices, return PI_SUCCESS; } -pi_result piclProgramCreateWithSource(pi_context Context, pi_uint32 Count, - const char **Strings, - const size_t *Lengths, - pi_program *RetProgram) { +pi_result piclProgramCreateWithSource(UNUSED pi_context Context, + UNUSED pi_uint32 Count, + UNUSED const char **Strings, + UNUSED const size_t *Lengths, + UNUSED pi_program *RetProgram) { zePrint("piclProgramCreateWithSource: not supported in Level Zero\n"); return PI_INVALID_OPERATION; @@ -2726,7 +2729,7 @@ pi_result piProgramGetInfo(pi_program Program, pi_program_info ParamName, } pi_result piProgramLink(pi_context Context, pi_uint32 NumDevices, - const pi_device *DeviceList, const char *Options, + const pi_device *DeviceList, UNUSED const char *Options, pi_uint32 NumInputPrograms, const pi_program *InputPrograms, void (*PFnNotify)(pi_program Program, void *UserData), @@ -2842,8 +2845,9 @@ pi_result piProgramLink(pi_context Context, pi_uint32 NumDevices, pi_result piProgramCompile( pi_program Program, pi_uint32 NumDevices, const pi_device *DeviceList, - const char *Options, pi_uint32 NumInputHeaders, - const pi_program *InputHeaders, const char **HeaderIncludeNames, + const char *Options, UNUSED pi_uint32 NumInputHeaders, + UNUSED const pi_program *InputHeaders, + UNUSED const char **HeaderIncludeNames, void (*PFnNotify)(pi_program Program, void *UserData), void *UserData) { // The OpenCL spec says this should return CL_INVALID_PROGRAM, but there is @@ -2966,7 +2970,7 @@ static pi_result compileOrBuild(pi_program Program, pi_uint32 NumDevices, return PI_SUCCESS; } -pi_result piProgramGetBuildInfo(pi_program Program, pi_device Device, +pi_result piProgramGetBuildInfo(pi_program Program, UNUSED pi_device Device, cl_program_build_info ParamName, size_t ParamValueSize, void *ParamValue, size_t *ParamValueSizeRet) { @@ -3331,10 +3335,6 @@ pi_result piKernelGetInfo(pi_kernel Kernel, pi_kernel_info ParamName, } catch (...) { return PI_ERROR_UNKNOWN; } - default: - zePrint("Unsupported ParamName in piKernelGetInfo: ParamName=%d(0x%x)\n", - ParamName, ParamName); - return PI_INVALID_VALUE; } return PI_SUCCESS; @@ -3389,17 +3389,14 @@ pi_result piKernelGetGroupInfo(pi_kernel Kernel, pi_device Device, } case PI_KERNEL_GROUP_INFO_PRIVATE_MEM_SIZE: return ReturnValue(pi_uint32{ZeKernelProperties.privateMemSize}); - default: - zePrint("Unknown ParamName in piKernelGetGroupInfo: ParamName=%d(0x%x)\n", - ParamName, ParamName); - return PI_INVALID_VALUE; } return PI_SUCCESS; } -pi_result piKernelGetSubGroupInfo(pi_kernel Kernel, pi_device Device, +pi_result piKernelGetSubGroupInfo(pi_kernel Kernel, UNUSED pi_device Device, pi_kernel_sub_group_info ParamName, - size_t InputValueSize, const void *InputValue, + UNUSED size_t InputValueSize, + UNUSED const void *InputValue, size_t ParamValueSize, void *ParamValue, size_t *ParamValueSizeRet) { @@ -3643,10 +3640,6 @@ pi_result piEventGetInfo(pi_event Event, pi_event_info ParamName, } case PI_EVENT_INFO_REFERENCE_COUNT: return ReturnValue(pi_uint32{Event->RefCount}); - default: - zePrint("Unsupported ParamName in piEventGetInfo: ParamName=%d(%x)\n", - ParamName, ParamName); - return PI_INVALID_VALUE; } return PI_SUCCESS; @@ -3699,9 +3692,6 @@ pi_result piEventGetProfilingInfo(pi_event Event, pi_profiling_info ParamName, case PI_PROFILING_INFO_COMMAND_SUBMIT: // TODO: Support these when Level Zero supported is added. return ReturnValue(uint64_t{0}); - default: - zePrint("piEventGetProfilingInfo: not supported ParamName\n"); - return PI_INVALID_VALUE; } return PI_SUCCESS; @@ -3790,16 +3780,17 @@ pi_result piEventsWait(pi_uint32 NumEvents, const pi_event *EventList) { return PI_SUCCESS; } -pi_result piEventSetCallback(pi_event Event, pi_int32 CommandExecCallbackType, - void (*PFnNotify)(pi_event Event, - pi_int32 EventCommandStatus, - void *UserData), - void *UserData) { +pi_result piEventSetCallback( + UNUSED pi_event Event, UNUSED pi_int32 CommandExecCallbackType, + UNUSED void (*PFnNotify)(pi_event Event, pi_int32 EventCommandStatus, + void *UserData), + UNUSED void *UserData) { die("piEventSetCallback: deprecated, to be removed"); return PI_SUCCESS; } -pi_result piEventSetStatus(pi_event Event, pi_int32 ExecutionStatus) { +pi_result piEventSetStatus(UNUSED pi_event Event, + UNUSED pi_int32 ExecutionStatus) { die("piEventSetStatus: deprecated, to be removed"); return PI_SUCCESS; } @@ -3836,14 +3827,14 @@ pi_result piEventRelease(pi_event Event) { return PI_SUCCESS; } -pi_result piextEventGetNativeHandle(pi_event Event, - pi_native_handle *NativeHandle) { +pi_result piextEventGetNativeHandle(UNUSED pi_event Event, + UNUSED pi_native_handle *NativeHandle) { die("piextEventGetNativeHandle: not supported"); return PI_SUCCESS; } -pi_result piextEventCreateWithNativeHandle(pi_native_handle NativeHandle, - pi_event *Event) { +pi_result piextEventCreateWithNativeHandle(UNUSED pi_native_handle NativeHandle, + UNUSED pi_event *Event) { die("piextEventCreateWithNativeHandle: not supported"); return PI_SUCCESS; } @@ -3921,11 +3912,6 @@ pi_result piSamplerCreate(pi_context Context, case PI_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT: ZeSamplerDesc.addressMode = ZE_SAMPLER_ADDRESS_MODE_MIRROR; break; - default: - zePrint("piSamplerCreate: unsupported PI_SAMPLER_ADDRESSING_MODE " - "value\n"); - zePrint("PI_SAMPLER_ADDRESSING_MODE=%d\n", CurValueAddressingMode); - return PI_INVALID_VALUE; } } break; @@ -3967,9 +3953,11 @@ pi_result piSamplerCreate(pi_context Context, return PI_SUCCESS; } -pi_result piSamplerGetInfo(pi_sampler Sampler, pi_sampler_info ParamName, - size_t ParamValueSize, void *ParamValue, - size_t *ParamValueSizeRet) { +pi_result piSamplerGetInfo(UNUSED pi_sampler Sampler, + UNUSED pi_sampler_info ParamName, + UNUSED size_t ParamValueSize, + UNUSED void *ParamValue, + UNUSED size_t *ParamValueSizeRet) { die("piSamplerGetInfo: not implemented"); return {}; @@ -3995,8 +3983,10 @@ pi_result piSamplerRelease(pi_sampler Sampler) { // // Queue Commands // -pi_result piEnqueueEventsWait(pi_queue Queue, pi_uint32 NumEventsInWaitList, - const pi_event *EventWaitList, pi_event *Event) { +pi_result piEnqueueEventsWait(UNUSED pi_queue Queue, + UNUSED pi_uint32 NumEventsInWaitList, + UNUSED const pi_event *EventWaitList, + UNUSED pi_event *Event) { die("piEnqueueEventsWait: not implemented"); return {}; @@ -4569,9 +4559,10 @@ pi_result piEnqueueMemUnmap(pi_queue Queue, pi_mem MemObj, void *MappedPtr, return PI_SUCCESS; } -pi_result piMemImageGetInfo(pi_mem Image, pi_image_info ParamName, - size_t ParamValueSize, void *ParamValue, - size_t *ParamValueSizeRet) { +pi_result piMemImageGetInfo(UNUSED pi_mem Image, UNUSED pi_image_info ParamName, + UNUSED size_t ParamValueSize, + UNUSED void *ParamValue, + UNUSED size_t *ParamValueSizeRet) { die("piMemImageGetInfo: not implemented"); return {}; @@ -4817,12 +4808,13 @@ piEnqueueMemImageCopy(pi_queue Queue, pi_mem SrcImage, pi_mem DstImage, NumEventsInWaitList, EventWaitList, Event); } -pi_result piEnqueueMemImageFill(pi_queue Queue, pi_mem Image, - const void *FillColor, const size_t *Origin, - const size_t *Region, - pi_uint32 NumEventsInWaitList, - const pi_event *EventWaitList, - pi_event *Event) { +pi_result piEnqueueMemImageFill(UNUSED pi_queue Queue, UNUSED pi_mem Image, + UNUSED const void *FillColor, + UNUSED const size_t *Origin, + UNUSED const size_t *Region, + UNUSED pi_uint32 NumEventsInWaitList, + UNUSED const pi_event *EventWaitList, + UNUSED pi_event *Event) { PI_ASSERT(Queue, PI_INVALID_QUEUE); @@ -4873,13 +4865,12 @@ pi_result piMemBufferPartition(pi_mem Buffer, pi_mem_flags Flags, return PI_SUCCESS; } -pi_result piEnqueueNativeKernel(pi_queue Queue, void (*UserFunc)(void *), - void *Args, size_t CbArgs, - pi_uint32 NumMemObjects, const pi_mem *MemList, - const void **ArgsMemLoc, - pi_uint32 NumEventsInWaitList, - const pi_event *EventWaitList, - pi_event *Event) { +pi_result piEnqueueNativeKernel( + UNUSED pi_queue Queue, UNUSED void (*UserFunc)(void *), UNUSED void *Args, + UNUSED size_t CbArgs, UNUSED pi_uint32 NumMemObjects, + UNUSED const pi_mem *MemList, UNUSED const void **ArgsMemLoc, + UNUSED pi_uint32 NumEventsInWaitList, UNUSED const pi_event *EventWaitList, + UNUSED pi_event *Event) { PI_ASSERT(Queue, PI_INVALID_QUEUE); @@ -4891,7 +4882,8 @@ pi_result piEnqueueNativeKernel(pi_queue Queue, void (*UserFunc)(void *), } // TODO: Check if the function_pointer_ret type can be converted to void**. -pi_result piextGetDeviceFunctionPointer(pi_device Device, pi_program Program, +pi_result piextGetDeviceFunctionPointer(UNUSED pi_device Device, + pi_program Program, const char *FunctionName, pi_uint64 *FunctionPointerRet) { PI_ASSERT(Program, PI_INVALID_PROGRAM); @@ -5386,15 +5378,13 @@ pi_result piextUSMGetMemAllocInfo(pi_context Context, const void *Ptr, ZE_CALL(zeMemGetAddressRange(Context->ZeContext, Ptr, nullptr, &Size)); return ReturnValue(Size); } - default: - zePrint("piextUSMGetMemAllocInfo: unsupported ParamName\n"); - return PI_INVALID_VALUE; } return PI_SUCCESS; } pi_result piKernelSetExecInfo(pi_kernel Kernel, pi_kernel_exec_info ParamName, - size_t ParamValueSize, const void *ParamValue) { + UNUSED size_t ParamValueSize, + const void *ParamValue) { PI_ASSERT(Kernel, PI_INVALID_KERNEL); PI_ASSERT(ParamValue, PI_INVALID_VALUE); @@ -5453,7 +5443,7 @@ pi_result piPluginInit(pi_plugin *PluginInit) { // SYCL RT calls this api to notify the end of plugin lifetime. // It can include all the jobs to tear down resources before // the plugin is unloaded from memory. -pi_result piTearDown(void *PluginParameter) { +pi_result piTearDown(UNUSED void *PluginParameter) { // reclaim pi_platform objects here since we don't have piPlatformRelease. for (pi_platform &Platform : *PiPlatformsCache) { delete Platform; diff --git a/sycl/plugins/opencl/pi_opencl.cpp b/sycl/plugins/opencl/pi_opencl.cpp index 870efeba517f1..955625956fbcd 100644 --- a/sycl/plugins/opencl/pi_opencl.cpp +++ b/sycl/plugins/opencl/pi_opencl.cpp @@ -27,6 +27,12 @@ #include #include +#if defined(__clang__) || defined(__GNUC__) +#define UNUSED __attribute__((unused)) +#else +#define UNUSED +#endif + #define CHECK_ERR_SET_NULL_RET(err, ptr, reterr) \ if (err != CL_SUCCESS) { \ if (ptr != nullptr) \ @@ -60,8 +66,6 @@ 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 clGetMemAllocInfoName[] = "clGetMemAllocInfoINTEL"; CONSTFIX char clSetProgramSpecializationConstantName[] = "clSetProgramSpecializationConstant"; @@ -536,8 +540,8 @@ pi_result piContextCreate(const pi_context_properties *properties, } pi_result piextContextCreateWithNativeHandle(pi_native_handle nativeHandle, - pi_uint32 num_devices, - const pi_device *devices, + UNUSED pi_uint32 num_devices, + UNUSED const pi_device *devices, pi_context *piContext) { assert(piContext != nullptr); *piContext = reinterpret_cast(nativeHandle); @@ -661,7 +665,8 @@ pi_result piKernelGetSubGroupInfo(pi_kernel kernel, pi_device device, pi_kernel_sub_group_info param_name, size_t input_value_size, const void *input_value, - size_t param_value_size, void *param_value, + UNUSED size_t param_value_size, + void *param_value, size_t *param_value_size_ret) { size_t ret_val; cl_int ret_err; @@ -846,7 +851,8 @@ pi_result piextUSMFree(pi_context context, void *ptr) { /// \param arg_size is the size in bytes of the argument (ignored in CL) /// \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) { + UNUSED size_t arg_size, + const void *arg_value) { // Size is unused in CL as pointer args are passed by value. @@ -963,8 +969,9 @@ pi_result piextUSMEnqueueMemcpy(pi_queue queue, pi_bool blocking, void *dst_ptr, /// \param num_events_in_waitlist is the number of events to wait on /// \param events_waitlist is an array of events to wait on /// \param event is the event that represents this operation -pi_result piextUSMEnqueuePrefetch(pi_queue queue, const void *ptr, size_t size, - pi_usm_migration_flags flags, +pi_result piextUSMEnqueuePrefetch(pi_queue queue, UNUSED const void *ptr, + UNUSED size_t size, + UNUSED pi_usm_migration_flags flags, pi_uint32 num_events_in_waitlist, const pi_event *events_waitlist, pi_event *event) { @@ -1007,8 +1014,9 @@ pi_result piextUSMEnqueuePrefetch(pi_queue queue, const void *ptr, size_t size, /// \param advice is device specific advice /// \param event is the event that represents this operation // USM memadvise API to govern behavior of automatic migration mechanisms -pi_result piextUSMEnqueueMemAdvise(pi_queue queue, const void *ptr, - size_t length, pi_mem_advice advice, +pi_result piextUSMEnqueueMemAdvise(pi_queue queue, UNUSED const void *ptr, + UNUSED size_t length, + UNUSED pi_mem_advice advice, pi_event *event) { return cast( @@ -1173,7 +1181,7 @@ pi_result piextProgramGetNativeHandle(pi_program program, // This API is called by Sycl RT to notify the end of the plugin lifetime. // TODO: add a global variable lifetime management code here (see // pi_level_zero.cpp for reference) Currently this is just a NOOP. -pi_result piTearDown(void *PluginParameter) { return PI_SUCCESS; } +pi_result piTearDown(UNUSED void *PluginParameter) { return PI_SUCCESS; } pi_result piPluginInit(pi_plugin *PluginInit) { int CompareVersions = strcmp(PluginInit->PiVersion, SupportedVersion); diff --git a/sycl/source/detail/device_info.hpp b/sycl/source/detail/device_info.hpp index 38039b4986558..a1676de1fa887 100644 --- a/sycl/source/detail/device_info.hpp +++ b/sycl/source/detail/device_info.hpp @@ -279,8 +279,6 @@ static bool is_sycl_partition_property(info::partition_property PP) { case info::partition_property::partition_by_counts: case info::partition_property::partition_by_affinity_domain: return true; - default: - return false; } } diff --git a/sycl/source/detail/plugin_printers.hpp b/sycl/source/detail/plugin_printers.hpp index dbbd827d09c11..b28dc24dcc472 100644 --- a/sycl/source/detail/plugin_printers.hpp +++ b/sycl/source/detail/plugin_printers.hpp @@ -128,7 +128,7 @@ void printArgs(Arg0 arg0, Args... args) { } template struct printOut { - printOut(T val) {} + printOut(T) {} }; // Do nothing template <> struct printOut { From 7b2b7582958a18dff02bb60d6ded2fde34ba20c4 Mon Sep 17 00:00:00 2001 From: Alexander Batashev Date: Mon, 18 Jan 2021 13:34:26 +0300 Subject: [PATCH 2/4] Revert "[SYCL][NFC] Fix warnings reported by Clang" This reverts commit c99199c51ca871466102c832f2ad1fee879c2acb. --- .../include/CL/sycl/INTEL/online_compiler.hpp | 2 +- sycl/plugins/level_zero/pi_level_zero.cpp | 172 +++++++++--------- sycl/plugins/opencl/pi_opencl.cpp | 30 ++- sycl/source/detail/device_info.hpp | 2 + sycl/source/detail/plugin_printers.hpp | 2 +- 5 files changed, 106 insertions(+), 102 deletions(-) diff --git a/sycl/include/CL/sycl/INTEL/online_compiler.hpp b/sycl/include/CL/sycl/INTEL/online_compiler.hpp index 53f1b7efbab07..f8bb63bc79dc5 100644 --- a/sycl/include/CL/sycl/INTEL/online_compiler.hpp +++ b/sycl/include/CL/sycl/INTEL/online_compiler.hpp @@ -94,7 +94,7 @@ template class online_compiler { // TODO: the initial version generates the generic code (SKL now), need // to do additional device::info calls to determine the device by it's // features. - online_compiler(const sycl::device &) + online_compiler(const sycl::device &dev) : OutputFormat(compiled_code_format::spir_v), OutputFormatVersion({0, 0}), DeviceType(sycl::info::device_type::all), DeviceArch(device_arch::any), Is64Bit(true), DeviceStepping("") {} diff --git a/sycl/plugins/level_zero/pi_level_zero.cpp b/sycl/plugins/level_zero/pi_level_zero.cpp index 581a8e9e0a61e..bca5e1010b1de 100644 --- a/sycl/plugins/level_zero/pi_level_zero.cpp +++ b/sycl/plugins/level_zero/pi_level_zero.cpp @@ -28,12 +28,6 @@ #include "usm_allocator.hpp" -#if defined(__clang__) || defined(__GNUC__) -#define UNUSED __attribute__((unused)) -#else -#define UNUSED -#endif - namespace { // Controls Level Zero calls serialization to w/a Level Zero driver being not MT @@ -122,7 +116,7 @@ template 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, UNUSED size_t value_size) { + auto assignment = [](void *param_value, T value, size_t value_size) { *static_cast(param_value) = value; }; @@ -1094,6 +1088,9 @@ pi_result piPlatformGetInfo(pi_platform Platform, pi_platform_info ParamName, // information>. Follow the same notation here. // return ReturnValue(Platform->ZeDriverApiVersion.c_str()); + default: + // TODO: implement other parameters + die("Unsupported ParamName in piPlatformGetInfo"); } return PI_SUCCESS; @@ -1909,13 +1906,12 @@ pi_result piextDeviceCreateWithNativeHandle(pi_native_handle NativeHandle, return PI_INVALID_VALUE; } -pi_result -piContextCreate(UNUSED const pi_context_properties *Properties, - pi_uint32 NumDevices, const pi_device *Devices, - UNUSED void (*PFnNotify)(const char *ErrInfo, - UNUSED const void *PrivateInfo, - size_t CB, void *UserData), - UNUSED void *UserData, pi_context *RetContext) { +pi_result piContextCreate(const pi_context_properties *Properties, + pi_uint32 NumDevices, const pi_device *Devices, + void (*PFnNotify)(const char *ErrInfo, + const void *PrivateInfo, size_t CB, + void *UserData), + void *UserData, pi_context *RetContext) { PI_ASSERT(Devices, PI_INVALID_DEVICE); PI_ASSERT(RetContext, PI_INVALID_VALUE); @@ -1959,10 +1955,9 @@ pi_result piContextGetInfo(pi_context Context, pi_context_info ParamName, } // FIXME: Dummy implementation to prevent link fail -pi_result -piextContextSetExtendedDeleter(UNUSED pi_context Context, - UNUSED pi_context_extended_deleter Function, - UNUSED void *UserData) { +pi_result piextContextSetExtendedDeleter(pi_context Context, + pi_context_extended_deleter Function, + void *UserData) { die("piextContextSetExtendedDeleter: not supported"); return PI_SUCCESS; } @@ -2103,6 +2098,10 @@ pi_result piQueueGetInfo(pi_queue Queue, pi_queue_info ParamName, case PI_QUEUE_INFO_DEVICE_DEFAULT: die("PI_QUEUE_INFO_DEVICE_DEFAULT in piQueueGetInfo not implemented\n"); break; + default: + zePrint("Unsupported ParamName in piQueueGetInfo: ParamName=%d(0x%x)\n", + ParamName, ParamName); + return PI_INVALID_VALUE; } return PI_SUCCESS; @@ -2291,10 +2290,10 @@ pi_result piMemBufferCreate(pi_context Context, pi_mem_flags Flags, size_t Size, return PI_SUCCESS; } -pi_result piMemGetInfo(UNUSED pi_mem Mem, - UNUSED cl_mem_info ParamName, // TODO: untie from OpenCL - UNUSED size_t ParamValueSize, UNUSED void *ParamValue, - UNUSED size_t *ParamValueSizeRet) { +pi_result piMemGetInfo(pi_mem Mem, + cl_mem_info ParamName, // TODO: untie from OpenCL + size_t ParamValueSize, void *ParamValue, + size_t *ParamValueSizeRet) { die("piMemGetInfo: not implemented"); return {}; } @@ -2496,14 +2495,13 @@ pi_result piMemImageCreate(pi_context Context, pi_mem_flags Flags, return PI_SUCCESS; } -pi_result piextMemGetNativeHandle(UNUSED pi_mem Mem, - UNUSED pi_native_handle *NativeHandle) { +pi_result piextMemGetNativeHandle(pi_mem Mem, pi_native_handle *NativeHandle) { die("piextMemGetNativeHandle: not supported"); return PI_SUCCESS; } -pi_result piextMemCreateWithNativeHandle(UNUSED pi_native_handle NativeHandle, - UNUSED pi_mem *Mem) { +pi_result piextMemCreateWithNativeHandle(pi_native_handle NativeHandle, + pi_mem *Mem) { die("piextMemCreateWithNativeHandle: not supported"); return PI_SUCCESS; } @@ -2579,11 +2577,10 @@ pi_result piProgramCreateWithBinary(pi_context Context, pi_uint32 NumDevices, return PI_SUCCESS; } -pi_result piclProgramCreateWithSource(UNUSED pi_context Context, - UNUSED pi_uint32 Count, - UNUSED const char **Strings, - UNUSED const size_t *Lengths, - UNUSED pi_program *RetProgram) { +pi_result piclProgramCreateWithSource(pi_context Context, pi_uint32 Count, + const char **Strings, + const size_t *Lengths, + pi_program *RetProgram) { zePrint("piclProgramCreateWithSource: not supported in Level Zero\n"); return PI_INVALID_OPERATION; @@ -2729,7 +2726,7 @@ pi_result piProgramGetInfo(pi_program Program, pi_program_info ParamName, } pi_result piProgramLink(pi_context Context, pi_uint32 NumDevices, - const pi_device *DeviceList, UNUSED const char *Options, + const pi_device *DeviceList, const char *Options, pi_uint32 NumInputPrograms, const pi_program *InputPrograms, void (*PFnNotify)(pi_program Program, void *UserData), @@ -2845,9 +2842,8 @@ pi_result piProgramLink(pi_context Context, pi_uint32 NumDevices, pi_result piProgramCompile( pi_program Program, pi_uint32 NumDevices, const pi_device *DeviceList, - const char *Options, UNUSED pi_uint32 NumInputHeaders, - UNUSED const pi_program *InputHeaders, - UNUSED const char **HeaderIncludeNames, + const char *Options, pi_uint32 NumInputHeaders, + const pi_program *InputHeaders, const char **HeaderIncludeNames, void (*PFnNotify)(pi_program Program, void *UserData), void *UserData) { // The OpenCL spec says this should return CL_INVALID_PROGRAM, but there is @@ -2970,7 +2966,7 @@ static pi_result compileOrBuild(pi_program Program, pi_uint32 NumDevices, return PI_SUCCESS; } -pi_result piProgramGetBuildInfo(pi_program Program, UNUSED pi_device Device, +pi_result piProgramGetBuildInfo(pi_program Program, pi_device Device, cl_program_build_info ParamName, size_t ParamValueSize, void *ParamValue, size_t *ParamValueSizeRet) { @@ -3335,6 +3331,10 @@ pi_result piKernelGetInfo(pi_kernel Kernel, pi_kernel_info ParamName, } catch (...) { return PI_ERROR_UNKNOWN; } + default: + zePrint("Unsupported ParamName in piKernelGetInfo: ParamName=%d(0x%x)\n", + ParamName, ParamName); + return PI_INVALID_VALUE; } return PI_SUCCESS; @@ -3389,14 +3389,17 @@ pi_result piKernelGetGroupInfo(pi_kernel Kernel, pi_device Device, } case PI_KERNEL_GROUP_INFO_PRIVATE_MEM_SIZE: return ReturnValue(pi_uint32{ZeKernelProperties.privateMemSize}); + default: + zePrint("Unknown ParamName in piKernelGetGroupInfo: ParamName=%d(0x%x)\n", + ParamName, ParamName); + return PI_INVALID_VALUE; } return PI_SUCCESS; } -pi_result piKernelGetSubGroupInfo(pi_kernel Kernel, UNUSED pi_device Device, +pi_result piKernelGetSubGroupInfo(pi_kernel Kernel, pi_device Device, pi_kernel_sub_group_info ParamName, - UNUSED size_t InputValueSize, - UNUSED const void *InputValue, + size_t InputValueSize, const void *InputValue, size_t ParamValueSize, void *ParamValue, size_t *ParamValueSizeRet) { @@ -3640,6 +3643,10 @@ pi_result piEventGetInfo(pi_event Event, pi_event_info ParamName, } case PI_EVENT_INFO_REFERENCE_COUNT: return ReturnValue(pi_uint32{Event->RefCount}); + default: + zePrint("Unsupported ParamName in piEventGetInfo: ParamName=%d(%x)\n", + ParamName, ParamName); + return PI_INVALID_VALUE; } return PI_SUCCESS; @@ -3692,6 +3699,9 @@ pi_result piEventGetProfilingInfo(pi_event Event, pi_profiling_info ParamName, case PI_PROFILING_INFO_COMMAND_SUBMIT: // TODO: Support these when Level Zero supported is added. return ReturnValue(uint64_t{0}); + default: + zePrint("piEventGetProfilingInfo: not supported ParamName\n"); + return PI_INVALID_VALUE; } return PI_SUCCESS; @@ -3780,17 +3790,16 @@ pi_result piEventsWait(pi_uint32 NumEvents, const pi_event *EventList) { return PI_SUCCESS; } -pi_result piEventSetCallback( - UNUSED pi_event Event, UNUSED pi_int32 CommandExecCallbackType, - UNUSED void (*PFnNotify)(pi_event Event, pi_int32 EventCommandStatus, - void *UserData), - UNUSED void *UserData) { +pi_result piEventSetCallback(pi_event Event, pi_int32 CommandExecCallbackType, + void (*PFnNotify)(pi_event Event, + pi_int32 EventCommandStatus, + void *UserData), + void *UserData) { die("piEventSetCallback: deprecated, to be removed"); return PI_SUCCESS; } -pi_result piEventSetStatus(UNUSED pi_event Event, - UNUSED pi_int32 ExecutionStatus) { +pi_result piEventSetStatus(pi_event Event, pi_int32 ExecutionStatus) { die("piEventSetStatus: deprecated, to be removed"); return PI_SUCCESS; } @@ -3827,14 +3836,14 @@ pi_result piEventRelease(pi_event Event) { return PI_SUCCESS; } -pi_result piextEventGetNativeHandle(UNUSED pi_event Event, - UNUSED pi_native_handle *NativeHandle) { +pi_result piextEventGetNativeHandle(pi_event Event, + pi_native_handle *NativeHandle) { die("piextEventGetNativeHandle: not supported"); return PI_SUCCESS; } -pi_result piextEventCreateWithNativeHandle(UNUSED pi_native_handle NativeHandle, - UNUSED pi_event *Event) { +pi_result piextEventCreateWithNativeHandle(pi_native_handle NativeHandle, + pi_event *Event) { die("piextEventCreateWithNativeHandle: not supported"); return PI_SUCCESS; } @@ -3912,6 +3921,11 @@ pi_result piSamplerCreate(pi_context Context, case PI_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT: ZeSamplerDesc.addressMode = ZE_SAMPLER_ADDRESS_MODE_MIRROR; break; + default: + zePrint("piSamplerCreate: unsupported PI_SAMPLER_ADDRESSING_MODE " + "value\n"); + zePrint("PI_SAMPLER_ADDRESSING_MODE=%d\n", CurValueAddressingMode); + return PI_INVALID_VALUE; } } break; @@ -3953,11 +3967,9 @@ pi_result piSamplerCreate(pi_context Context, return PI_SUCCESS; } -pi_result piSamplerGetInfo(UNUSED pi_sampler Sampler, - UNUSED pi_sampler_info ParamName, - UNUSED size_t ParamValueSize, - UNUSED void *ParamValue, - UNUSED size_t *ParamValueSizeRet) { +pi_result piSamplerGetInfo(pi_sampler Sampler, pi_sampler_info ParamName, + size_t ParamValueSize, void *ParamValue, + size_t *ParamValueSizeRet) { die("piSamplerGetInfo: not implemented"); return {}; @@ -3983,10 +3995,8 @@ pi_result piSamplerRelease(pi_sampler Sampler) { // // Queue Commands // -pi_result piEnqueueEventsWait(UNUSED pi_queue Queue, - UNUSED pi_uint32 NumEventsInWaitList, - UNUSED const pi_event *EventWaitList, - UNUSED pi_event *Event) { +pi_result piEnqueueEventsWait(pi_queue Queue, pi_uint32 NumEventsInWaitList, + const pi_event *EventWaitList, pi_event *Event) { die("piEnqueueEventsWait: not implemented"); return {}; @@ -4559,10 +4569,9 @@ pi_result piEnqueueMemUnmap(pi_queue Queue, pi_mem MemObj, void *MappedPtr, return PI_SUCCESS; } -pi_result piMemImageGetInfo(UNUSED pi_mem Image, UNUSED pi_image_info ParamName, - UNUSED size_t ParamValueSize, - UNUSED void *ParamValue, - UNUSED size_t *ParamValueSizeRet) { +pi_result piMemImageGetInfo(pi_mem Image, pi_image_info ParamName, + size_t ParamValueSize, void *ParamValue, + size_t *ParamValueSizeRet) { die("piMemImageGetInfo: not implemented"); return {}; @@ -4808,13 +4817,12 @@ piEnqueueMemImageCopy(pi_queue Queue, pi_mem SrcImage, pi_mem DstImage, NumEventsInWaitList, EventWaitList, Event); } -pi_result piEnqueueMemImageFill(UNUSED pi_queue Queue, UNUSED pi_mem Image, - UNUSED const void *FillColor, - UNUSED const size_t *Origin, - UNUSED const size_t *Region, - UNUSED pi_uint32 NumEventsInWaitList, - UNUSED const pi_event *EventWaitList, - UNUSED pi_event *Event) { +pi_result piEnqueueMemImageFill(pi_queue Queue, pi_mem Image, + const void *FillColor, const size_t *Origin, + const size_t *Region, + pi_uint32 NumEventsInWaitList, + const pi_event *EventWaitList, + pi_event *Event) { PI_ASSERT(Queue, PI_INVALID_QUEUE); @@ -4865,12 +4873,13 @@ pi_result piMemBufferPartition(pi_mem Buffer, pi_mem_flags Flags, return PI_SUCCESS; } -pi_result piEnqueueNativeKernel( - UNUSED pi_queue Queue, UNUSED void (*UserFunc)(void *), UNUSED void *Args, - UNUSED size_t CbArgs, UNUSED pi_uint32 NumMemObjects, - UNUSED const pi_mem *MemList, UNUSED const void **ArgsMemLoc, - UNUSED pi_uint32 NumEventsInWaitList, UNUSED const pi_event *EventWaitList, - UNUSED pi_event *Event) { +pi_result piEnqueueNativeKernel(pi_queue Queue, void (*UserFunc)(void *), + void *Args, size_t CbArgs, + pi_uint32 NumMemObjects, const pi_mem *MemList, + const void **ArgsMemLoc, + pi_uint32 NumEventsInWaitList, + const pi_event *EventWaitList, + pi_event *Event) { PI_ASSERT(Queue, PI_INVALID_QUEUE); @@ -4882,8 +4891,7 @@ pi_result piEnqueueNativeKernel( } // TODO: Check if the function_pointer_ret type can be converted to void**. -pi_result piextGetDeviceFunctionPointer(UNUSED pi_device Device, - pi_program Program, +pi_result piextGetDeviceFunctionPointer(pi_device Device, pi_program Program, const char *FunctionName, pi_uint64 *FunctionPointerRet) { PI_ASSERT(Program, PI_INVALID_PROGRAM); @@ -5378,13 +5386,15 @@ pi_result piextUSMGetMemAllocInfo(pi_context Context, const void *Ptr, ZE_CALL(zeMemGetAddressRange(Context->ZeContext, Ptr, nullptr, &Size)); return ReturnValue(Size); } + default: + zePrint("piextUSMGetMemAllocInfo: unsupported ParamName\n"); + return PI_INVALID_VALUE; } return PI_SUCCESS; } pi_result piKernelSetExecInfo(pi_kernel Kernel, pi_kernel_exec_info ParamName, - UNUSED size_t ParamValueSize, - const void *ParamValue) { + size_t ParamValueSize, const void *ParamValue) { PI_ASSERT(Kernel, PI_INVALID_KERNEL); PI_ASSERT(ParamValue, PI_INVALID_VALUE); @@ -5443,7 +5453,7 @@ pi_result piPluginInit(pi_plugin *PluginInit) { // SYCL RT calls this api to notify the end of plugin lifetime. // It can include all the jobs to tear down resources before // the plugin is unloaded from memory. -pi_result piTearDown(UNUSED void *PluginParameter) { +pi_result piTearDown(void *PluginParameter) { // reclaim pi_platform objects here since we don't have piPlatformRelease. for (pi_platform &Platform : *PiPlatformsCache) { delete Platform; diff --git a/sycl/plugins/opencl/pi_opencl.cpp b/sycl/plugins/opencl/pi_opencl.cpp index 955625956fbcd..870efeba517f1 100644 --- a/sycl/plugins/opencl/pi_opencl.cpp +++ b/sycl/plugins/opencl/pi_opencl.cpp @@ -27,12 +27,6 @@ #include #include -#if defined(__clang__) || defined(__GNUC__) -#define UNUSED __attribute__((unused)) -#else -#define UNUSED -#endif - #define CHECK_ERR_SET_NULL_RET(err, ptr, reterr) \ if (err != CL_SUCCESS) { \ if (ptr != nullptr) \ @@ -66,6 +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 clGetMemAllocInfoName[] = "clGetMemAllocInfoINTEL"; CONSTFIX char clSetProgramSpecializationConstantName[] = "clSetProgramSpecializationConstant"; @@ -540,8 +536,8 @@ pi_result piContextCreate(const pi_context_properties *properties, } pi_result piextContextCreateWithNativeHandle(pi_native_handle nativeHandle, - UNUSED pi_uint32 num_devices, - UNUSED const pi_device *devices, + pi_uint32 num_devices, + const pi_device *devices, pi_context *piContext) { assert(piContext != nullptr); *piContext = reinterpret_cast(nativeHandle); @@ -665,8 +661,7 @@ pi_result piKernelGetSubGroupInfo(pi_kernel kernel, pi_device device, pi_kernel_sub_group_info param_name, size_t input_value_size, const void *input_value, - UNUSED size_t param_value_size, - void *param_value, + size_t param_value_size, void *param_value, size_t *param_value_size_ret) { size_t ret_val; cl_int ret_err; @@ -851,8 +846,7 @@ pi_result piextUSMFree(pi_context context, void *ptr) { /// \param arg_size is the size in bytes of the argument (ignored in CL) /// \param arg_value is the pointer argument pi_result piextKernelSetArgPointer(pi_kernel kernel, pi_uint32 arg_index, - UNUSED size_t arg_size, - const void *arg_value) { + size_t arg_size, const void *arg_value) { // Size is unused in CL as pointer args are passed by value. @@ -969,9 +963,8 @@ pi_result piextUSMEnqueueMemcpy(pi_queue queue, pi_bool blocking, void *dst_ptr, /// \param num_events_in_waitlist is the number of events to wait on /// \param events_waitlist is an array of events to wait on /// \param event is the event that represents this operation -pi_result piextUSMEnqueuePrefetch(pi_queue queue, UNUSED const void *ptr, - UNUSED size_t size, - UNUSED pi_usm_migration_flags flags, +pi_result piextUSMEnqueuePrefetch(pi_queue queue, const void *ptr, size_t size, + pi_usm_migration_flags flags, pi_uint32 num_events_in_waitlist, const pi_event *events_waitlist, pi_event *event) { @@ -1014,9 +1007,8 @@ pi_result piextUSMEnqueuePrefetch(pi_queue queue, UNUSED const void *ptr, /// \param advice is device specific advice /// \param event is the event that represents this operation // USM memadvise API to govern behavior of automatic migration mechanisms -pi_result piextUSMEnqueueMemAdvise(pi_queue queue, UNUSED const void *ptr, - UNUSED size_t length, - UNUSED pi_mem_advice advice, +pi_result piextUSMEnqueueMemAdvise(pi_queue queue, const void *ptr, + size_t length, pi_mem_advice advice, pi_event *event) { return cast( @@ -1181,7 +1173,7 @@ pi_result piextProgramGetNativeHandle(pi_program program, // This API is called by Sycl RT to notify the end of the plugin lifetime. // TODO: add a global variable lifetime management code here (see // pi_level_zero.cpp for reference) Currently this is just a NOOP. -pi_result piTearDown(UNUSED void *PluginParameter) { return PI_SUCCESS; } +pi_result piTearDown(void *PluginParameter) { return PI_SUCCESS; } pi_result piPluginInit(pi_plugin *PluginInit) { int CompareVersions = strcmp(PluginInit->PiVersion, SupportedVersion); diff --git a/sycl/source/detail/device_info.hpp b/sycl/source/detail/device_info.hpp index a1676de1fa887..38039b4986558 100644 --- a/sycl/source/detail/device_info.hpp +++ b/sycl/source/detail/device_info.hpp @@ -279,6 +279,8 @@ static bool is_sycl_partition_property(info::partition_property PP) { case info::partition_property::partition_by_counts: case info::partition_property::partition_by_affinity_domain: return true; + default: + return false; } } diff --git a/sycl/source/detail/plugin_printers.hpp b/sycl/source/detail/plugin_printers.hpp index b28dc24dcc472..dbbd827d09c11 100644 --- a/sycl/source/detail/plugin_printers.hpp +++ b/sycl/source/detail/plugin_printers.hpp @@ -128,7 +128,7 @@ void printArgs(Arg0 arg0, Args... args) { } template struct printOut { - printOut(T) {} + printOut(T val) {} }; // Do nothing template <> struct printOut { From 291ca02f859ac18b149d6a281c5c4ee2fd476f19 Mon Sep 17 00:00:00 2001 From: Alexander Batashev Date: Mon, 18 Jan 2021 13:37:59 +0300 Subject: [PATCH 3/4] [SYCL][NFC] Fix warnings reported by Clang --- sycl/include/CL/sycl/INTEL/online_compiler.hpp | 2 +- sycl/plugins/level_zero/pi_level_zero.cpp | 1 + sycl/plugins/opencl/pi_opencl.cpp | 5 ++++- sycl/source/detail/device_info.hpp | 2 -- sycl/source/detail/plugin_printers.hpp | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/sycl/include/CL/sycl/INTEL/online_compiler.hpp b/sycl/include/CL/sycl/INTEL/online_compiler.hpp index f8bb63bc79dc5..53f1b7efbab07 100644 --- a/sycl/include/CL/sycl/INTEL/online_compiler.hpp +++ b/sycl/include/CL/sycl/INTEL/online_compiler.hpp @@ -94,7 +94,7 @@ template class online_compiler { // TODO: the initial version generates the generic code (SKL now), need // to do additional device::info calls to determine the device by it's // features. - online_compiler(const sycl::device &dev) + online_compiler(const sycl::device &) : OutputFormat(compiled_code_format::spir_v), OutputFormatVersion({0, 0}), DeviceType(sycl::info::device_type::all), DeviceArch(device_arch::any), Is64Bit(true), DeviceStepping("") {} diff --git a/sycl/plugins/level_zero/pi_level_zero.cpp b/sycl/plugins/level_zero/pi_level_zero.cpp index 604cc595b0dff..50d449cb8b808 100644 --- a/sycl/plugins/level_zero/pi_level_zero.cpp +++ b/sycl/plugins/level_zero/pi_level_zero.cpp @@ -5525,6 +5525,7 @@ pi_result piPluginInit(pi_plugin *PluginInit) { // It can include all the jobs to tear down resources before // the plugin is unloaded from memory. pi_result piTearDown(void *PluginParameter) { + (void)PluginParameter; // reclaim pi_platform objects here since we don't have piPlatformRelease. for (pi_platform &Platform : *PiPlatformsCache) { delete Platform; diff --git a/sycl/plugins/opencl/pi_opencl.cpp b/sycl/plugins/opencl/pi_opencl.cpp index 6ae41a09d15e7..99d687724d74b 100644 --- a/sycl/plugins/opencl/pi_opencl.cpp +++ b/sycl/plugins/opencl/pi_opencl.cpp @@ -1181,7 +1181,10 @@ pi_result piextProgramGetNativeHandle(pi_program program, // This API is called by Sycl RT to notify the end of the plugin lifetime. // TODO: add a global variable lifetime management code here (see // pi_level_zero.cpp for reference) Currently this is just a NOOP. -pi_result piTearDown(void *PluginParameter) { return PI_SUCCESS; } +pi_result piTearDown(void *PluginParameter) { + (void)PluginParameter; + return PI_SUCCESS; +} pi_result piPluginInit(pi_plugin *PluginInit) { int CompareVersions = strcmp(PluginInit->PiVersion, SupportedVersion); diff --git a/sycl/source/detail/device_info.hpp b/sycl/source/detail/device_info.hpp index 38039b4986558..a1676de1fa887 100644 --- a/sycl/source/detail/device_info.hpp +++ b/sycl/source/detail/device_info.hpp @@ -279,8 +279,6 @@ static bool is_sycl_partition_property(info::partition_property PP) { case info::partition_property::partition_by_counts: case info::partition_property::partition_by_affinity_domain: return true; - default: - return false; } } diff --git a/sycl/source/detail/plugin_printers.hpp b/sycl/source/detail/plugin_printers.hpp index dbbd827d09c11..b28dc24dcc472 100644 --- a/sycl/source/detail/plugin_printers.hpp +++ b/sycl/source/detail/plugin_printers.hpp @@ -128,7 +128,7 @@ void printArgs(Arg0 arg0, Args... args) { } template struct printOut { - printOut(T val) {} + printOut(T) {} }; // Do nothing template <> struct printOut { From 8ab4df02a29d46029f8fad9a8923db4b1ae459b3 Mon Sep 17 00:00:00 2001 From: Alexander Batashev Date: Mon, 18 Jan 2021 16:05:25 +0300 Subject: [PATCH 4/4] Minor fix for other compilers --- sycl/source/detail/device_info.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/sycl/source/detail/device_info.hpp b/sycl/source/detail/device_info.hpp index a1676de1fa887..bf3eb0561ef7a 100644 --- a/sycl/source/detail/device_info.hpp +++ b/sycl/source/detail/device_info.hpp @@ -280,6 +280,7 @@ static bool is_sycl_partition_property(info::partition_property PP) { case info::partition_property::partition_by_affinity_domain: return true; } + return false; } // Specialization for partition properties, variable OpenCL return size