Skip to content

Commit 80087c8

Browse files
[SYCL][NFC] Prepare for -Wconversion [1/N] (#19400)
`-Wconversion` is required per our SDL processes and it will be enabled in #19306. Updated all literal arguments passed to UR APIs, because corresponding functions expect an unsigned integer.
1 parent 81f584b commit 80087c8

15 files changed

+46
-45
lines changed

sycl/source/backend.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ make_kernel_bundle(ur_native_handle_t NativeHandle,
231231
case (UR_PROGRAM_BINARY_TYPE_NONE):
232232
if (State == bundle_state::object) {
233233
auto Res = Adapter.call_nocheck<UrApiKind::urProgramCompileExp>(
234-
UrProgram, 1, &Dev, nullptr);
234+
UrProgram, 1u, &Dev, nullptr);
235235
if (Res == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
236236
Res = Adapter.call_nocheck<UrApiKind::urProgramCompile>(
237237
ContextImpl.getHandleRef(), UrProgram, nullptr);
@@ -241,7 +241,7 @@ make_kernel_bundle(ur_native_handle_t NativeHandle,
241241

242242
else if (State == bundle_state::executable) {
243243
auto Res = Adapter.call_nocheck<UrApiKind::urProgramBuildExp>(
244-
UrProgram, 1, &Dev, nullptr);
244+
UrProgram, 1u, &Dev, nullptr);
245245
if (Res == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
246246
Res = Adapter.call_nocheck<UrApiKind::urProgramBuild>(
247247
ContextImpl.getHandleRef(), UrProgram, nullptr);
@@ -260,11 +260,11 @@ make_kernel_bundle(ur_native_handle_t NativeHandle,
260260
if (State == bundle_state::executable) {
261261
ur_program_handle_t UrLinkedProgram = nullptr;
262262
auto Res = Adapter.call_nocheck<UrApiKind::urProgramLinkExp>(
263-
ContextImpl.getHandleRef(), 1, &Dev, 1, &UrProgram, nullptr,
263+
ContextImpl.getHandleRef(), 1u, &Dev, 1u, &UrProgram, nullptr,
264264
&UrLinkedProgram);
265265
if (Res == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
266266
Res = Adapter.call_nocheck<UrApiKind::urProgramLink>(
267-
ContextImpl.getHandleRef(), 1, &UrProgram, nullptr,
267+
ContextImpl.getHandleRef(), 1u, &UrProgram, nullptr,
268268
&UrLinkedProgram);
269269
}
270270
Adapter.checkUrResult<errc::build>(Res);

sycl/source/context.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ context::context(cl_context ClContext, async_handler AsyncHandler) {
7979
ur_native_handle_t nativeHandle =
8080
reinterpret_cast<ur_native_handle_t>(ClContext);
8181
Adapter.call<detail::UrApiKind::urContextCreateWithNativeHandle>(
82-
nativeHandle, Adapter.getUrAdapter(), 0, nullptr, nullptr, &hContext);
82+
nativeHandle, Adapter.getUrAdapter(), 0u, nullptr, nullptr, &hContext);
8383

8484
impl = detail::context_impl::create(hContext, AsyncHandler, Adapter);
8585
}

sycl/source/detail/adapter_impl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class adapter_impl {
9595
std::vector<ur_platform_handle_t> &getUrPlatforms() {
9696
std::call_once(PlatformsPopulated, [&]() {
9797
uint32_t platformCount = 0;
98-
call<UrApiKind::urPlatformGet>(MAdapter, 0, nullptr, &platformCount);
98+
call<UrApiKind::urPlatformGet>(MAdapter, 0u, nullptr, &platformCount);
9999
UrPlatforms.resize(platformCount);
100100
if (platformCount) {
101101
call<UrApiKind::urPlatformGet>(MAdapter, platformCount,

sycl/source/detail/context_impl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,8 @@ std::vector<ur_event_handle_t> context_impl::initializeDeviceGlobals(
440440
void *const &USMPtr = DeviceGlobalUSM.getPtr();
441441
Adapter.call<UrApiKind::urEnqueueDeviceGlobalVariableWrite>(
442442
QueueImpl.getHandleRef(), NativePrg,
443-
DeviceGlobalEntry->MUniqueId.c_str(), false, sizeof(void *), 0,
444-
&USMPtr, 0, nullptr, &InitEvent);
443+
DeviceGlobalEntry->MUniqueId.c_str(), false, sizeof(void *), 0u,
444+
&USMPtr, 0u, nullptr, &InitEvent);
445445

446446
InitEventsRef.push_back(InitEvent);
447447
}

sycl/source/detail/device_image_impl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,7 @@ class device_image_impl
12591259
// Get the kernel names.
12601260
size_t KernelNamesSize;
12611261
Adapter.call<UrApiKind::urProgramGetInfo>(
1262-
UrProgram, UR_PROGRAM_INFO_KERNEL_NAMES, 0, nullptr, &KernelNamesSize);
1262+
UrProgram, UR_PROGRAM_INFO_KERNEL_NAMES, 0u, nullptr, &KernelNamesSize);
12631263

12641264
// semi-colon delimited list of kernel names.
12651265
std::string KernelNamesStr(KernelNamesSize, ' ');

sycl/source/detail/device_impl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ std::vector<device> device_impl::create_sub_devices(
271271
uint32_t SubDevicesCount = 0;
272272
adapter_impl &Adapter = getAdapter();
273273
Adapter.call<sycl::errc::invalid, UrApiKind::urDevicePartition>(
274-
MDevice, &Properties, 0, nullptr, &SubDevicesCount);
274+
MDevice, &Properties, 0u, nullptr, &SubDevicesCount);
275275

276276
return create_sub_devices(&Properties, SubDevicesCount);
277277
}
@@ -295,7 +295,7 @@ std::vector<device> device_impl::create_sub_devices() const {
295295

296296
uint32_t SubDevicesCount = 0;
297297
adapter_impl &Adapter = getAdapter();
298-
Adapter.call<UrApiKind::urDevicePartition>(MDevice, &Properties, 0, nullptr,
298+
Adapter.call<UrApiKind::urDevicePartition>(MDevice, &Properties, 0u, nullptr,
299299
&SubDevicesCount);
300300

301301
return create_sub_devices(&Properties, SubDevicesCount);

sycl/source/detail/device_impl.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class device_impl : public std::enable_shared_from_this<device_impl> {
115115
bool has_info_desc(ur_device_info_t Desc) const {
116116
size_t return_size = 0;
117117
return getAdapter().call_nocheck<UrApiKind::urDeviceGetInfo>(
118-
MDevice, Desc, 0, nullptr, &return_size) == UR_RESULT_SUCCESS;
118+
MDevice, Desc, 0u, nullptr, &return_size) == UR_RESULT_SUCCESS;
119119
}
120120

121121
// This should really be
@@ -154,7 +154,7 @@ class device_impl : public std::enable_shared_from_this<device_impl> {
154154
!check_type_in_v<typename ur_ret_t::value_type, bool, std::string>);
155155
size_t ResultSize = 0;
156156
ur_result_t Error = getAdapter().call_nocheck<UrApiKind::urDeviceGetInfo>(
157-
getHandleRef(), Desc, 0, nullptr, &ResultSize);
157+
getHandleRef(), Desc, 0u, nullptr, &ResultSize);
158158
if (Error != UR_RESULT_SUCCESS)
159159
return {Error};
160160
if (ResultSize == 0)
@@ -187,7 +187,7 @@ class device_impl : public std::enable_shared_from_this<device_impl> {
187187
return urGetInfoString<UrApiKind::urDeviceGetInfo>(*this, Desc);
188188
} else if constexpr (is_std_vector_v<ur_ret_t>) {
189189
size_t ResultSize = 0;
190-
getAdapter().call<UrApiKind::urDeviceGetInfo>(getHandleRef(), Desc, 0,
190+
getAdapter().call<UrApiKind::urDeviceGetInfo>(getHandleRef(), Desc, 0u,
191191
nullptr, &ResultSize);
192192
if (ResultSize == 0)
193193
return ur_ret_t{};

sycl/source/detail/event_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ ur_native_handle_t event_impl::getNative() {
524524
ur_event_native_properties_t NativeProperties{};
525525
ur_event_handle_t UREvent = nullptr;
526526
Adapter.call<UrApiKind::urEventCreateWithNativeHandle>(
527-
0, TempContext, &NativeProperties, &UREvent);
527+
0u, TempContext, &NativeProperties, &UREvent);
528528
this->setHandle(UREvent);
529529
Handle = UREvent;
530530
}

sycl/source/detail/kernel_info.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ get_kernel_info(ur_kernel_handle_t Kernel, adapter_impl &Adapter) {
5151
size_t ResultSize = 0;
5252

5353
// TODO catch an exception and put it to list of asynchronous exceptions
54-
Adapter.call<UrApiKind::urKernelGetInfo>(Kernel, UrInfoCode<Param>::value, 0,
54+
Adapter.call<UrApiKind::urKernelGetInfo>(Kernel, UrInfoCode<Param>::value, 0u,
5555
nullptr, &ResultSize);
5656
if (ResultSize == 0) {
5757
return "";
@@ -176,7 +176,7 @@ get_kernel_device_specific_info<
176176

177177
// First call to get the number of device images
178178
Adapter.call<UrApiKind::urKernelGetInfo>(
179-
Kernel, UR_KERNEL_INFO_SPILL_MEM_SIZE, 0, nullptr, &ResultSize);
179+
Kernel, UR_KERNEL_INFO_SPILL_MEM_SIZE, 0u, nullptr, &ResultSize);
180180

181181
size_t DeviceCount = ResultSize / sizeof(uint32_t);
182182

@@ -192,8 +192,8 @@ get_kernel_device_specific_info<
192192
&Program, nullptr);
193193
// Retrieve the associated device list
194194
size_t URDevicesSize = 0;
195-
Adapter.call<UrApiKind::urProgramGetInfo>(Program, UR_PROGRAM_INFO_DEVICES, 0,
196-
nullptr, &URDevicesSize);
195+
Adapter.call<UrApiKind::urProgramGetInfo>(Program, UR_PROGRAM_INFO_DEVICES,
196+
0u, nullptr, &URDevicesSize);
197197

198198
std::vector<ur_device_handle_t> URDevices(URDevicesSize /
199199
sizeof(ur_device_handle_t));

sycl/source/detail/memory_manager.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ void MemoryManager::prefetch_usm(void *Mem, queue_impl &Queue, size_t Length,
927927
ur_event_handle_t *OutEvent) {
928928
adapter_impl &Adapter = Queue.getAdapter();
929929
Adapter.call<UrApiKind::urEnqueueUSMPrefetch>(Queue.getHandleRef(), Mem,
930-
Length, 0, DepEvents.size(),
930+
Length, 0u, DepEvents.size(),
931931
DepEvents.data(), OutEvent);
932932
}
933933

@@ -1263,7 +1263,7 @@ void MemoryManager::ext_oneapi_copyD2D_cmd_buffer(
12631263
Adapter.call<UrApiKind::urCommandBufferAppendMemBufferCopyExp>(
12641264
CommandBuffer, sycl::detail::ur::cast<ur_mem_handle_t>(SrcMem),
12651265
sycl::detail::ur::cast<ur_mem_handle_t>(DstMem), SrcXOffBytes,
1266-
DstXOffBytes, SrcAccessRangeWidthBytes, Deps.size(), Deps.data(), 0,
1266+
DstXOffBytes, SrcAccessRangeWidthBytes, Deps.size(), Deps.data(), 0u,
12671267
nullptr, OutSyncPoint, nullptr, nullptr);
12681268
} else {
12691269
// passing 0 for pitches not allowed. Because clEnqueueCopyBufferRect will
@@ -1290,7 +1290,7 @@ void MemoryManager::ext_oneapi_copyD2D_cmd_buffer(
12901290
CommandBuffer, sycl::detail::ur::cast<ur_mem_handle_t>(SrcMem),
12911291
sycl::detail::ur::cast<ur_mem_handle_t>(DstMem), SrcOrigin, DstOrigin,
12921292
Region, SrcRowPitch, SrcSlicePitch, DstRowPitch, DstSlicePitch,
1293-
Deps.size(), Deps.data(), 0, nullptr, OutSyncPoint, nullptr, nullptr);
1293+
Deps.size(), Deps.data(), 0u, nullptr, OutSyncPoint, nullptr, nullptr);
12941294
}
12951295
}
12961296

@@ -1328,7 +1328,7 @@ void MemoryManager::ext_oneapi_copyD2H_cmd_buffer(
13281328
Adapter.call_nocheck<UrApiKind::urCommandBufferAppendMemBufferReadExp>(
13291329
CommandBuffer, sycl::detail::ur::cast<ur_mem_handle_t>(SrcMem),
13301330
SrcXOffBytes, SrcAccessRangeWidthBytes, DstMem + DstXOffBytes,
1331-
Deps.size(), Deps.data(), 0, nullptr, OutSyncPoint, nullptr,
1331+
Deps.size(), Deps.data(), 0u, nullptr, OutSyncPoint, nullptr,
13321332
nullptr);
13331333

13341334
if (Result == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
@@ -1360,7 +1360,7 @@ void MemoryManager::ext_oneapi_copyD2H_cmd_buffer(
13601360
CommandBuffer, sycl::detail::ur::cast<ur_mem_handle_t>(SrcMem),
13611361
BufferOffset, HostOffset, RectRegion, BufferRowPitch,
13621362
BufferSlicePitch, HostRowPitch, HostSlicePitch, DstMem,
1363-
Deps.size(), Deps.data(), 0, nullptr, OutSyncPoint, nullptr,
1363+
Deps.size(), Deps.data(), 0u, nullptr, OutSyncPoint, nullptr,
13641364
nullptr);
13651365
if (Result == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
13661366
throw sycl::exception(
@@ -1406,7 +1406,7 @@ void MemoryManager::ext_oneapi_copyH2D_cmd_buffer(
14061406
Adapter.call_nocheck<UrApiKind::urCommandBufferAppendMemBufferWriteExp>(
14071407
CommandBuffer, sycl::detail::ur::cast<ur_mem_handle_t>(DstMem),
14081408
DstXOffBytes, DstAccessRangeWidthBytes, SrcMem + SrcXOffBytes,
1409-
Deps.size(), Deps.data(), 0, nullptr, OutSyncPoint, nullptr,
1409+
Deps.size(), Deps.data(), 0u, nullptr, OutSyncPoint, nullptr,
14101410
nullptr);
14111411

14121412
if (Result == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
@@ -1436,7 +1436,7 @@ void MemoryManager::ext_oneapi_copyH2D_cmd_buffer(
14361436
UrApiKind::urCommandBufferAppendMemBufferWriteRectExp>(
14371437
CommandBuffer, sycl::detail::ur::cast<ur_mem_handle_t>(DstMem),
14381438
BufferOffset, HostOffset, RectRegion, BufferRowPitch, BufferSlicePitch,
1439-
HostRowPitch, HostSlicePitch, SrcMem, Deps.size(), Deps.data(), 0,
1439+
HostRowPitch, HostSlicePitch, SrcMem, Deps.size(), Deps.data(), 0u,
14401440
nullptr, OutSyncPoint, nullptr, nullptr);
14411441

14421442
if (Result == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
@@ -1461,7 +1461,7 @@ void MemoryManager::ext_oneapi_copy_usm_cmd_buffer(
14611461
adapter_impl &Adapter = Context->getAdapter();
14621462
ur_result_t Result =
14631463
Adapter.call_nocheck<UrApiKind::urCommandBufferAppendUSMMemcpyExp>(
1464-
CommandBuffer, DstMem, SrcMem, Len, Deps.size(), Deps.data(), 0,
1464+
CommandBuffer, DstMem, SrcMem, Len, Deps.size(), Deps.data(), 0u,
14651465
nullptr, OutSyncPoint, nullptr, nullptr);
14661466
if (Result == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
14671467
throw sycl::exception(
@@ -1487,7 +1487,8 @@ void MemoryManager::ext_oneapi_fill_usm_cmd_buffer(
14871487
ur_result_t Result =
14881488
Adapter.call_nocheck<UrApiKind::urCommandBufferAppendUSMFillExp>(
14891489
CommandBuffer, DstMem, Pattern.data(), Pattern.size(), Len,
1490-
Deps.size(), Deps.data(), 0, nullptr, OutSyncPoint, nullptr, nullptr);
1490+
Deps.size(), Deps.data(), 0u, nullptr, OutSyncPoint, nullptr,
1491+
nullptr);
14911492
if (Result == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
14921493
throw sycl::exception(
14931494
sycl::make_error_code(sycl::errc::feature_not_supported),
@@ -1525,7 +1526,7 @@ void MemoryManager::ext_oneapi_fill_cmd_buffer(
15251526
Adapter.call<UrApiKind::urCommandBufferAppendMemBufferFillExp>(
15261527
CommandBuffer, ur::cast<ur_mem_handle_t>(Mem), Pattern, PatternSize,
15271528
AccessOffset[0] * ElementSize, RangeMultiplier * ElementSize,
1528-
Deps.size(), Deps.data(), 0, nullptr, OutSyncPoint, nullptr, nullptr);
1529+
Deps.size(), Deps.data(), 0u, nullptr, OutSyncPoint, nullptr, nullptr);
15291530
return;
15301531
}
15311532
// The sycl::handler uses a parallel_for kernel in the case of unusable
@@ -1542,7 +1543,7 @@ void MemoryManager::ext_oneapi_prefetch_usm_cmd_buffer(
15421543
adapter_impl &Adapter = Context->getAdapter();
15431544
Adapter.call<UrApiKind::urCommandBufferAppendUSMPrefetchExp>(
15441545
CommandBuffer, Mem, Length, ur_usm_migration_flags_t(0), Deps.size(),
1545-
Deps.data(), 0, nullptr, OutSyncPoint, nullptr, nullptr);
1546+
Deps.data(), 0u, nullptr, OutSyncPoint, nullptr, nullptr);
15461547
}
15471548

15481549
void MemoryManager::ext_oneapi_advise_usm_cmd_buffer(
@@ -1553,7 +1554,7 @@ void MemoryManager::ext_oneapi_advise_usm_cmd_buffer(
15531554
ur_exp_command_buffer_sync_point_t *OutSyncPoint) {
15541555
adapter_impl &Adapter = Context->getAdapter();
15551556
Adapter.call<UrApiKind::urCommandBufferAppendUSMAdviseExp>(
1556-
CommandBuffer, Mem, Length, Advice, Deps.size(), Deps.data(), 0, nullptr,
1557+
CommandBuffer, Mem, Length, Advice, Deps.size(), Deps.data(), 0u, nullptr,
15571558
OutSyncPoint, nullptr, nullptr);
15581559
}
15591560

0 commit comments

Comments
 (0)