Skip to content

Commit a13fc7e

Browse files
authored
Merge pull request #2100 from kbenzie/benie/windows-warning-level-4
Raise MSVC warning level from /W3 to /W4
2 parents 3fc9a70 + 4665b21 commit a13fc7e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+262
-214
lines changed

cmake/helpers.cmake

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,25 @@ function(add_ur_target_compile_options name)
9999
elseif(MSVC)
100100
target_compile_options(${name} PRIVATE
101101
$<$<CXX_COMPILER_ID:MSVC>:/MP> # clang-cl.exe does not support /MP
102-
/W3
102+
/W4
103+
/wd4456 # Disable: declaration of 'identifier' hides previous local declaration
104+
/wd4457 # Disable: declaration of 'identifier' hides function parameter
105+
/wd4458 # Disable: declaration of 'identifier' hides class member
106+
/wd4459 # Disable: declaration of 'identifier' hides global declaration
103107
/MD$<$<CONFIG:Debug>:d>
104108
/GS
105109
/DWIN32_LEAN_AND_MEAN
106110
/DNOMINMAX
107111
)
108112

109-
if(UR_DEVELOPER_MODE)
113+
target_compile_definitions(${name} PRIVATE
110114
# _CRT_SECURE_NO_WARNINGS used mainly because of getenv
111-
# C4267: The compiler detected a conversion from size_t to a smaller type.
115+
_CRT_SECURE_NO_WARNINGS
116+
)
117+
118+
if(UR_DEVELOPER_MODE)
112119
target_compile_options(${name} PRIVATE
113-
/WX /GS /D_CRT_SECURE_NO_WARNINGS /wd4267
120+
/WX /GS
114121
)
115122
endif()
116123
endif()

examples/collector/collector.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,14 @@
2525
#include <string_view>
2626

2727
#include "ur_api.h"
28+
29+
#ifdef _MSC_VER
30+
#pragma warning(disable : 4245)
31+
#endif
2832
#include "xpti/xpti_trace_framework.h"
33+
#ifdef _MSC_VER
34+
#pragma warning(default : 4245)
35+
#endif
2936

3037
constexpr uint16_t TRACE_FN_BEGIN =
3138
static_cast<uint16_t>(xpti::trace_point_type_t::function_with_args_begin);

include/ur_api.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ typedef struct ur_physical_mem_handle_t_ *ur_physical_mem_handle_t;
424424
///////////////////////////////////////////////////////////////////////////////
425425
#ifndef UR_BIT
426426
/// @brief Generic macro for enumerator bit masks
427-
#define UR_BIT(_i) (1 << _i)
427+
#define UR_BIT(_i) (1U << _i)
428428
#endif // UR_BIT
429429

430430
///////////////////////////////////////////////////////////////////////////////

scripts/core/common.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ name: "$x_physical_mem_handle_t"
134134
type: macro
135135
desc: "Generic macro for enumerator bit masks"
136136
name: "$X_BIT( _i )"
137-
value: "( 1 << _i )"
137+
value: "( 1U << _i )"
138138
--- #--------------------------------------------------------------------------
139139
type: enum
140140
desc: "Defines Return/Error codes"

