diff --git a/cmake/helpers.cmake b/cmake/helpers.cmake index e45020bdea..a6e3a344a4 100644 --- a/cmake/helpers.cmake +++ b/cmake/helpers.cmake @@ -99,25 +99,18 @@ function(add_ur_target_compile_options name) elseif(MSVC) target_compile_options(${name} PRIVATE $<$:/MP> # clang-cl.exe does not support /MP - /W4 - /wd4456 # Disable: declaration of 'identifier' hides previous local declaration - /wd4457 # Disable: declaration of 'identifier' hides function parameter - /wd4458 # Disable: declaration of 'identifier' hides class member - /wd4459 # Disable: declaration of 'identifier' hides global declaration + /W3 /MD$<$:d> /GS /DWIN32_LEAN_AND_MEAN /DNOMINMAX ) - target_compile_definitions(${name} PRIVATE - # _CRT_SECURE_NO_WARNINGS used mainly because of getenv - _CRT_SECURE_NO_WARNINGS - ) - if(UR_DEVELOPER_MODE) + # _CRT_SECURE_NO_WARNINGS used mainly because of getenv + # C4267: The compiler detected a conversion from size_t to a smaller type. target_compile_options(${name} PRIVATE - /WX /GS + /WX /GS /D_CRT_SECURE_NO_WARNINGS /wd4267 ) endif() endif() diff --git a/examples/collector/collector.cpp b/examples/collector/collector.cpp index ddcd32e775..6312dba549 100644 --- a/examples/collector/collector.cpp +++ b/examples/collector/collector.cpp @@ -25,14 +25,7 @@ #include #include "ur_api.h" - -#ifdef _MSC_VER -#pragma warning(disable : 4245) -#endif #include "xpti/xpti_trace_framework.h" -#ifdef _MSC_VER -#pragma warning(default : 4245) -#endif constexpr uint16_t TRACE_FN_BEGIN = static_cast(xpti::trace_point_type_t::function_with_args_begin); diff --git a/include/ur_api.h b/include/ur_api.h index 59747a72ea..60d6fc2f70 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -424,7 +424,7 @@ typedef struct ur_physical_mem_handle_t_ *ur_physical_mem_handle_t; /////////////////////////////////////////////////////////////////////////////// #ifndef UR_BIT /// @brief Generic macro for enumerator bit masks -#define UR_BIT(_i) (1U << _i) +#define UR_BIT(_i) (1 << _i) #endif // UR_BIT /////////////////////////////////////////////////////////////////////////////// diff --git a/scripts/core/common.yml b/scripts/core/common.yml index d1f5b769fa..73501ac39d 100644 --- a/scripts/core/common.yml +++ b/scripts/core/common.yml @@ -134,7 +134,7 @@ name: "$x_physical_mem_handle_t" type: macro desc: "Generic macro for enumerator bit masks" name: "$X_BIT( _i )" -value: "( 1U << _i )" +value: "( 1 << _i )" --- #-------------------------------------------------------------------------- type: enum desc: "Defines Return/Error codes" diff --git a/source/adapters/cuda/CMakeLists.txt b/source/adapters/cuda/CMakeLists.txt index a73b7ee886..b6b153a5d8 100644 --- a/source/adapters/cuda/CMakeLists.txt +++ b/source/adapters/cuda/CMakeLists.txt @@ -97,16 +97,15 @@ if (UR_ENABLE_TRACING) get_target_property(XPTI_SRC_DIR xpti SOURCE_DIR) set(XPTI_PROXY_SRC "${XPTI_SRC_DIR}/xpti_proxy.cpp") endif() - add_library(cuda-xpti-proxy STATIC ${XPTI_PROXY_SRC}) - target_compile_definitions(cuda-xpti-proxy PRIVATE + target_compile_definitions(${TARGET_NAME} PRIVATE XPTI_ENABLE_INSTRUMENTATION XPTI_STATIC_LIBRARY ) - target_include_directories(cuda-xpti-proxy PRIVATE + target_include_directories(${TARGET_NAME} PRIVATE ${XPTI_INCLUDES} ${CUDA_CUPTI_INCLUDE_DIR} ) - target_link_libraries(${TARGET_NAME} PRIVATE cuda-xpti-proxy) + target_sources(${TARGET_NAME} PRIVATE ${XPTI_PROXY_SRC}) endif() if (CUDA_cupti_LIBRARY) diff --git a/source/adapters/cuda/command_buffer.cpp b/source/adapters/cuda/command_buffer.cpp index 65253da739..527c339783 100644 --- a/source/adapters/cuda/command_buffer.cpp +++ b/source/adapters/cuda/command_buffer.cpp @@ -242,7 +242,7 @@ static ur_result_t enqueueCommandBufferFillHelper( if ((PatternSize == 1) || (PatternSize == 2) || (PatternSize == 4)) { CUDA_MEMSET_NODE_PARAMS NodeParams = {}; NodeParams.dst = DstPtr; - NodeParams.elementSize = static_cast(PatternSize); + NodeParams.elementSize = PatternSize; NodeParams.height = N; NodeParams.pitch = PatternSize; NodeParams.width = 1; @@ -508,12 +508,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( auto &ArgIndices = hKernel->getArgIndices(); CUDA_KERNEL_NODE_PARAMS NodeParams = {}; NodeParams.func = CuFunc; - NodeParams.gridDimX = static_cast(BlocksPerGrid[0]); - NodeParams.gridDimY = static_cast(BlocksPerGrid[1]); - NodeParams.gridDimZ = static_cast(BlocksPerGrid[2]); - NodeParams.blockDimX = static_cast(ThreadsPerBlock[0]); - NodeParams.blockDimY = static_cast(ThreadsPerBlock[1]); - NodeParams.blockDimZ = static_cast(ThreadsPerBlock[2]); + NodeParams.gridDimX = BlocksPerGrid[0]; + NodeParams.gridDimY = BlocksPerGrid[1]; + NodeParams.gridDimZ = BlocksPerGrid[2]; + NodeParams.blockDimX = ThreadsPerBlock[0]; + NodeParams.blockDimY = ThreadsPerBlock[1]; + NodeParams.blockDimZ = ThreadsPerBlock[2]; NodeParams.sharedMemBytes = LocalSize; NodeParams.kernelParams = const_cast(ArgIndices.data()); @@ -1397,12 +1397,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferUpdateKernelLaunchExp( CUDA_KERNEL_NODE_PARAMS &Params = KernelCommandHandle->Params; Params.func = CuFunc; - Params.gridDimX = static_cast(BlocksPerGrid[0]); - Params.gridDimY = static_cast(BlocksPerGrid[1]); - Params.gridDimZ = static_cast(BlocksPerGrid[2]); - Params.blockDimX = static_cast(ThreadsPerBlock[0]); - Params.blockDimY = static_cast(ThreadsPerBlock[1]); - Params.blockDimZ = static_cast(ThreadsPerBlock[2]); + Params.gridDimX = BlocksPerGrid[0]; + Params.gridDimY = BlocksPerGrid[1]; + Params.gridDimZ = BlocksPerGrid[2]; + Params.blockDimX = ThreadsPerBlock[0]; + Params.blockDimY = ThreadsPerBlock[1]; + Params.blockDimZ = ThreadsPerBlock[2]; Params.sharedMemBytes = KernelCommandHandle->Kernel->getLocalSize(); Params.kernelParams = const_cast(KernelCommandHandle->Kernel->getArgIndices().data()); diff --git a/source/adapters/cuda/device.cpp b/source/adapters/cuda/device.cpp index b1e34586dc..be5867628d 100644 --- a/source/adapters/cuda/device.cpp +++ b/source/adapters/cuda/device.cpp @@ -1152,7 +1152,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGet(ur_platform_handle_t hPlatform, try { if (pNumDevices) { - *pNumDevices = static_cast(NumDevices); + *pNumDevices = NumDevices; } if (ReturnDevices && phDevices) { @@ -1235,7 +1235,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceCreateWithNativeHandle( ur_result_t UR_APICALL urDeviceGetGlobalTimestamps(ur_device_handle_t hDevice, uint64_t *pDeviceTimestamp, uint64_t *pHostTimestamp) { - CUevent Event{}; + CUevent Event; ScopedContext Active(hDevice); if (pDeviceTimestamp) { diff --git a/source/adapters/cuda/enqueue.cpp b/source/adapters/cuda/enqueue.cpp index 15f812403f..0e00f680f6 100644 --- a/source/adapters/cuda/enqueue.cpp +++ b/source/adapters/cuda/enqueue.cpp @@ -160,7 +160,7 @@ void guessLocalWorkSize(ur_device_handle_t Device, size_t *ThreadsPerBlock, int MinGrid, MaxBlockSize; UR_CHECK_ERROR(cuOccupancyMaxPotentialBlockSize( &MinGrid, &MaxBlockSize, Kernel->get(), NULL, Kernel->getLocalSize(), - static_cast(MaxBlockDim[0]))); + MaxBlockDim[0])); roundToHighestFactorOfGlobalSizeIn3d(ThreadsPerBlock, GlobalSizeNormalized, MaxBlockDim, MaxBlockSize); @@ -208,7 +208,7 @@ setKernelParams([[maybe_unused]] const ur_context_handle_t Context, MaxWorkGroupSize = Device->getMaxWorkGroupSize(); if (ProvidedLocalWorkGroupSize) { - auto IsValid = [&](size_t Dim) { + auto IsValid = [&](int Dim) { if (ReqdThreadsPerBlock[Dim] != 0 && LocalWorkSize[Dim] != ReqdThreadsPerBlock[Dim]) return UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE; @@ -217,8 +217,7 @@ setKernelParams([[maybe_unused]] const ur_context_handle_t Context, LocalWorkSize[Dim] > MaxThreadsPerBlock[Dim]) return UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE; - if (LocalWorkSize[Dim] > - Device->getMaxWorkItemSizes(static_cast(Dim))) + if (LocalWorkSize[Dim] > Device->getMaxWorkItemSizes(Dim)) return UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE; // Checks that local work sizes are a divisor of the global work sizes // which includes that the local work sizes are neither larger than @@ -482,13 +481,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunch( auto &ArgIndices = hKernel->getArgIndices(); UR_CHECK_ERROR(cuLaunchKernel( - CuFunc, static_cast(BlocksPerGrid[0]), - static_cast(BlocksPerGrid[1]), - static_cast(BlocksPerGrid[2]), - static_cast(ThreadsPerBlock[0]), - static_cast(ThreadsPerBlock[1]), - static_cast(ThreadsPerBlock[2]), LocalSize, CuStream, - const_cast(ArgIndices.data()), nullptr)); + CuFunc, BlocksPerGrid[0], BlocksPerGrid[1], BlocksPerGrid[2], + ThreadsPerBlock[0], ThreadsPerBlock[1], ThreadsPerBlock[2], LocalSize, + CuStream, const_cast(ArgIndices.data()), nullptr)); if (LocalSize != 0) hKernel->clearLocalSize(); @@ -654,12 +649,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunchCustomExp( auto &ArgIndices = hKernel->getArgIndices(); CUlaunchConfig launch_config; - launch_config.gridDimX = static_cast(BlocksPerGrid[0]); - launch_config.gridDimY = static_cast(BlocksPerGrid[1]); - launch_config.gridDimZ = static_cast(BlocksPerGrid[2]); - launch_config.blockDimX = static_cast(ThreadsPerBlock[0]); - launch_config.blockDimY = static_cast(ThreadsPerBlock[1]); - launch_config.blockDimZ = static_cast(ThreadsPerBlock[2]); + launch_config.gridDimX = BlocksPerGrid[0]; + launch_config.gridDimY = BlocksPerGrid[1]; + launch_config.gridDimZ = BlocksPerGrid[2]; + launch_config.blockDimX = ThreadsPerBlock[0]; + launch_config.blockDimY = ThreadsPerBlock[1]; + launch_config.blockDimZ = ThreadsPerBlock[2]; launch_config.sharedMemBytes = LocalSize; launch_config.hStream = CuStream; @@ -984,9 +979,8 @@ ur_result_t commonMemSetLargePattern(CUstream Stream, uint32_t PatternSize, auto OffsetPtr = Ptr + (step * sizeof(uint8_t)); // set all of the pattern chunks - UR_CHECK_ERROR(cuMemsetD2D8Async(OffsetPtr, Pitch, - static_cast(Value), - sizeof(uint8_t), Height, Stream)); + UR_CHECK_ERROR(cuMemsetD2D8Async(OffsetPtr, Pitch, Value, sizeof(uint8_t), + Height, Stream)); } return UR_RESULT_SUCCESS; } @@ -1037,9 +1031,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferFill( break; } default: { - UR_CHECK_ERROR( - commonMemSetLargePattern(Stream, static_cast(patternSize), - size, pPattern, DstDevice)); + UR_CHECK_ERROR(commonMemSetLargePattern(Stream, patternSize, size, + pPattern, DstDevice)); break; } } @@ -1071,6 +1064,7 @@ static size_t imageElementByteSize(CUDA_ARRAY_DESCRIPTOR ArrayDesc) { return 4; default: detail::ur::die("Invalid image format."); + return 0; } } @@ -1174,7 +1168,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageRead( CUDA_ARRAY_DESCRIPTOR ArrayDesc; UR_CHECK_ERROR(cuArrayGetDescriptor(&ArrayDesc, Array)); - int ElementByteSize = static_cast(imageElementByteSize(ArrayDesc)); + int ElementByteSize = imageElementByteSize(ArrayDesc); size_t ByteOffsetX = origin.x * ElementByteSize * ArrayDesc.NumChannels; size_t BytesToCopy = ElementByteSize * ArrayDesc.NumChannels * region.width; @@ -1247,7 +1241,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageWrite( CUDA_ARRAY_DESCRIPTOR ArrayDesc; UR_CHECK_ERROR(cuArrayGetDescriptor(&ArrayDesc, Array)); - int ElementByteSize = static_cast(imageElementByteSize(ArrayDesc)); + int ElementByteSize = imageElementByteSize(ArrayDesc); size_t ByteOffsetX = origin.x * ElementByteSize * ArrayDesc.NumChannels; size_t BytesToCopy = ElementByteSize * ArrayDesc.NumChannels * region.width; @@ -1326,7 +1320,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageCopy( UR_ASSERT(SrcArrayDesc.NumChannels == DstArrayDesc.NumChannels, UR_RESULT_ERROR_INVALID_MEM_OBJECT); - int ElementByteSize = static_cast(imageElementByteSize(SrcArrayDesc)); + int ElementByteSize = imageElementByteSize(SrcArrayDesc); size_t DstByteOffsetX = dstOrigin.x * ElementByteSize * SrcArrayDesc.NumChannels; @@ -1511,8 +1505,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMFill( CuStream)); break; default: - commonMemSetLargePattern(CuStream, static_cast(patternSize), - size, pPattern, (CUdeviceptr)ptr); + commonMemSetLargePattern(CuStream, patternSize, size, pPattern, + (CUdeviceptr)ptr); break; } if (phEvent) { diff --git a/source/adapters/cuda/image.cpp b/source/adapters/cuda/image.cpp index 40fd18fef7..4840553cc1 100644 --- a/source/adapters/cuda/image.cpp +++ b/source/adapters/cuda/image.cpp @@ -284,9 +284,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urUSMPitchedAllocExp( ur_result_t Result = UR_RESULT_SUCCESS; try { ScopedContext Active(hDevice); - UR_CHECK_ERROR( - cuMemAllocPitch((CUdeviceptr *)ppMem, pResultPitch, widthInBytes, - height, static_cast(elementSizeBytes))); + UR_CHECK_ERROR(cuMemAllocPitch((CUdeviceptr *)ppMem, pResultPitch, + widthInBytes, height, elementSizeBytes)); } catch (ur_result_t error) { Result = error; } catch (...) { diff --git a/source/adapters/cuda/kernel.cpp b/source/adapters/cuda/kernel.cpp index 91daf5649c..5fb097c304 100644 --- a/source/adapters/cuda/kernel.cpp +++ b/source/adapters/cuda/kernel.cpp @@ -203,8 +203,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp( int MaxNumActiveGroupsPerCU{0}; UR_CHECK_ERROR(cuOccupancyMaxActiveBlocksPerMultiprocessor( - &MaxNumActiveGroupsPerCU, hKernel->get(), - static_cast(localWorkSize), dynamicSharedMemorySize)); + &MaxNumActiveGroupsPerCU, hKernel->get(), localWorkSize, + dynamicSharedMemorySize)); detail::ur::assertion(MaxNumActiveGroupsPerCU >= 0); // Handle the case where we can't have all SMs active with at least 1 group // per SM. In that case, the device is still able to run 1 work-group, hence diff --git a/source/adapters/cuda/kernel.hpp b/source/adapters/cuda/kernel.hpp index 77d8c817f4..7ad20a4f0e 100644 --- a/source/adapters/cuda/kernel.hpp +++ b/source/adapters/cuda/kernel.hpp @@ -97,8 +97,8 @@ struct ur_kernel_handle_t_ { } ParamSizes[Index] = Size; // calculate the insertion point on the array - size_t InsertPos = std::accumulate( - std::begin(ParamSizes), std::begin(ParamSizes) + Index, size_t{0}); + size_t InsertPos = std::accumulate(std::begin(ParamSizes), + std::begin(ParamSizes) + Index, 0); // Update the stored value for the argument std::memcpy(&Storage[InsertPos], Arg, Size); Indices[Index] = &Storage[InsertPos]; @@ -152,8 +152,8 @@ struct ur_kernel_handle_t_ { const args_index_t &getIndices() const noexcept { return Indices; } uint32_t getLocalSize() const { - return static_cast(std::accumulate( - std::begin(OffsetPerIndex), std::end(OffsetPerIndex), size_t{0})); + return std::accumulate(std::begin(OffsetPerIndex), + std::end(OffsetPerIndex), 0); } } Args; diff --git a/source/adapters/cuda/program.cpp b/source/adapters/cuda/program.cpp index 8a29df8de6..4b963a737a 100644 --- a/source/adapters/cuda/program.cpp +++ b/source/adapters/cuda/program.cpp @@ -148,8 +148,8 @@ ur_result_t ur_program_handle_t_::buildProgram(const char *BuildOptions) { } UR_CHECK_ERROR(cuModuleLoadDataEx(&Module, static_cast(Binary), - static_cast(Options.size()), - Options.data(), OptionVals.data())); + Options.size(), Options.data(), + OptionVals.data())); BuildStatus = UR_PROGRAM_BUILD_STATUS_SUCCESS; diff --git a/source/adapters/cuda/usm.cpp b/source/adapters/cuda/usm.cpp index 8915736b3e..8a6ac41b08 100644 --- a/source/adapters/cuda/usm.cpp +++ b/source/adapters/cuda/usm.cpp @@ -325,7 +325,7 @@ umf_result_t USMMemoryProvider::initialize(ur_context_handle_t Ctx, enum umf_result_t USMMemoryProvider::alloc(size_t Size, size_t Align, void **Ptr) { - auto Res = allocateImpl(Ptr, Size, static_cast(Align)); + auto Res = allocateImpl(Ptr, Size, Align); if (Res != UR_RESULT_SUCCESS) { getLastStatusRef() = Res; return UMF_RESULT_ERROR_MEMORY_PROVIDER_SPECIFIC; diff --git a/source/adapters/level_zero/CMakeLists.txt b/source/adapters/level_zero/CMakeLists.txt index 86424aaf41..d700fbb2c3 100644 --- a/source/adapters/level_zero/CMakeLists.txt +++ b/source/adapters/level_zero/CMakeLists.txt @@ -89,9 +89,8 @@ if(UR_BUILD_ADAPTER_L0) endif() # TODO: fix level_zero adapter conversion warnings - # C4267: The compiler detected a conversion from size_t to a smaller type. target_compile_options(ur_adapter_level_zero PRIVATE - $<$:/wd4805 /wd4244 /wd4267> + $<$:/wd4805 /wd4244> ) set_target_properties(ur_adapter_level_zero PROPERTIES @@ -99,9 +98,9 @@ if(UR_BUILD_ADAPTER_L0) SOVERSION "${PROJECT_VERSION_MAJOR}" ) - if(CMAKE_CXX_COMPILER_LINKER_ID MATCHES MSVC) - # 0x800: Search for the DLL only in the System32 folder - target_link_options(ur_adapter_level_zero PRIVATE LINKER:/DEPENDENTLOADFLAG:0x800) + if (WIN32) + # 0x800: Search for the DLL only in the System32 folder + target_link_options(ur_adapter_level_zero PRIVATE /DEPENDENTLOADFLAG:0x800) endif() target_link_libraries(ur_adapter_level_zero PRIVATE @@ -184,9 +183,8 @@ if(UR_BUILD_ADAPTER_L0_V2) target_compile_definitions(ur_adapter_level_zero_v2 PUBLIC UR_ADAPTER_LEVEL_ZERO_V2) # TODO: fix level_zero adapter conversion warnings - # C4267: The compiler detected a conversion from size_t to a smaller type. target_compile_options(ur_adapter_level_zero_v2 PRIVATE - $<$:/wd4805 /wd4244 /wd4100 /wd4267> + $<$:/wd4805 /wd4244> ) set_target_properties(ur_adapter_level_zero_v2 PROPERTIES @@ -194,9 +192,9 @@ if(UR_BUILD_ADAPTER_L0_V2) SOVERSION "${PROJECT_VERSION_MAJOR}" ) - if(CMAKE_CXX_COMPILER_LINKER_ID MATCHES MSVC) - # 0x800: Search for the DLL only in the System32 folder - target_link_options(ur_adapter_level_zero_v2 PUBLIC LINKER:/DEPENDENTLOADFLAG:0x800) + if (WIN32) + # 0x800: Search for the DLL only in the System32 folder + target_link_options(ur_adapter_level_zero_v2 PUBLIC /DEPENDENTLOADFLAG:0x800) endif() target_link_libraries(ur_adapter_level_zero_v2 PRIVATE diff --git a/source/adapters/level_zero/adapter.cpp b/source/adapters/level_zero/adapter.cpp index 7d3d571c68..9dd2a31268 100644 --- a/source/adapters/level_zero/adapter.cpp +++ b/source/adapters/level_zero/adapter.cpp @@ -514,5 +514,7 @@ ur_result_t urAdapterGetInfo(ur_adapter_handle_t, ur_adapter_info_t PropName, default: return UR_RESULT_ERROR_INVALID_ENUMERATION; } + + return UR_RESULT_SUCCESS; } } // namespace ur::level_zero diff --git a/source/adapters/level_zero/context.cpp b/source/adapters/level_zero/context.cpp index d18aeb684f..41c7593237 100644 --- a/source/adapters/level_zero/context.cpp +++ b/source/adapters/level_zero/context.cpp @@ -756,7 +756,7 @@ ur_result_t ur_context_handle_t_::getAvailableCommandList( // queue's map to hold the fence and other associated command // list information. auto &QGroup = Queue->getQueueGroup(UseCopyEngine); - uint32_t QueueGroupOrdinal = 0; + uint32_t QueueGroupOrdinal; auto &ZeCommandQueue = ForcedCmdQueue ? *ForcedCmdQueue : QGroup.getZeQueue(&QueueGroupOrdinal); diff --git a/source/adapters/level_zero/device.cpp b/source/adapters/level_zero/device.cpp index cfa97e7179..94dad86070 100644 --- a/source/adapters/level_zero/device.cpp +++ b/source/adapters/level_zero/device.cpp @@ -155,7 +155,7 @@ ur_result_t urDeviceGet( } } - uint32_t ZeDeviceCount = static_cast(MatchedDevices.size()); + uint32_t ZeDeviceCount = MatchedDevices.size(); auto N = (std::min)(ZeDeviceCount, NumEntries); if (Devices) @@ -318,10 +318,9 @@ ur_result_t urDeviceGetInfo( Device->QueueGroup[ur_device_handle_t_::queue_group_info_t::Compute] .ZeIndex >= 0; if (RepresentsCSlice) - MaxComputeUnits /= - static_cast(Device->RootDevice->SubDevices.size()); + MaxComputeUnits /= Device->RootDevice->SubDevices.size(); - return ReturnValue(MaxComputeUnits); + return ReturnValue(uint32_t{MaxComputeUnits}); } case UR_DEVICE_INFO_MAX_WORK_ITEM_DIMENSIONS: // Level Zero spec defines only three dimensions @@ -423,8 +422,7 @@ ur_result_t urDeviceGetInfo( return Res; } - uint32_t ZeSubDeviceCount = - static_cast(Device->SubDevices.size()); + uint32_t ZeSubDeviceCount = Device->SubDevices.size(); if (pSize && ZeSubDeviceCount < 2) { *pSize = 0; return UR_RESULT_SUCCESS; @@ -1159,6 +1157,8 @@ ur_result_t urDeviceGetInfo( logger::toHex(ParamName)); return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; } + + return UR_RESULT_SUCCESS; } bool CopyEngineRequested(const ur_device_handle_t &Device) { @@ -1206,7 +1206,7 @@ ur_result_t urDevicePartition( return Res; } - auto EffectiveNumDevices = [&]() -> uint32_t { + auto EffectiveNumDevices = [&]() -> decltype(Device->SubDevices.size()) { if (Device->SubDevices.size() == 0) return 0; @@ -1229,7 +1229,7 @@ ur_result_t urDevicePartition( } } - return static_cast(Device->SubDevices.size()); + return Device->SubDevices.size(); }(); // TODO: Consider support for partitioning to <= total sub-devices. diff --git a/source/adapters/level_zero/event.cpp b/source/adapters/level_zero/event.cpp index f4fbd1db39..408580dd80 100644 --- a/source/adapters/level_zero/event.cpp +++ b/source/adapters/level_zero/event.cpp @@ -498,6 +498,8 @@ ur_result_t urEventGetInfo( PropName, logger::toHex(PropName)); return UR_RESULT_ERROR_INVALID_VALUE; } + + return UR_RESULT_SUCCESS; } ur_result_t urEventGetProfilingInfo( diff --git a/source/adapters/level_zero/platform.cpp b/source/adapters/level_zero/platform.cpp index 506b0ee35b..721db3c359 100644 --- a/source/adapters/level_zero/platform.cpp +++ b/source/adapters/level_zero/platform.cpp @@ -99,6 +99,8 @@ ur_result_t urPlatformGetInfo( logger::debug("urPlatformGetInfo: unrecognized ParamName"); return UR_RESULT_ERROR_INVALID_VALUE; } + + return UR_RESULT_SUCCESS; } ur_result_t urPlatformGetApiVersion( diff --git a/source/adapters/level_zero/program.hpp b/source/adapters/level_zero/program.hpp index e4818e37bf..4fe8c24acd 100644 --- a/source/adapters/level_zero/program.hpp +++ b/source/adapters/level_zero/program.hpp @@ -46,8 +46,7 @@ struct ur_program_handle_t_ : _ur_object { class SpecConstantShim { public: SpecConstantShim(ur_program_handle_t_ *Program) { - ZeSpecConstants.numConstants = - static_cast(Program->SpecConstants.size()); + ZeSpecConstants.numConstants = Program->SpecConstants.size(); ZeSpecContantsIds.reserve(ZeSpecConstants.numConstants); ZeSpecContantsValues.reserve(ZeSpecConstants.numConstants); diff --git a/source/adapters/level_zero/queue.cpp b/source/adapters/level_zero/queue.cpp index 7bce4fc687..c4598f3472 100644 --- a/source/adapters/level_zero/queue.cpp +++ b/source/adapters/level_zero/queue.cpp @@ -2272,7 +2272,7 @@ ur_result_t ur_queue_handle_t_::createCommandList( ZeStruct ZeFenceDesc; ze_command_list_handle_t ZeCommandList; - uint32_t QueueGroupOrdinal = 0; + uint32_t QueueGroupOrdinal; auto &QGroup = getQueueGroup(UseCopyEngine); auto &ZeCommandQueue = ForcedCmdQueue ? *ForcedCmdQueue : QGroup.getZeQueue(&QueueGroupOrdinal); diff --git a/source/adapters/level_zero/usm.cpp b/source/adapters/level_zero/usm.cpp index bf592e0db6..28bdf233e8 100644 --- a/source/adapters/level_zero/usm.cpp +++ b/source/adapters/level_zero/usm.cpp @@ -689,6 +689,7 @@ ur_result_t urUSMGetMemAllocInfo( logger::error("urUSMGetMemAllocInfo: unsupported ParamName"); return UR_RESULT_ERROR_INVALID_VALUE; } + return UR_RESULT_SUCCESS; } ur_result_t urUSMPoolCreate( diff --git a/source/adapters/level_zero/v2/event.cpp b/source/adapters/level_zero/v2/event.cpp index 9f37024252..1197ca7d82 100644 --- a/source/adapters/level_zero/v2/event.cpp +++ b/source/adapters/level_zero/v2/event.cpp @@ -165,6 +165,8 @@ ur_result_t urEventGetInfo(ur_event_handle_t hEvent, ur_event_info_t propName, propName, logger::toHex(propName)); return UR_RESULT_ERROR_INVALID_VALUE; } + + return UR_RESULT_SUCCESS; } ur_result_t urEventGetProfilingInfo( diff --git a/source/adapters/level_zero/v2/kernel.cpp b/source/adapters/level_zero/v2/kernel.cpp index 13e5adaf95..de2e37e9bb 100644 --- a/source/adapters/level_zero/v2/kernel.cpp +++ b/source/adapters/level_zero/v2/kernel.cpp @@ -531,6 +531,7 @@ ur_result_t urKernelGetGroupInfo( return UR_RESULT_ERROR_INVALID_VALUE; } } + return UR_RESULT_SUCCESS; } ur_result_t urKernelGetSubGroupInfo( @@ -559,6 +560,7 @@ ur_result_t urKernelGetSubGroupInfo( returnValue(uint32_t{props.requiredSubgroupSize}); } else { die("urKernelGetSubGroupInfo: parameter not implemented"); + return {}; } return UR_RESULT_SUCCESS; } diff --git a/source/adapters/level_zero/v2/memory.cpp b/source/adapters/level_zero/v2/memory.cpp index 84a5542bae..52bfea42a4 100644 --- a/source/adapters/level_zero/v2/memory.cpp +++ b/source/adapters/level_zero/v2/memory.cpp @@ -529,6 +529,8 @@ ur_result_t urMemGetInfo(ur_mem_handle_t hMemory, ur_mem_info_t propName, return UR_RESULT_ERROR_INVALID_ENUMERATION; } } + + return UR_RESULT_SUCCESS; } ur_result_t urMemRetain(ur_mem_handle_t hMem) { diff --git a/source/adapters/level_zero/v2/queue_immediate_in_order.cpp b/source/adapters/level_zero/v2/queue_immediate_in_order.cpp index 09cc5dab5a..b4f61adbba 100644 --- a/source/adapters/level_zero/v2/queue_immediate_in_order.cpp +++ b/source/adapters/level_zero/v2/queue_immediate_in_order.cpp @@ -190,6 +190,8 @@ ur_queue_immediate_in_order_t::queueGetInfo(ur_queue_info_t propName, propName, logger::toHex(propName)); return UR_RESULT_ERROR_INVALID_VALUE; } + + return UR_RESULT_SUCCESS; } ur_result_t ur_queue_immediate_in_order_t::queueRetain() { diff --git a/source/adapters/level_zero/v2/usm.cpp b/source/adapters/level_zero/v2/usm.cpp index 9b2ae2a0d7..f23a6c6fe8 100644 --- a/source/adapters/level_zero/v2/usm.cpp +++ b/source/adapters/level_zero/v2/usm.cpp @@ -378,5 +378,6 @@ ur_result_t urUSMGetMemAllocInfo( return UR_RESULT_ERROR_INVALID_VALUE; } } + return UR_RESULT_SUCCESS; } } // namespace ur::level_zero diff --git a/source/adapters/level_zero/virtual_mem.cpp b/source/adapters/level_zero/virtual_mem.cpp index 68c457d181..e89899ded7 100644 --- a/source/adapters/level_zero/virtual_mem.cpp +++ b/source/adapters/level_zero/virtual_mem.cpp @@ -38,6 +38,7 @@ ur_result_t urVirtualMemGranularityGetInfo( propName, propName); return UR_RESULT_ERROR_INVALID_VALUE; } + return UR_RESULT_SUCCESS; } ur_result_t urVirtualMemReserve(ur_context_handle_t hContext, @@ -118,5 +119,7 @@ ur_result_t urVirtualMemGetInfo(ur_context_handle_t hContext, propName, propName); return UR_RESULT_ERROR_INVALID_VALUE; } + + return UR_RESULT_SUCCESS; } } // namespace ur::level_zero diff --git a/source/adapters/opencl/adapter.cpp b/source/adapters/opencl/adapter.cpp index 015c4facfd..e794c308f9 100644 --- a/source/adapters/opencl/adapter.cpp +++ b/source/adapters/opencl/adapter.cpp @@ -131,4 +131,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urAdapterGetInfo(ur_adapter_handle_t, default: return UR_RESULT_ERROR_INVALID_ENUMERATION; } + + return UR_RESULT_SUCCESS; } diff --git a/source/adapters/opencl/event.cpp b/source/adapters/opencl/event.cpp index 1792d0f110..45550a68e8 100644 --- a/source/adapters/opencl/event.cpp +++ b/source/adapters/opencl/event.cpp @@ -10,7 +10,6 @@ #include "common.hpp" -#include #include #include #include @@ -33,7 +32,8 @@ cl_event_info convertUREventInfoToCL(const ur_event_info_t PropName) { return CL_EVENT_REFERENCE_COUNT; break; default: - return std::numeric_limits::max(); + return -1; + break; } } @@ -51,7 +51,7 @@ convertURProfilingInfoToCL(const ur_profiling_info_t PropName) { case UR_PROFILING_INFO_COMMAND_END: return CL_PROFILING_COMMAND_END; default: - return std::numeric_limits::max(); + return -1; } } diff --git a/source/adapters/opencl/memory.cpp b/source/adapters/opencl/memory.cpp index 89d9f1d383..201df1f678 100644 --- a/source/adapters/opencl/memory.cpp +++ b/source/adapters/opencl/memory.cpp @@ -9,7 +9,6 @@ //===----------------------------------------------------------------------===// #include "common.hpp" -#include cl_image_format mapURImageFormatToCL(const ur_image_format_t *PImageFormat) { cl_image_format CLImageFormat; @@ -60,8 +59,7 @@ cl_image_format mapURImageFormatToCL(const ur_image_format_t *PImageFormat) { CLImageFormat.image_channel_order = CL_sRGBA; break; default: - CLImageFormat.image_channel_order = - std::numeric_limits::max(); + CLImageFormat.image_channel_order = -1; break; } @@ -112,8 +110,7 @@ cl_image_format mapURImageFormatToCL(const ur_image_format_t *PImageFormat) { CLImageFormat.image_channel_data_type = CL_FLOAT; break; default: - CLImageFormat.image_channel_data_type = - std::numeric_limits::max(); + CLImageFormat.image_channel_data_type = -1; break; } @@ -142,7 +139,7 @@ cl_image_desc mapURImageDescToCL(const ur_image_desc_t *PImageDesc) { CLImageDesc.image_type = CL_MEM_OBJECT_IMAGE1D_ARRAY; break; default: - CLImageDesc.image_type = std::numeric_limits::max(); + CLImageDesc.image_type = -1; break; } diff --git a/source/adapters/opencl/program.cpp b/source/adapters/opencl/program.cpp index 9018ee43f2..20aaa8fd3a 100644 --- a/source/adapters/opencl/program.cpp +++ b/source/adapters/opencl/program.cpp @@ -161,10 +161,10 @@ urProgramCompile([[maybe_unused]] ur_context_handle_t hContext, std::unique_ptr> DevicesInProgram; UR_RETURN_ON_FAILURE(getDevicesFromProgram(hProgram, DevicesInProgram)); - CL_RETURN_ON_FAILURE(clCompileProgram( - cl_adapter::cast(hProgram), - static_cast(DevicesInProgram->size()), DevicesInProgram->data(), - pOptions, 0, nullptr, nullptr, nullptr, nullptr)); + CL_RETURN_ON_FAILURE(clCompileProgram(cl_adapter::cast(hProgram), + DevicesInProgram->size(), + DevicesInProgram->data(), pOptions, 0, + nullptr, nullptr, nullptr, nullptr)); return UR_RESULT_SUCCESS; } @@ -219,10 +219,9 @@ urProgramBuild([[maybe_unused]] ur_context_handle_t hContext, std::unique_ptr> DevicesInProgram; UR_RETURN_ON_FAILURE(getDevicesFromProgram(hProgram, DevicesInProgram)); - CL_RETURN_ON_FAILURE( - clBuildProgram(cl_adapter::cast(hProgram), - static_cast(DevicesInProgram->size()), - DevicesInProgram->data(), pOptions, nullptr, nullptr)); + CL_RETURN_ON_FAILURE(clBuildProgram( + cl_adapter::cast(hProgram), DevicesInProgram->size(), + DevicesInProgram->data(), pOptions, nullptr, nullptr)); return UR_RESULT_SUCCESS; } diff --git a/source/adapters/opencl/queue.cpp b/source/adapters/opencl/queue.cpp index 0bb81cb1e5..2e40963ad1 100644 --- a/source/adapters/opencl/queue.cpp +++ b/source/adapters/opencl/queue.cpp @@ -8,9 +8,9 @@ #include "common.hpp" #include "platform.hpp" -#include cl_command_queue_info mapURQueueInfoToCL(const ur_queue_info_t PropName) { + switch (PropName) { case UR_QUEUE_INFO_CONTEXT: return CL_QUEUE_CONTEXT; @@ -25,7 +25,7 @@ cl_command_queue_info mapURQueueInfoToCL(const ur_queue_info_t PropName) { case UR_QUEUE_INFO_SIZE: return CL_QUEUE_SIZE; default: - return std::numeric_limits::max(); + return -1; } } diff --git a/source/adapters/opencl/usm.cpp b/source/adapters/opencl/usm.cpp index 4119f4ddfd..dfcc1dfafa 100644 --- a/source/adapters/opencl/usm.cpp +++ b/source/adapters/opencl/usm.cpp @@ -614,14 +614,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMMemcpy2D( } cl_int ClResult = CL_SUCCESS; if (blocking) { - ClResult = - clWaitForEvents(static_cast(Events.size()), Events.data()); + ClResult = clWaitForEvents(Events.size(), Events.data()); } if (phEvent && ClResult == CL_SUCCESS) { ClResult = clEnqueueBarrierWithWaitList( - cl_adapter::cast(hQueue), - static_cast(Events.size()), Events.data(), - cl_adapter::cast(phEvent)); + cl_adapter::cast(hQueue), Events.size(), + Events.data(), cl_adapter::cast(phEvent)); } for (const auto &E : Events) { CL_RETURN_ON_FAILURE(clReleaseEvent(E)); diff --git a/source/adapters/opencl/usm_p2p.cpp b/source/adapters/opencl/usm_p2p.cpp index 66387f5226..b0f51eac2b 100644 --- a/source/adapters/opencl/usm_p2p.cpp +++ b/source/adapters/opencl/usm_p2p.cpp @@ -8,12 +8,13 @@ // //===----------------------------------------------------------------------===// -#include "logger/ur_logger.hpp" +#include "common.hpp" UR_APIEXPORT ur_result_t UR_APICALL urUsmP2PEnablePeerAccessExp([[maybe_unused]] ur_device_handle_t commandDevice, [[maybe_unused]] ur_device_handle_t peerDevice) { - logger::warning( + + cl_adapter::die( "Experimental P2P feature is not implemented for OpenCL adapter."); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -21,7 +22,8 @@ urUsmP2PEnablePeerAccessExp([[maybe_unused]] ur_device_handle_t commandDevice, UR_APIEXPORT ur_result_t UR_APICALL urUsmP2PDisablePeerAccessExp([[maybe_unused]] ur_device_handle_t commandDevice, [[maybe_unused]] ur_device_handle_t peerDevice) { - logger::warning( + + cl_adapter::die( "Experimental P2P feature is not implemented for OpenCL adapter."); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -32,7 +34,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urUsmP2PPeerAccessGetInfoExp( [[maybe_unused]] ur_exp_peer_info_t propName, [[maybe_unused]] size_t propSize, [[maybe_unused]] void *pPropValue, [[maybe_unused]] size_t *pPropSizeRet) { - logger::warning( + + cl_adapter::die( "Experimental P2P feature is not implemented for OpenCL adapter."); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/source/common/logger/ur_logger.hpp b/source/common/logger/ur_logger.hpp index 1039d16d3f..c4dc655444 100644 --- a/source/common/logger/ur_logger.hpp +++ b/source/common/logger/ur_logger.hpp @@ -116,9 +116,8 @@ template inline std::string toHex(T t) { inline Logger create_logger(std::string logger_name, bool skip_prefix, bool skip_linebreak, logger::Level default_log_level) { - std::transform( - logger_name.begin(), logger_name.end(), logger_name.begin(), - [](char c) -> char { return static_cast(::toupper(c)); }); + std::transform(logger_name.begin(), logger_name.end(), logger_name.begin(), + ::toupper); std::stringstream env_var_name; const auto default_flush_level = logger::Level::ERR; const std::string default_output = "stderr"; diff --git a/source/common/ur_util.cpp b/source/common/ur_util.cpp index 78651c4212..176a2e028e 100644 --- a/source/common/ur_util.cpp +++ b/source/common/ur_util.cpp @@ -15,7 +15,7 @@ #include int ur_getpid(void) { return static_cast(GetCurrentProcessId()); } -int ur_close_fd(int fd [[maybe_unused]]) { return -1; } +int ur_close_fd(int fd) { return -1; } int ur_duplicate_fd(int pid, int fd_in) { // TODO: find another way to obtain a duplicate of another process's file descriptor diff --git a/source/common/ur_util.hpp b/source/common/ur_util.hpp index 878123b6f0..0ede3c93dc 100644 --- a/source/common/ur_util.hpp +++ b/source/common/ur_util.hpp @@ -98,9 +98,8 @@ std::optional ur_getenv(const char *name); inline bool getenv_tobool(const char *name, bool def = false) { if (auto env = ur_getenv(name); env) { - std::transform(env->begin(), env->end(), env->begin(), [](char c) { - return static_cast(std::tolower(c)); - }); + std::transform(env->begin(), env->end(), env->begin(), + [](unsigned char c) { return std::tolower(c); }); auto true_str = {"y", "yes", "t", "true", "1"}; return std::find(true_str.begin(), true_str.end(), *env) != true_str.end(); diff --git a/source/loader/layers/tracing/ur_tracing_layer.cpp b/source/loader/layers/tracing/ur_tracing_layer.cpp index 3a1cada334..614f649a3c 100644 --- a/source/loader/layers/tracing/ur_tracing_layer.cpp +++ b/source/loader/layers/tracing/ur_tracing_layer.cpp @@ -12,16 +12,8 @@ #include "ur_tracing_layer.hpp" #include "ur_api.h" #include "ur_util.hpp" - -#ifdef _MSC_VER -#pragma warning(disable : 4245) -#endif #include "xpti/xpti_data_types.h" #include "xpti/xpti_trace_framework.h" -#ifdef _MSC_VER -#pragma warning(default : 4245) -#endif - #include #include #include diff --git a/source/loader/ur_adapter_registry.hpp b/source/loader/ur_adapter_registry.hpp index 201b57c6f0..7df799ab1e 100644 --- a/source/loader/ur_adapter_registry.hpp +++ b/source/loader/ur_adapter_registry.hpp @@ -225,13 +225,12 @@ class AdapterRegistry { } // case-insensitive comparison by converting both tolower - std::transform( - platformBackendName.begin(), platformBackendName.end(), - platformBackendName.begin(), - [](char c) { return static_cast(std::tolower(c)); }); - std::transform( - backend.begin(), backend.end(), backend.begin(), - [](char c) { return static_cast(std::tolower(c)); }); + std::transform(platformBackendName.begin(), + platformBackendName.end(), + platformBackendName.begin(), + [](unsigned char c) { return std::tolower(c); }); + std::transform(backend.begin(), backend.end(), backend.begin(), + [](unsigned char c) { return std::tolower(c); }); std::size_t nameFound = platformBackendName.find(backend); bool backendFound = nameFound != std::string::npos; diff --git a/source/loader/ur_lib.cpp b/source/loader/ur_lib.cpp index fb8035b428..e1de6d6237 100644 --- a/source/loader/ur_lib.cpp +++ b/source/loader/ur_lib.cpp @@ -17,7 +17,6 @@ #define NOMINMAX #include "ur_api.h" #include "ur_ldrddi.hpp" -#include #endif // !NOMINMAX #include "logger/ur_logger.hpp" @@ -413,7 +412,7 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform, using DeviceIdType = unsigned long; constexpr DeviceIdType DeviceIdTypeALL = - std::numeric_limits::max(); + -1; // ULONG_MAX but without #include struct DeviceSpec { DevicePartLevel level; @@ -427,9 +426,8 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform, auto getRootHardwareType = [](const std::string &input) -> DeviceHardwareType { std::string lowerInput(input); - std::transform( - lowerInput.cbegin(), lowerInput.cend(), lowerInput.begin(), - [](char c) { return static_cast(std::tolower(c)); }); + std::transform(lowerInput.cbegin(), lowerInput.cend(), + lowerInput.begin(), ::tolower); if (lowerInput == "cpu") { return ::UR_DEVICE_TYPE_CPU; } @@ -484,8 +482,9 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform, platformBackendName.cend(), backend.cbegin(), backend.cend(), [](const auto &a, const auto &b) { // case-insensitive comparison by converting both tolower - return std::tolower(static_cast(a)) == - std::tolower(static_cast(b)); + return std::tolower( + static_cast(a)) == + std::tolower(static_cast(b)); })) { // irrelevant term for current request: different backend -- silently ignore logger::error("unrecognised backend '{}'", backend); diff --git a/source/loader/windows/adapter_search.cpp b/source/loader/windows/adapter_search.cpp index f850ec5de7..b514897d91 100644 --- a/source/loader/windows/adapter_search.cpp +++ b/source/loader/windows/adapter_search.cpp @@ -40,8 +40,7 @@ std::optional getLoaderLibPath() { return std::nullopt; } -std::optional getAdapterNameAsPath(std::string adapterName - [[maybe_unused]]) { +std::optional getAdapterNameAsPath(std::string adapterName) { return std::nullopt; } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b9a7f5a0d0..e7514cefd8 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -32,7 +32,6 @@ add_subdirectory(mock) if(UR_BUILD_TOOLS) add_subdirectory(tools) endif() -if(CMAKE_CXX_COMPILER_ID STREQUAL Clang AND UR_DPCXX AND UR_TEST_FUZZTESTS AND - CMAKE_SYSTEM_NAME STREQUAL Linux) +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND UR_DPCXX AND UR_TEST_FUZZTESTS) add_subdirectory(fuzz) endif() diff --git a/test/conformance/device/urDevicePartition.cpp b/test/conformance/device/urDevicePartition.cpp index 1241900a1a..2b2939066d 100644 --- a/test/conformance/device/urDevicePartition.cpp +++ b/test/conformance/device/urDevicePartition.cpp @@ -138,7 +138,7 @@ TEST_F(urDevicePartitionTest, PartitionByCounts) { uint32_t sum = 0; for (auto sub_device : sub_devices) { ASSERT_NE(sub_device, nullptr); - uint32_t n_cu_in_sub_device = 0; + uint32_t n_cu_in_sub_device; ASSERT_NO_FATAL_FAILURE( getNumberComputeUnits(sub_device, n_cu_in_sub_device)); sum += n_cu_in_sub_device; diff --git a/test/conformance/enqueue/urEnqueueDeviceGlobalVariableRead.cpp b/test/conformance/enqueue/urEnqueueDeviceGlobalVariableRead.cpp index d247ee6e96..799ce7a67d 100644 --- a/test/conformance/enqueue/urEnqueueDeviceGlobalVariableRead.cpp +++ b/test/conformance/enqueue/urEnqueueDeviceGlobalVariableRead.cpp @@ -14,7 +14,7 @@ TEST_P(urEnqueueDeviceGetGlobalVariableReadTest, Success) { 0, &global_var.value, 0, nullptr, nullptr)); size_t global_offset = 0; - uint32_t n_dimensions = 1; + size_t n_dimensions = 1; size_t global_size = 1; // execute the kernel diff --git a/test/conformance/enqueue/urEnqueueEventsWaitMultiDevice.cpp b/test/conformance/enqueue/urEnqueueEventsWaitMultiDevice.cpp index 8ee6dc5365..1e281b0632 100644 --- a/test/conformance/enqueue/urEnqueueEventsWaitMultiDevice.cpp +++ b/test/conformance/enqueue/urEnqueueEventsWaitMultiDevice.cpp @@ -175,9 +175,8 @@ TEST_P(urEnqueueEventsWaitMultiDeviceMTTest, EnqueueWaitOnAllQueues) { doComputation(work); uur::raii::Event gatherEvent; - ASSERT_SUCCESS(urEnqueueEventsWait(queues[0], - static_cast(devices.size()), - events.data(), gatherEvent.ptr())); + ASSERT_SUCCESS(urEnqueueEventsWait(queues[0], devices.size(), events.data(), + gatherEvent.ptr())); ASSERT_SUCCESS(urEventWait(1, gatherEvent.ptr())); for (size_t i = 0; i < devices.size(); i++) { @@ -202,9 +201,9 @@ TEST_P(urEnqueueEventsWaitMultiDeviceMTTest, doComputation(work); uur::raii::Event hGatherEvent; - ASSERT_SUCCESS(urEnqueueEventsWait( - queues[0], static_cast(eventHandles.size()), - eventHandles.data(), hGatherEvent.ptr())); + ASSERT_SUCCESS(urEnqueueEventsWait(queues[0], eventHandles.size(), + eventHandles.data(), + hGatherEvent.ptr())); ASSERT_SUCCESS(urEventWait(1, hGatherEvent.ptr())); for (auto &event : eventHandles) { diff --git a/test/conformance/enqueue/urEnqueueKernelLaunch.cpp b/test/conformance/enqueue/urEnqueueKernelLaunch.cpp index eefd204cc3..7ffa072466 100644 --- a/test/conformance/enqueue/urEnqueueKernelLaunch.cpp +++ b/test/conformance/enqueue/urEnqueueKernelLaunch.cpp @@ -15,7 +15,7 @@ struct urEnqueueKernelLaunchTest : uur::urKernelExecutionTest { uint32_t val = 42; size_t global_size = 32; size_t global_offset = 0; - uint32_t n_dimensions = 1; + size_t n_dimensions = 1; }; UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urEnqueueKernelLaunchTest); @@ -29,7 +29,7 @@ struct urEnqueueKernelLaunchKernelWgSizeTest : uur::urKernelExecutionTest { std::array global_offset{0, 0, 0}; // This must match the size in fixed_wg_size.cpp std::array wg_size{4, 4, 4}; - uint32_t n_dimensions = 3; + size_t n_dimensions = 3; }; UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urEnqueueKernelLaunchKernelWgSizeTest); @@ -42,7 +42,7 @@ struct urEnqueueKernelLaunchKernelSubGroupTest : uur::urKernelExecutionTest { std::array global_size{32, 32, 32}; std::array global_offset{0, 0, 0}; - uint32_t n_dimensions = 3; + size_t n_dimensions = 3; }; UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urEnqueueKernelLaunchKernelSubGroupTest); @@ -52,7 +52,7 @@ struct urEnqueueKernelLaunchKernelStandardTest : uur::urKernelExecutionTest { UUR_RETURN_ON_FATAL_FAILURE(urKernelExecutionTest::SetUp()); } - uint32_t n_dimensions = 1; + size_t n_dimensions = 1; size_t global_size = 1; size_t offset = 0; }; @@ -210,7 +210,7 @@ TEST_P(urEnqueueKernelLaunchKernelStandardTest, Success) { struct testParametersEnqueueKernel { size_t X, Y, Z; - uint32_t Dims; + size_t Dims; }; template @@ -261,7 +261,7 @@ struct urEnqueueKernelLaunchTestWithParam uint32_t val = 42; size_t global_range[3]; size_t global_offset[3] = {0, 0, 0}; - uint32_t n_dimensions; + size_t n_dimensions; size_t buffer_size; }; @@ -333,7 +333,7 @@ struct urEnqueueKernelLaunchWithUSM : uur::urKernelExecutionTest { UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urEnqueueKernelLaunchWithUSM); TEST_P(urEnqueueKernelLaunchWithUSM, Success) { - uint32_t work_dim = 1; + size_t work_dim = 1; size_t global_offset = 0; size_t global_size = alloc_size / sizeof(uint32_t); uint32_t fill_val = 42; @@ -424,7 +424,7 @@ struct urEnqueueKernelLaunchWithVirtualMemory : uur::urKernelExecutionTest { UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urEnqueueKernelLaunchWithVirtualMemory); TEST_P(urEnqueueKernelLaunchWithVirtualMemory, Success) { - uint32_t work_dim = 1; + size_t work_dim = 1; size_t global_offset = 0; size_t global_size = alloc_size / sizeof(uint32_t); uint32_t fill_val = 42; diff --git a/test/conformance/enqueue/urEnqueueKernelLaunchAndMemcpyInOrder.cpp b/test/conformance/enqueue/urEnqueueKernelLaunchAndMemcpyInOrder.cpp index f20e4f1873..b6306f1693 100644 --- a/test/conformance/enqueue/urEnqueueKernelLaunchAndMemcpyInOrder.cpp +++ b/test/conformance/enqueue/urEnqueueKernelLaunchAndMemcpyInOrder.cpp @@ -354,7 +354,7 @@ TEST_P(urEnqueueKernelLaunchIncrementMultiDeviceMultiThreadTest, Success) { for (size_t i = 0; i < numThreads; i++) { threads.emplace_back([this, i, queuePerThread, useEvents]() { constexpr size_t global_offset = 0; - constexpr uint32_t n_dimensions = 1; + constexpr size_t n_dimensions = 1; auto queue = queuePerThread ? queues[i] : queues.back(); auto kernel = kernels[i]; @@ -362,7 +362,7 @@ TEST_P(urEnqueueKernelLaunchIncrementMultiDeviceMultiThreadTest, Success) { std::vector Events(numOpsPerThread + 1); for (size_t j = 0; j < numOpsPerThread; j++) { - uint32_t waitNum = 0; + size_t waitNum = 0; ur_event_handle_t *lastEvent = nullptr; ur_event_handle_t *signalEvent = nullptr; diff --git a/test/conformance/exp_command_buffer/commands.cpp b/test/conformance/exp_command_buffer/commands.cpp index 4ca2d263cb..49b2444176 100644 --- a/test/conformance/exp_command_buffer/commands.cpp +++ b/test/conformance/exp_command_buffer/commands.cpp @@ -148,8 +148,8 @@ struct urCommandBufferAppendKernelLaunchExpTest int32_t *ptrX = static_cast(shared_ptrs[1]); int32_t *ptrY = static_cast(shared_ptrs[2]); for (size_t i = 0; i < global_size; i++) { - ptrX[i] = static_cast(i); - ptrY[i] = static_cast(i * 2); + ptrX[i] = i; + ptrY[i] = i * 2; } // Index 0 is output @@ -200,7 +200,7 @@ TEST_P(urCommandBufferAppendKernelLaunchExpTest, Basic) { int32_t *ptrZ = static_cast(shared_ptrs[0]); for (size_t i = 0; i < global_size; i++) { - int32_t result = static_cast((A * i) + (i * 2)); + uint32_t result = (A * i) + (i * 2); ASSERT_EQ(result, ptrZ[i]); } } diff --git a/test/conformance/exp_command_buffer/fixtures.h b/test/conformance/exp_command_buffer/fixtures.h index 9f9455ce98..42bee05b5a 100644 --- a/test/conformance/exp_command_buffer/fixtures.h +++ b/test/conformance/exp_command_buffer/fixtures.h @@ -8,8 +8,6 @@ #include -#include - namespace uur { namespace command_buffer { diff --git a/test/conformance/exp_command_buffer/update/buffer_fill_kernel_update.cpp b/test/conformance/exp_command_buffer/update/buffer_fill_kernel_update.cpp index 1a56e356be..3e13a895ff 100644 --- a/test/conformance/exp_command_buffer/update/buffer_fill_kernel_update.cpp +++ b/test/conformance/exp_command_buffer/update/buffer_fill_kernel_update.cpp @@ -336,7 +336,7 @@ TEST_P(BufferFillCommandTest, OverrideUpdate) { ASSERT_SUCCESS(urCommandBufferUpdateKernelLaunchExp(command_handle, &first_update_desc)); - uint32_t second_val = 99; + uint32_t second_val = -99; ur_exp_command_buffer_update_value_arg_desc_t second_input_desc = { UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC, // stype nullptr, // pNext @@ -393,7 +393,7 @@ TEST_P(BufferFillCommandTest, OverrideArgList) { &first_val, // hArgValue }; - uint32_t second_val = 99; + uint32_t second_val = -99; input_descs[1] = { UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC, // stype nullptr, // pNext diff --git a/test/conformance/exp_command_buffer/update/buffer_saxpy_kernel_update.cpp b/test/conformance/exp_command_buffer/update/buffer_saxpy_kernel_update.cpp index 5484289cec..858b6b5680 100644 --- a/test/conformance/exp_command_buffer/update/buffer_saxpy_kernel_update.cpp +++ b/test/conformance/exp_command_buffer/update/buffer_saxpy_kernel_update.cpp @@ -31,7 +31,7 @@ struct BufferSaxpyKernelTest } // Variable that is incremented as arguments are added to the kernel - uint32_t current_arg_index = 0; + size_t current_arg_index = 0; // Index 0 is output buffer for HIP/Non-HIP ASSERT_SUCCESS(urKernelSetArgMemObj(kernel, current_arg_index++, nullptr, buffers[0])); diff --git a/test/conformance/exp_command_buffer/update/kernel_handle_update.cpp b/test/conformance/exp_command_buffer/update/kernel_handle_update.cpp index 15ea4787c0..9fb408fb42 100644 --- a/test/conformance/exp_command_buffer/update/kernel_handle_update.cpp +++ b/test/conformance/exp_command_buffer/update/kernel_handle_update.cpp @@ -269,8 +269,7 @@ TEST_P(urCommandBufferKernelHandleUpdateTest, Success) { ASSERT_SUCCESS(urCommandBufferAppendKernelLaunchExp( updatable_cmd_buf_handle, SaxpyKernel->Kernel, SaxpyKernel->NDimensions, &(SaxpyKernel->GlobalOffset), &(SaxpyKernel->GlobalSize), - &(SaxpyKernel->LocalSize), - static_cast(KernelAlternatives.size()), + &(SaxpyKernel->LocalSize), KernelAlternatives.size(), KernelAlternatives.data(), 0, nullptr, 0, nullptr, nullptr, nullptr, CommandHandle.ptr())); ASSERT_NE(CommandHandle, nullptr); @@ -299,8 +298,7 @@ TEST_P(urCommandBufferKernelHandleUpdateTest, UpdateAgain) { ASSERT_SUCCESS(urCommandBufferAppendKernelLaunchExp( updatable_cmd_buf_handle, SaxpyKernel->Kernel, SaxpyKernel->NDimensions, &(SaxpyKernel->GlobalOffset), &(SaxpyKernel->GlobalSize), - &(SaxpyKernel->LocalSize), - static_cast(KernelAlternatives.size()), + &(SaxpyKernel->LocalSize), KernelAlternatives.size(), KernelAlternatives.data(), 0, nullptr, 0, nullptr, nullptr, nullptr, CommandHandle.ptr())); ASSERT_NE(CommandHandle, nullptr); @@ -338,8 +336,7 @@ TEST_P(urCommandBufferKernelHandleUpdateTest, RestoreOriginalKernel) { ASSERT_SUCCESS(urCommandBufferAppendKernelLaunchExp( updatable_cmd_buf_handle, SaxpyKernel->Kernel, SaxpyKernel->NDimensions, &(SaxpyKernel->GlobalOffset), &(SaxpyKernel->GlobalSize), - &(SaxpyKernel->LocalSize), - static_cast(KernelAlternatives.size()), + &(SaxpyKernel->LocalSize), KernelAlternatives.size(), KernelAlternatives.data(), 0, nullptr, 0, nullptr, nullptr, nullptr, CommandHandle.ptr())); ASSERT_NE(CommandHandle, nullptr); @@ -397,9 +394,9 @@ TEST_P(urCommandBufferKernelHandleUpdateTest, updatable_cmd_buf_handle, SaxpyKernel->Kernel, SaxpyKernel->NDimensions, &(SaxpyKernel->GlobalOffset), &(SaxpyKernel->GlobalSize), &(SaxpyKernel->LocalSize), - static_cast(KernelAlternatives.size()), - KernelAlternatives.data(), 0, nullptr, 0, nullptr, - nullptr, nullptr, &CommandHandle)); + KernelAlternatives.size(), KernelAlternatives.data(), + 0, nullptr, 0, nullptr, nullptr, nullptr, + &CommandHandle)); } using urCommandBufferValidUpdateParametersTest = @@ -454,8 +451,7 @@ TEST_P(urCommandBufferValidUpdateParametersTest, UpdateOnlyLocalWorkSize) { ASSERT_SUCCESS(urCommandBufferAppendKernelLaunchExp( updatable_cmd_buf_handle, SaxpyKernel->Kernel, SaxpyKernel->NDimensions, &(SaxpyKernel->GlobalOffset), &(SaxpyKernel->GlobalSize), - &(SaxpyKernel->LocalSize), - static_cast(KernelAlternatives.size()), + &(SaxpyKernel->LocalSize), KernelAlternatives.size(), KernelAlternatives.data(), 0, nullptr, 0, nullptr, nullptr, nullptr, CommandHandle.ptr())); ASSERT_NE(CommandHandle, nullptr); diff --git a/test/conformance/exp_command_buffer/update/usm_fill_kernel_update.cpp b/test/conformance/exp_command_buffer/update/usm_fill_kernel_update.cpp index a28414c94d..85e6beccf9 100644 --- a/test/conformance/exp_command_buffer/update/usm_fill_kernel_update.cpp +++ b/test/conformance/exp_command_buffer/update/usm_fill_kernel_update.cpp @@ -222,7 +222,7 @@ struct USMMultipleFillCommandTest std::memset(shared_ptr, 0, allocation_size); // Append multiple kernel commands to command-buffer - for (uint32_t k = 0; k < num_kernels; k++) { + for (size_t k = 0; k < num_kernels; k++) { // Calculate offset into output allocation, and set as // kernel output. void *offset_ptr = (uint32_t *)shared_ptr + (k * elements); @@ -270,7 +270,7 @@ struct USMMultipleFillCommandTest static constexpr size_t global_offset = 0; static constexpr size_t n_dimensions = 1; static constexpr size_t allocation_size = sizeof(val) * global_size; - static constexpr uint32_t num_kernels = 8; + static constexpr size_t num_kernels = 8; static constexpr size_t elements = global_size / num_kernels; void *shared_ptr = nullptr; @@ -290,7 +290,7 @@ TEST_P(USMMultipleFillCommandTest, UpdateAllKernels) { uint32_t *output = (uint32_t *)shared_ptr; for (size_t i = 0; i < global_size; i++) { - const uint32_t expected = val + (static_cast(i) / elements); + const uint32_t expected = val + (i / elements); ASSERT_EQ(expected, output[i]); } @@ -314,7 +314,7 @@ TEST_P(USMMultipleFillCommandTest, UpdateAllKernels) { }; // Update fill value - uint32_t new_fill_val = new_val + static_cast(k); + uint32_t new_fill_val = new_val + k; ur_exp_command_buffer_update_value_arg_desc_t new_input_desc = { UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC, // stype nullptr, // pNext @@ -352,7 +352,7 @@ TEST_P(USMMultipleFillCommandTest, UpdateAllKernels) { // Verify that update occurred correctly uint32_t *updated_output = (uint32_t *)new_shared_ptr; for (size_t i = 0; i < global_size; i++) { - uint32_t expected = new_val + (static_cast(i) / elements); + uint32_t expected = new_val + (i / elements); ASSERT_EQ(expected, updated_output[i]) << i; } } diff --git a/test/conformance/exp_launch_properties/launch_properties.cpp b/test/conformance/exp_launch_properties/launch_properties.cpp index fcb1bdc78c..a54a44ecaf 100644 --- a/test/conformance/exp_launch_properties/launch_properties.cpp +++ b/test/conformance/exp_launch_properties/launch_properties.cpp @@ -14,7 +14,7 @@ struct urEnqueueKernelLaunchCustomTest : uur::urKernelExecutionTest { uint32_t val = 42; size_t global_size = 32; size_t global_offset = 0; - uint32_t n_dimensions = 1; + size_t n_dimensions = 1; }; UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urEnqueueKernelLaunchCustomTest); diff --git a/test/conformance/integration/QueueBuffer.cpp b/test/conformance/integration/QueueBuffer.cpp index 02d5b7b1b9..d801ebf684 100644 --- a/test/conformance/integration/QueueBuffer.cpp +++ b/test/conformance/integration/QueueBuffer.cpp @@ -4,7 +4,8 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include "fixtures.h" -#include +#include +#include struct QueueBufferTestWithParam : uur::IntegrationQueueTestWithParam { void SetUp() override { @@ -46,8 +47,8 @@ TEST_P(QueueBufferTestWithParam, QueueBufferTest) { std::vector EventsFill; ur_event_handle_t Event; - size_t Buffer1Index = 0; - size_t Buffer2Index = 0; + size_t Buffer1Index; + size_t Buffer2Index; ASSERT_NO_FATAL_FAILURE( AddBuffer1DArg(ArraySize * sizeof(uint32_t), &Buffer1, &Buffer1Index)); ASSERT_NO_FATAL_FAILURE( @@ -74,10 +75,10 @@ TEST_P(QueueBufferTestWithParam, QueueBufferTest) { for (uint32_t i = 0; i < NumIterations; ++i) { /* Copy from DeviceMem1 to DeviceMem2 and multiply by 2 */ - ASSERT_SUCCESS(urKernelSetArgMemObj( - kernel, static_cast(Buffer2Index), nullptr, Buffer2)); - ASSERT_SUCCESS(urKernelSetArgMemObj( - kernel, static_cast(Buffer1Index), nullptr, Buffer1)); + ASSERT_SUCCESS( + urKernelSetArgMemObj(kernel, Buffer2Index, nullptr, Buffer2)); + ASSERT_SUCCESS( + urKernelSetArgMemObj(kernel, Buffer1Index, nullptr, Buffer1)); ASSERT_SUCCESS(urEnqueueKernelLaunch(Queue, kernel, NDimensions, &GlobalOffset, &ArraySize, nullptr, @@ -87,10 +88,10 @@ TEST_P(QueueBufferTestWithParam, QueueBufferTest) { CurValueMem2 = CurValueMem1 * 2; /* Copy from DeviceMem1 to DeviceMem2 and multiply by 2 */ - ASSERT_SUCCESS(urKernelSetArgMemObj( - kernel, static_cast(Buffer1Index), nullptr, Buffer2)); - ASSERT_SUCCESS(urKernelSetArgMemObj( - kernel, static_cast(Buffer2Index), nullptr, Buffer1)); + ASSERT_SUCCESS( + urKernelSetArgMemObj(kernel, Buffer1Index, nullptr, Buffer2)); + ASSERT_SUCCESS( + urKernelSetArgMemObj(kernel, Buffer2Index, nullptr, Buffer1)); ASSERT_SUCCESS(urEnqueueKernelLaunch(Queue, kernel, NDimensions, &GlobalOffset, &ArraySize, nullptr, diff --git a/test/conformance/integration/fixtures.h b/test/conformance/integration/fixtures.h index d4d71fa9fa..aca70a5245 100644 --- a/test/conformance/integration/fixtures.h +++ b/test/conformance/integration/fixtures.h @@ -35,8 +35,7 @@ struct IntegrationQueueTestWithParam void submitBarrierIfNeeded(std::vector &(Events)) { if (QueueFlags == UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE) { ASSERT_SUCCESS(urEnqueueEventsWaitWithBarrier( - Queue, static_cast(Events.size()), Events.data(), - nullptr)); + Queue, Events.size(), Events.data(), nullptr)); AllEvents.insert(AllEvents.end(), Events.begin(), Events.end()); } } diff --git a/test/conformance/kernel/urKernelGetSuggestedLocalWorkSize.cpp b/test/conformance/kernel/urKernelGetSuggestedLocalWorkSize.cpp index 4b39755400..4eeabf5573 100644 --- a/test/conformance/kernel/urKernelGetSuggestedLocalWorkSize.cpp +++ b/test/conformance/kernel/urKernelGetSuggestedLocalWorkSize.cpp @@ -12,7 +12,7 @@ struct urKernelGetSuggestedLocalWorkSizeTest : uur::urKernelExecutionTest { } size_t global_size = 32; size_t global_offset = 0; - uint32_t n_dimensions = 1; + size_t n_dimensions = 1; size_t suggested_local_work_size; }; diff --git a/test/conformance/kernel/urKernelSetArgSampler.cpp b/test/conformance/kernel/urKernelSetArgSampler.cpp index 9a8a16599e..83a65613e5 100644 --- a/test/conformance/kernel/urKernelSetArgSampler.cpp +++ b/test/conformance/kernel/urKernelSetArgSampler.cpp @@ -105,7 +105,7 @@ UUR_INSTANTIATE_KERNEL_TEST_SUITE_P(urKernelSetArgSamplerTest); TEST_P(urKernelSetArgSamplerTest, SuccessWithProps) { ur_kernel_arg_sampler_properties_t props{ UR_STRUCTURE_TYPE_KERNEL_ARG_SAMPLER_PROPERTIES, nullptr}; - uint32_t arg_index = 2; + size_t arg_index = 2; ASSERT_SUCCESS(urKernelSetArgSampler(kernel, arg_index, &props, sampler)); } diff --git a/test/conformance/memory-migrate/urMemBufferMigrateAcrossDevices.cpp b/test/conformance/memory-migrate/urMemBufferMigrateAcrossDevices.cpp index bf2a44300a..f7617a2940 100644 --- a/test/conformance/memory-migrate/urMemBufferMigrateAcrossDevices.cpp +++ b/test/conformance/memory-migrate/urMemBufferMigrateAcrossDevices.cpp @@ -88,7 +88,7 @@ struct urMultiDeviceContextMemBufferTest : urMultiDeviceContextTest { } // Adds a kernel arg representing a sycl buffer constructed with a 1D range. - void AddBuffer1DArg(ur_kernel_handle_t kernel, uint32_t current_arg_index, + void AddBuffer1DArg(ur_kernel_handle_t kernel, size_t current_arg_index, ur_mem_handle_t buffer) { ASSERT_SUCCESS( urKernelSetArgMemObj(kernel, current_arg_index, nullptr, buffer)); diff --git a/test/conformance/program/urMultiDeviceProgramCreateWithBinary.cpp b/test/conformance/program/urMultiDeviceProgramCreateWithBinary.cpp index 1b8e380d27..95a135af1c 100644 --- a/test/conformance/program/urMultiDeviceProgramCreateWithBinary.cpp +++ b/test/conformance/program/urMultiDeviceProgramCreateWithBinary.cpp @@ -39,8 +39,8 @@ struct urMultiDeviceProgramCreateWithBinaryTest // Now create a program with multiple device binaries. ASSERT_SUCCESS(urProgramCreateWithBinary( - context, static_cast(devices.size()), devices.data(), - binary_sizes.data(), pointers.data(), nullptr, &binary_program)); + context, devices.size(), devices.data(), binary_sizes.data(), + pointers.data(), nullptr, &binary_program)); } void TearDown() override { @@ -61,7 +61,7 @@ struct urMultiDeviceProgramCreateWithBinaryTest TEST_F(urMultiDeviceProgramCreateWithBinaryTest, CreateAndRunKernelOnAllDevices) { constexpr size_t global_offset = 0; - constexpr uint32_t n_dimensions = 1; + constexpr size_t n_dimensions = 1; constexpr size_t global_size = 100; constexpr size_t local_size = 100; @@ -112,9 +112,8 @@ TEST_F(urMultiDeviceProgramCreateWithBinaryTest, pointers_with_invalid_binary.push_back(nullptr); } uur::raii::Program invalid_bin_program; - ASSERT_EQ(urProgramCreateWithBinary(context, - static_cast(devices.size()), - devices.data(), binary_sizes.data(), + ASSERT_EQ(urProgramCreateWithBinary(context, devices.size(), devices.data(), + binary_sizes.data(), pointers_with_invalid_binary.data(), nullptr, invalid_bin_program.ptr()), UR_RESULT_ERROR_INVALID_VALUE); @@ -133,23 +132,20 @@ TEST_F(urMultiDeviceProgramCreateWithBinaryTest, MultipleBuildCalls) { devices.begin(), devices.begin() + devices.size() / 2); auto second_subset = std::vector( devices.begin() + devices.size() / 2, devices.end()); - ASSERT_SUCCESS(urProgramBuildExp(binary_program, - static_cast(first_subset.size()), + ASSERT_SUCCESS(urProgramBuildExp(binary_program, first_subset.size(), first_subset.data(), nullptr)); auto kernelName = uur::KernelsEnvironment::instance->GetEntryPointNames("foo")[0]; uur::raii::Kernel kernel; ASSERT_SUCCESS( urKernelCreate(binary_program, kernelName.data(), kernel.ptr())); - ASSERT_SUCCESS(urProgramBuildExp( - binary_program, static_cast(second_subset.size()), - second_subset.data(), nullptr)); + ASSERT_SUCCESS(urProgramBuildExp(binary_program, second_subset.size(), + second_subset.data(), nullptr)); ASSERT_SUCCESS( urKernelCreate(binary_program, kernelName.data(), kernel.ptr())); // Building for the same subset of devices should not fail. - ASSERT_SUCCESS(urProgramBuildExp(binary_program, - static_cast(first_subset.size()), + ASSERT_SUCCESS(urProgramBuildExp(binary_program, first_subset.size(), first_subset.data(), nullptr)); } diff --git a/test/conformance/testing/include/uur/utils.h b/test/conformance/testing/include/uur/utils.h index dc2ade0310..8548b12d11 100644 --- a/test/conformance/testing/include/uur/utils.h +++ b/test/conformance/testing/include/uur/utils.h @@ -176,6 +176,8 @@ ur_result_t GetObjectReferenceCount(T object, uint32_t &out_ref_count) { object, UR_EXP_COMMAND_BUFFER_COMMAND_INFO_REFERENCE_COUNT, out_ref_count); } + + return UR_RESULT_ERROR_INVALID_VALUE; } inline std::string GetPlatformName(ur_platform_handle_t hPlatform) { diff --git a/test/conformance/usm/urUSMDeviceAlloc.cpp b/test/conformance/usm/urUSMDeviceAlloc.cpp index 8f3bc680ce..bfc48c2aa6 100644 --- a/test/conformance/usm/urUSMDeviceAlloc.cpp +++ b/test/conformance/usm/urUSMDeviceAlloc.cpp @@ -116,10 +116,9 @@ TEST_P(urUSMDeviceAllocTest, InvalidNullPtrResult) { TEST_P(urUSMDeviceAllocTest, InvalidUSMSize) { void *ptr = nullptr; - ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_USM_SIZE, - urUSMDeviceAlloc(context, device, nullptr, pool, - std::numeric_limits::max(), - &ptr)); + ASSERT_EQ_RESULT( + UR_RESULT_ERROR_INVALID_USM_SIZE, + urUSMDeviceAlloc(context, device, nullptr, pool, -1, &ptr)); } TEST_P(urUSMDeviceAllocTest, InvalidValueAlignPowerOfTwo) { diff --git a/test/conformance/usm/urUSMHostAlloc.cpp b/test/conformance/usm/urUSMHostAlloc.cpp index 8e24c2d6b5..f59af21897 100644 --- a/test/conformance/usm/urUSMHostAlloc.cpp +++ b/test/conformance/usm/urUSMHostAlloc.cpp @@ -5,7 +5,6 @@ #include "helpers.h" #include -#include #include struct urUSMHostAllocTest @@ -129,8 +128,7 @@ TEST_P(urUSMHostAllocTest, InvalidNullPtrMem) { TEST_P(urUSMHostAllocTest, InvalidUSMSize) { void *ptr = nullptr; ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_USM_SIZE, - urUSMHostAlloc(context, nullptr, pool, - std::numeric_limits::max(), &ptr)); + urUSMHostAlloc(context, nullptr, pool, -1, &ptr)); } TEST_P(urUSMHostAllocTest, InvalidValueAlignPowerOfTwo) { diff --git a/test/conformance/usm/urUSMSharedAlloc.cpp b/test/conformance/usm/urUSMSharedAlloc.cpp index f42e714fd5..e543602fbc 100644 --- a/test/conformance/usm/urUSMSharedAlloc.cpp +++ b/test/conformance/usm/urUSMSharedAlloc.cpp @@ -4,7 +4,6 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include "helpers.h" -#include #include struct urUSMSharedAllocTest @@ -146,10 +145,9 @@ TEST_P(urUSMSharedAllocTest, InvalidNullPtrMem) { TEST_P(urUSMSharedAllocTest, InvalidUSMSize) { void *ptr = nullptr; - ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_USM_SIZE, - urUSMSharedAlloc(context, device, nullptr, pool, - std::numeric_limits::max(), - &ptr)); + ASSERT_EQ_RESULT( + UR_RESULT_ERROR_INVALID_USM_SIZE, + urUSMSharedAlloc(context, device, nullptr, pool, -1, &ptr)); } TEST_P(urUSMSharedAllocTest, InvalidValueAlignPowerOfTwo) { diff --git a/test/layers/tracing/test_collector.cpp b/test/layers/tracing/test_collector.cpp index fa5a8bee4e..db0940ad14 100644 --- a/test/layers/tracing/test_collector.cpp +++ b/test/layers/tracing/test_collector.cpp @@ -19,14 +19,7 @@ #include #include "ur_api.h" - -#ifdef _MSC_VER -#pragma warning(disable : 4245) -#endif #include "xpti/xpti_trace_framework.h" -#ifdef _MSC_VER -#pragma warning(default : 4245) -#endif constexpr uint16_t TRACE_FN_BEGIN = static_cast(xpti::trace_point_type_t::function_with_args_begin); diff --git a/tools/urinfo/utils.hpp b/tools/urinfo/utils.hpp index c879d7fb56..d7819b2947 100644 --- a/tools/urinfo/utils.hpp +++ b/tools/urinfo/utils.hpp @@ -51,7 +51,7 @@ inline std::string getAdapterBackend(ur_adapter_handle_t adapter) { stripPrefix(adapterBackendStream.str(), "UR_ADAPTER_BACKEND_"); std::transform(adapterBackendStr.begin(), adapterBackendStr.end(), adapterBackendStr.begin(), - [](char c) { return static_cast(std::tolower(c)); }); + [](unsigned char c) { return std::tolower(c); }); return adapterBackendStr; } @@ -65,7 +65,7 @@ inline std::string getDeviceType(ur_device_handle_t device) { stripPrefix(deviceTypeStream.str(), "UR_DEVICE_TYPE_"); std::transform(deviceTypeStr.begin(), deviceTypeStr.end(), deviceTypeStr.begin(), - [](char c) { return static_cast(std::tolower(c)); }); + [](unsigned char c) { return std::tolower(c); }); return deviceTypeStr; } diff --git a/tools/urtrace/collector.cpp b/tools/urtrace/collector.cpp index ea40d63e06..eb8c18d164 100644 --- a/tools/urtrace/collector.cpp +++ b/tools/urtrace/collector.cpp @@ -30,14 +30,7 @@ #include "ur_api.h" #include "ur_print.hpp" #include "ur_util.hpp" - -#ifdef _MSC_VER -#pragma warning(disable : 4245) -#endif #include "xpti/xpti_trace_framework.h" -#ifdef _MSC_VER -#pragma warning(default : 4245) -#endif constexpr uint16_t TRACE_FN_BEGIN = static_cast(xpti::trace_point_type_t::function_with_args_begin); @@ -286,6 +279,7 @@ std::unique_ptr create_writer() { default: ur::unreachable(); } + return nullptr; } static std::unique_ptr &writer() {