source/adapters/cuda/CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,16 @@ if (UR_ENABLE_TRACING)
9797
get_target_property(XPTI_SRC_DIR xpti SOURCE_DIR)
9898
set(XPTI_PROXY_SRC "${XPTI_SRC_DIR}/xpti_proxy.cpp")
9999
endif()
100-
target_compile_definitions(${TARGET_NAME} PRIVATE
100+
add_library(cuda-xpti-proxy STATIC ${XPTI_PROXY_SRC})
101+
target_compile_definitions(cuda-xpti-proxy PRIVATE
101102
XPTI_ENABLE_INSTRUMENTATION
102103
XPTI_STATIC_LIBRARY
103104
)
104-
target_include_directories(${TARGET_NAME} PRIVATE
105+
target_include_directories(cuda-xpti-proxy PRIVATE
105106
${XPTI_INCLUDES}
106107
${CUDA_CUPTI_INCLUDE_DIR}
107108
)
108-
target_sources(${TARGET_NAME} PRIVATE ${XPTI_PROXY_SRC})
109+
target_link_libraries(${TARGET_NAME} PRIVATE cuda-xpti-proxy)
109110
endif()
110111

111112
if (CUDA_cupti_LIBRARY)

source/adapters/cuda/command_buffer.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ static ur_result_t enqueueCommandBufferFillHelper(
242242
if ((PatternSize == 1) || (PatternSize == 2) || (PatternSize == 4)) {
243243
CUDA_MEMSET_NODE_PARAMS NodeParams = {};
244244
NodeParams.dst = DstPtr;
245-
NodeParams.elementSize = PatternSize;
245+
NodeParams.elementSize = static_cast<unsigned int>(PatternSize);
246246
NodeParams.height = N;
247247
NodeParams.pitch = PatternSize;
248248
NodeParams.width = 1;
@@ -508,12 +508,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp(
508508
auto &ArgIndices = hKernel->getArgIndices();
509509
CUDA_KERNEL_NODE_PARAMS NodeParams = {};
510510
NodeParams.func = CuFunc;
511-
NodeParams.gridDimX = BlocksPerGrid[0];
512-
NodeParams.gridDimY = BlocksPerGrid[1];
513-
NodeParams.gridDimZ = BlocksPerGrid[2];
514-
NodeParams.blockDimX = ThreadsPerBlock[0];
515-
NodeParams.blockDimY = ThreadsPerBlock[1];
516-
NodeParams.blockDimZ = ThreadsPerBlock[2];
511+
NodeParams.gridDimX = static_cast<unsigned int>(BlocksPerGrid[0]);
512+
NodeParams.gridDimY = static_cast<unsigned int>(BlocksPerGrid[1]);
513+
NodeParams.gridDimZ = static_cast<unsigned int>(BlocksPerGrid[2]);
514+
NodeParams.blockDimX = static_cast<unsigned int>(ThreadsPerBlock[0]);
515+
NodeParams.blockDimY = static_cast<unsigned int>(ThreadsPerBlock[1]);
516+
NodeParams.blockDimZ = static_cast<unsigned int>(ThreadsPerBlock[2]);
517517
NodeParams.sharedMemBytes = LocalSize;
518518
NodeParams.kernelParams = const_cast<void **>(ArgIndices.data());
519519

@@ -1397,12 +1397,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferUpdateKernelLaunchExp(
13971397
CUDA_KERNEL_NODE_PARAMS &Params = KernelCommandHandle->Params;
13981398

13991399
Params.func = CuFunc;
1400-
Params.gridDimX = BlocksPerGrid[0];
1401-
Params.gridDimY = BlocksPerGrid[1];
1402-
Params.gridDimZ = BlocksPerGrid[2];
1403-
Params.blockDimX = ThreadsPerBlock[0];
1404-
Params.blockDimY = ThreadsPerBlock[1];
1405-
Params.blockDimZ = ThreadsPerBlock[2];
1400+
Params.gridDimX = static_cast<unsigned int>(BlocksPerGrid[0]);
1401+
Params.gridDimY = static_cast<unsigned int>(BlocksPerGrid[1]);
1402+
Params.gridDimZ = static_cast<unsigned int>(BlocksPerGrid[2]);
1403+
Params.blockDimX = static_cast<unsigned int>(ThreadsPerBlock[0]);
1404+
Params.blockDimY = static_cast<unsigned int>(ThreadsPerBlock[1]);
1405+
Params.blockDimZ = static_cast<unsigned int>(ThreadsPerBlock[2]);
14061406
Params.sharedMemBytes = KernelCommandHandle->Kernel->getLocalSize();
14071407
Params.kernelParams =
14081408
const_cast<void **>(KernelCommandHandle->Kernel->getArgIndices().data());

source/adapters/cuda/device.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,7 +1152,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGet(ur_platform_handle_t hPlatform,
11521152

11531153
try {
11541154
if (pNumDevices) {
1155-
*pNumDevices = NumDevices;
1155+
*pNumDevices = static_cast<uint32_t>(NumDevices);
11561156
}
11571157

11581158
if (ReturnDevices && phDevices) {
@@ -1235,7 +1235,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceCreateWithNativeHandle(
12351235
ur_result_t UR_APICALL urDeviceGetGlobalTimestamps(ur_device_handle_t hDevice,
12361236
uint64_t *pDeviceTimestamp,
12371237
uint64_t *pHostTimestamp) {
1238-
CUevent Event;
1238+
CUevent Event{};
12391239
ScopedContext Active(hDevice);
12401240

12411241
if (pDeviceTimestamp) {

source/adapters/cuda/enqueue.cpp

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ void guessLocalWorkSize(ur_device_handle_t Device, size_t *ThreadsPerBlock,
160160
int MinGrid, MaxBlockSize;
161161
UR_CHECK_ERROR(cuOccupancyMaxPotentialBlockSize(
162162
&MinGrid, &MaxBlockSize, Kernel->get(), NULL, Kernel->getLocalSize(),
163-
MaxBlockDim[0]));
163+
static_cast<int>(MaxBlockDim[0])));
164164

165165
roundToHighestFactorOfGlobalSizeIn3d(ThreadsPerBlock, GlobalSizeNormalized,
166166
MaxBlockDim, MaxBlockSize);
@@ -208,7 +208,7 @@ setKernelParams([[maybe_unused]] const ur_context_handle_t Context,
208208
MaxWorkGroupSize = Device->getMaxWorkGroupSize();
209209

210210
if (ProvidedLocalWorkGroupSize) {
211-
auto IsValid = [&](int Dim) {
211+
auto IsValid = [&](size_t Dim) {
212212
if (ReqdThreadsPerBlock[Dim] != 0 &&
213213
LocalWorkSize[Dim] != ReqdThreadsPerBlock[Dim])
214214
return UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE;
@@ -217,7 +217,8 @@ setKernelParams([[maybe_unused]] const ur_context_handle_t Context,
217217
LocalWorkSize[Dim] > MaxThreadsPerBlock[Dim])
218218
return UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE;
219219

220-
if (LocalWorkSize[Dim] > Device->getMaxWorkItemSizes(Dim))
220+
if (LocalWorkSize[Dim] >
221+
Device->getMaxWorkItemSizes(static_cast<int>(Dim)))
221222
return UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE;
222223
// Checks that local work sizes are a divisor of the global work sizes
223224
// which includes that the local work sizes are neither larger than
@@ -481,9 +482,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunch(
481482

482483
auto &ArgIndices = hKernel->getArgIndices();
483484
UR_CHECK_ERROR(cuLaunchKernel(
484-
CuFunc, BlocksPerGrid[0], BlocksPerGrid[1], BlocksPerGrid[2],
485-
ThreadsPerBlock[0], ThreadsPerBlock[1], ThreadsPerBlock[2], LocalSize,
486-
CuStream, const_cast<void **>(ArgIndices.data()), nullptr));
485+
CuFunc, static_cast<unsigned int>(BlocksPerGrid[0]),
486+
static_cast<unsigned int>(BlocksPerGrid[1]),
487+
static_cast<unsigned int>(BlocksPerGrid[2]),
488+
static_cast<unsigned int>(ThreadsPerBlock[0]),
489+
static_cast<unsigned int>(ThreadsPerBlock[1]),
490+
static_cast<unsigned int>(ThreadsPerBlock[2]), LocalSize, CuStream,
491+
const_cast<void **>(ArgIndices.data()), nullptr));
487492

488493
if (LocalSize != 0)
489494
hKernel->clearLocalSize();
@@ -649,12 +654,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunchCustomExp(
649654
auto &ArgIndices = hKernel->getArgIndices();
650655

651656
CUlaunchConfig launch_config;
652-
launch_config.gridDimX = BlocksPerGrid[0];
653-
launch_config.gridDimY = BlocksPerGrid[1];
654-
launch_config.gridDimZ = BlocksPerGrid[2];
655-
launch_config.blockDimX = ThreadsPerBlock[0];
656-
launch_config.blockDimY = ThreadsPerBlock[1];
657-
launch_config.blockDimZ = ThreadsPerBlock[2];
657+
launch_config.gridDimX = static_cast<unsigned int>(BlocksPerGrid[0]);
658+
launch_config.gridDimY = static_cast<unsigned int>(BlocksPerGrid[1]);
659+
launch_config.gridDimZ = static_cast<unsigned int>(BlocksPerGrid[2]);
660+
launch_config.blockDimX = static_cast<unsigned int>(ThreadsPerBlock[0]);
661+
launch_config.blockDimY = static_cast<unsigned int>(ThreadsPerBlock[1]);
662+
launch_config.blockDimZ = static_cast<unsigned int>(ThreadsPerBlock[2]);
658663

659664
launch_config.sharedMemBytes = LocalSize;
660665
launch_config.hStream = CuStream;
@@ -979,8 +984,9 @@ ur_result_t commonMemSetLargePattern(CUstream Stream, uint32_t PatternSize,
979984
auto OffsetPtr = Ptr + (step * sizeof(uint8_t));
980985

981986
// set all of the pattern chunks
982-
UR_CHECK_ERROR(cuMemsetD2D8Async(OffsetPtr, Pitch, Value, sizeof(uint8_t),
983-
Height, Stream));
987+
UR_CHECK_ERROR(cuMemsetD2D8Async(OffsetPtr, Pitch,
988+
static_cast<unsigned char>(Value),
989+
sizeof(uint8_t), Height, Stream));
984990
}
985991
return UR_RESULT_SUCCESS;
986992
}
@@ -1031,8 +1037,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferFill(
10311037
break;
10321038
}
10331039
default: {
1034-
UR_CHECK_ERROR(commonMemSetLargePattern(Stream, patternSize, size,
1035-
pPattern, DstDevice));
1040+
UR_CHECK_ERROR(
1041+
commonMemSetLargePattern(Stream, static_cast<uint32_t>(patternSize),
1042+
size, pPattern, DstDevice));
10361043
break;
10371044
}
10381045
}
@@ -1064,7 +1071,6 @@ static size_t imageElementByteSize(CUDA_ARRAY_DESCRIPTOR ArrayDesc) {
10641071
return 4;
10651072
default:
10661073
detail::ur::die("Invalid image format.");
1067-
return 0;
10681074
}
10691075
}
10701076

@@ -1168,7 +1174,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageRead(
11681174
CUDA_ARRAY_DESCRIPTOR ArrayDesc;
11691175
UR_CHECK_ERROR(cuArrayGetDescriptor(&ArrayDesc, Array));
11701176

1171-
int ElementByteSize = imageElementByteSize(ArrayDesc);
1177+
int ElementByteSize = static_cast<int>(imageElementByteSize(ArrayDesc));
11721178

11731179
size_t ByteOffsetX = origin.x * ElementByteSize * ArrayDesc.NumChannels;
11741180
size_t BytesToCopy = ElementByteSize * ArrayDesc.NumChannels * region.width;
@@ -1241,7 +1247,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageWrite(
12411247
CUDA_ARRAY_DESCRIPTOR ArrayDesc;
12421248
UR_CHECK_ERROR(cuArrayGetDescriptor(&ArrayDesc, Array));
12431249

1244-
int ElementByteSize = imageElementByteSize(ArrayDesc);
1250+
int ElementByteSize = static_cast<int>(imageElementByteSize(ArrayDesc));
12451251

12461252
size_t ByteOffsetX = origin.x * ElementByteSize * ArrayDesc.NumChannels;
12471253
size_t BytesToCopy = ElementByteSize * ArrayDesc.NumChannels * region.width;
@@ -1320,7 +1326,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageCopy(
13201326
UR_ASSERT(SrcArrayDesc.NumChannels == DstArrayDesc.NumChannels,
13211327
UR_RESULT_ERROR_INVALID_MEM_OBJECT);
13221328

1323-
int ElementByteSize = imageElementByteSize(SrcArrayDesc);
1329+
int ElementByteSize = static_cast<int>(imageElementByteSize(SrcArrayDesc));
13241330

13251331
size_t DstByteOffsetX =
13261332
dstOrigin.x * ElementByteSize * SrcArrayDesc.NumChannels;
@@ -1505,8 +1511,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMFill(
15051511
CuStream));
15061512
break;
15071513
default:
1508-
commonMemSetLargePattern(CuStream, patternSize, size, pPattern,
1509-
(CUdeviceptr)ptr);
1514+
commonMemSetLargePattern(CuStream, static_cast<uint32_t>(patternSize),
1515+
size, pPattern, (CUdeviceptr)ptr);
15101516
break;
15111517
}
15121518
if (phEvent) {

source/adapters/cuda/image.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urUSMPitchedAllocExp(
284284
ur_result_t Result = UR_RESULT_SUCCESS;
285285
try {
286286
ScopedContext Active(hDevice);
287-
UR_CHECK_ERROR(cuMemAllocPitch((CUdeviceptr *)ppMem, pResultPitch,
288-
widthInBytes, height, elementSizeBytes));
287+
UR_CHECK_ERROR(
288+
cuMemAllocPitch((CUdeviceptr *)ppMem, pResultPitch, widthInBytes,
289+
height, static_cast<unsigned int>(elementSizeBytes)));
289290
} catch (ur_result_t error) {
290291
Result = error;
291292
} catch (...) {

source/adapters/cuda/kernel.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
203203

204204
int MaxNumActiveGroupsPerCU{0};
205205
UR_CHECK_ERROR(cuOccupancyMaxActiveBlocksPerMultiprocessor(
206-
&MaxNumActiveGroupsPerCU, hKernel->get(), localWorkSize,
207-
dynamicSharedMemorySize));
206+
&MaxNumActiveGroupsPerCU, hKernel->get(),
207+
static_cast<int>(localWorkSize), dynamicSharedMemorySize));
208208
detail::ur::assertion(MaxNumActiveGroupsPerCU >= 0);
209209
// Handle the case where we can't have all SMs active with at least 1 group
210210
// per SM. In that case, the device is still able to run 1 work-group, hence

source/adapters/cuda/kernel.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ struct ur_kernel_handle_t_ {
9797
}
9898
ParamSizes[Index] = Size;
9999
// calculate the insertion point on the array
100-
size_t InsertPos = std::accumulate(std::begin(ParamSizes),
101-
std::begin(ParamSizes) + Index, 0);
100+
size_t InsertPos = std::accumulate(
101+
std::begin(ParamSizes), std::begin(ParamSizes) + Index, size_t{0});
102102
// Update the stored value for the argument
103103
std::memcpy(&Storage[InsertPos], Arg, Size);
104104
Indices[Index] = &Storage[InsertPos];
@@ -152,8 +152,8 @@ struct ur_kernel_handle_t_ {
152152
const args_index_t &getIndices() const noexcept { return Indices; }
153153

154154
uint32_t getLocalSize() const {
155-
return std::accumulate(std::begin(OffsetPerIndex),
156-
std::end(OffsetPerIndex), 0);
155+
return static_cast<uint32_t>(std::accumulate(
156+
std::begin(OffsetPerIndex), std::end(OffsetPerIndex), size_t{0}));
157157
}
158158
} Args;
159159

source/adapters/cuda/program.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ ur_result_t ur_program_handle_t_::buildProgram(const char *BuildOptions) {
148148
}
149149

150150
UR_CHECK_ERROR(cuModuleLoadDataEx(&Module, static_cast<const void *>(Binary),
151-
Options.size(), Options.data(),
152-
OptionVals.data()));
151+
static_cast<unsigned int>(Options.size()),
152+
Options.data(), OptionVals.data()));
153153

154154
BuildStatus = UR_PROGRAM_BUILD_STATUS_SUCCESS;
155155

source/adapters/cuda/usm.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ umf_result_t USMMemoryProvider::initialize(ur_context_handle_t Ctx,
325325

326326
enum umf_result_t USMMemoryProvider::alloc(size_t Size, size_t Align,
327327
void **Ptr) {
328-
auto Res = allocateImpl(Ptr, Size, Align);
328+
auto Res = allocateImpl(Ptr, Size, static_cast<uint32_t>(Align));
329329
if (Res != UR_RESULT_SUCCESS) {
330330
getLastStatusRef() = Res;
331331
return UMF_RESULT_ERROR_MEMORY_PROVIDER_SPECIFIC;

source/adapters/level_zero/CMakeLists.txt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,19 @@ if(UR_BUILD_ADAPTER_L0)
8989
endif()
9090

9191
# TODO: fix level_zero adapter conversion warnings
92+
# C4267: The compiler detected a conversion from size_t to a smaller type.
9293
target_compile_options(ur_adapter_level_zero PRIVATE
93-
$<$<CXX_COMPILER_ID:MSVC>:/wd4805 /wd4244>
94+
$<$<CXX_COMPILER_ID:MSVC>:/wd4805 /wd4244 /wd4267>
9495
)
9596

9697
set_target_properties(ur_adapter_level_zero PROPERTIES
9798
VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}"
9899
SOVERSION "${PROJECT_VERSION_MAJOR}"
99100
)
100101

101-
if (WIN32)
102-
# 0x800: Search for the DLL only in the System32 folder
103-
target_link_options(ur_adapter_level_zero PRIVATE /DEPENDENTLOADFLAG:0x800)
102+
if(CMAKE_CXX_COMPILER_LINKER_ID MATCHES MSVC)
103+
# 0x800: Search for the DLL only in the System32 folder
104+
target_link_options(ur_adapter_level_zero PRIVATE LINKER:/DEPENDENTLOADFLAG:0x800)
104105
endif()
105106

106107
target_link_libraries(ur_adapter_level_zero PRIVATE
@@ -183,18 +184,19 @@ if(UR_BUILD_ADAPTER_L0_V2)
183184
target_compile_definitions(ur_adapter_level_zero_v2 PUBLIC UR_ADAPTER_LEVEL_ZERO_V2)
184185

185186
# TODO: fix level_zero adapter conversion warnings
187+
# C4267: The compiler detected a conversion from size_t to a smaller type.
186188
target_compile_options(ur_adapter_level_zero_v2 PRIVATE
187-
$<$<CXX_COMPILER_ID:MSVC>:/wd4805 /wd4244>
189+
$<$<CXX_COMPILER_ID:MSVC>:/wd4805 /wd4244 /wd4100 /wd4267>
188190
)
189191

190192
set_target_properties(ur_adapter_level_zero_v2 PROPERTIES
191193
VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}"
192194
SOVERSION "${PROJECT_VERSION_MAJOR}"
193195
)
194196

195-
if (WIN32)
196-
# 0x800: Search for the DLL only in the System32 folder
197-
target_link_options(ur_adapter_level_zero_v2 PUBLIC /DEPENDENTLOADFLAG:0x800)
197+
if(CMAKE_CXX_COMPILER_LINKER_ID MATCHES MSVC)
198+
# 0x800: Search for the DLL only in the System32 folder
199+
target_link_options(ur_adapter_level_zero_v2 PUBLIC LINKER:/DEPENDENTLOADFLAG:0x800)
198200
endif()
199201

200202
target_link_libraries(ur_adapter_level_zero_v2 PRIVATE

0 commit comments

Comments
 (0)