Skip to content

Commit 82d8ed7

Browse files
authored
Don't use std::ignore for unused parameters (#17219)
`std::ignore` seems to have been adopted as some sort of ersatz `(void)` cast or `[[maybe_unused]]` annotation on unused parameters. Since the following are true: 1. The behavior of `std::ignore` outside of `std::tie` is not formally specified; 2. C++ already has builtin ways to express ignorance of a value; 3. Compiling `std::tie` is much more expensive than using the builtin alternatives [1]; 4. It's confusing to read; 5. It requires an extra header inclusion: I decided to simply omit the argument name in all cases where this is possible. This is a mostly completely mechanical transformation, using the following script: ``` find unified-runtime -name "*.[ch]pp" \ | xargs sed -i '/^\s*std::ignore\s*=\s*[a-zA-Z_][a-zA-Z0-9_]*;/d' \ && git ls-files -m | parallel clang-tidy \ '--checks="-*,misc-unused-parameters"' --fix --fix-errors -p build ``` Followed by manually introducting `[[maybe_unused]]` in `NDEBUG` blocks in a few places. [1]: Both clang and gcc with libstdc++ and libc++ show similar slowdowns compiling the std::ignore vs void. I didn't try with MSVC but I see no reason it wouldn't be similar ``` $ ipython3 In [1]: def ignore(n): ...: ignores = 'std::ignore = x;\n' * n ...: return f'''#include <tuple>\nint foo(int x) {{ {ignores} \n return x;}}''' ...: In [2]: def void(n): ...: voids = '(void)x;\n' * n ...: return f'''int foo(int x) {{ {voids} \n return x;\n}}''' ...: In [3]: with open("ignore.cpp", "w") as f: ...: f.write(ignore(100000)) ...: In [4]: with open("voids.cpp", "w") as f: ...: f.write(void(100000)) ...: $ time c++ -S voids.cpp c++ -S voids.cpp 0.18s user 0.03s system 99% cpu 0.211 total $ time c++ -S ignore.cpp c++ -S ignore.cpp 4.50s user 0.34s system 99% cpu 4.836 total ```
1 parent 2c7aa07 commit 82d8ed7

Some content is hidden

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

52 files changed

+637
-1318
lines changed

unified-runtime/source/adapters/cuda/adapter.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urAdapterRelease(ur_adapter_handle_t) {
9090
}
9191

9292
UR_APIEXPORT ur_result_t UR_APICALL urAdapterGetLastError(
93-
ur_adapter_handle_t, const char **ppMessage, int32_t *pError) {
94-
std::ignore = pError;
93+
ur_adapter_handle_t, const char **ppMessage, int32_t * /*pError*/) {
9594
*ppMessage = ErrorMessage;
9695
return ErrorMessageCode;
9796
}

unified-runtime/source/adapters/cuda/context.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@ ur_context_handle_t_::getOwningURPool(umf_memory_pool_t *UMFPool) {
4545
///
4646
UR_APIEXPORT ur_result_t UR_APICALL
4747
urContextCreate(uint32_t DeviceCount, const ur_device_handle_t *phDevices,
48-
const ur_context_properties_t *pProperties,
48+
const ur_context_properties_t * /*pProperties*/,
4949
ur_context_handle_t *phContext) {
50-
std::ignore = pProperties;
5150

5251
std::unique_ptr<ur_context_handle_t_> ContextPtr{nullptr};
5352
try {

unified-runtime/source/adapters/cuda/device.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
11981198

11991199
/// \return PI_SUCCESS if the function is executed successfully
12001200
/// CUDA devices are always root devices so retain always returns success.
1201-
UR_APIEXPORT ur_result_t UR_APICALL urDeviceRetain(ur_device_handle_t) {
1201+
UR_APIEXPORT ur_result_t UR_APICALL
1202+
urDeviceRetain(ur_device_handle_t /*hDevice*/) {
12021203
return UR_RESULT_SUCCESS;
12031204
}
12041205

@@ -1210,7 +1211,8 @@ urDevicePartition(ur_device_handle_t, const ur_device_partition_properties_t *,
12101211

12111212
/// \return UR_RESULT_SUCCESS always since CUDA devices are always root
12121213
/// devices.
1213-
UR_APIEXPORT ur_result_t UR_APICALL urDeviceRelease(ur_device_handle_t) {
1214+
UR_APIEXPORT ur_result_t UR_APICALL
1215+
urDeviceRelease(ur_device_handle_t /*hDevice*/) {
12141216
return UR_RESULT_SUCCESS;
12151217
}
12161218

@@ -1337,9 +1339,8 @@ ur_result_t UR_APICALL urDeviceGetGlobalTimestamps(ur_device_handle_t hDevice,
13371339
/// \return If available, the first binary that is PTX
13381340
///
13391341
UR_APIEXPORT ur_result_t UR_APICALL urDeviceSelectBinary(
1340-
ur_device_handle_t hDevice, const ur_device_binary_t *pBinaries,
1342+
ur_device_handle_t /*hDevice*/, const ur_device_binary_t *pBinaries,
13411343
uint32_t NumBinaries, uint32_t *pSelectedBinary) {
1342-
std::ignore = hDevice;
13431344

13441345
// Look for an image for the NVPTX64 target, and return the first one that is
13451346
// found

unified-runtime/source/adapters/cuda/enqueue.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,11 +1179,9 @@ static ur_result_t commonEnqueueMemImageNDCopy(
11791179

11801180
UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageRead(
11811181
ur_queue_handle_t hQueue, ur_mem_handle_t hImage, bool blockingRead,
1182-
ur_rect_offset_t origin, ur_rect_region_t region, size_t rowPitch,
1183-
size_t slicePitch, void *pDst, uint32_t numEventsInWaitList,
1182+
ur_rect_offset_t origin, ur_rect_region_t region, size_t /*rowPitch*/,
1183+
size_t /*slicePitch*/, void *pDst, uint32_t numEventsInWaitList,
11841184
const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) {
1185-
std::ignore = rowPitch;
1186-
std::ignore = slicePitch;
11871185

11881186
UR_ASSERT(hImage->isImage(), UR_RESULT_ERROR_INVALID_MEM_OBJECT);
11891187

@@ -1253,13 +1251,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageRead(
12531251
}
12541252

12551253
UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageWrite(
1256-
ur_queue_handle_t hQueue, ur_mem_handle_t hImage, bool blockingWrite,
1257-
ur_rect_offset_t origin, ur_rect_region_t region, size_t rowPitch,
1258-
size_t slicePitch, void *pSrc, uint32_t numEventsInWaitList,
1254+
ur_queue_handle_t hQueue, ur_mem_handle_t hImage, bool /*blockingWrite*/,
1255+
ur_rect_offset_t origin, ur_rect_region_t region, size_t /*rowPitch*/,
1256+
size_t /*slicePitch*/, void *pSrc, uint32_t numEventsInWaitList,
12591257
const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) {
1260-
std::ignore = blockingWrite;
1261-
std::ignore = rowPitch;
1262-
std::ignore = slicePitch;
12631258

12641259
UR_ASSERT(hImage->isImage(), UR_RESULT_ERROR_INVALID_MEM_OBJECT);
12651260
auto &Image = std::get<SurfaceMem>(hImage->Mem);
@@ -1597,9 +1592,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMMemcpy(
15971592

15981593
UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMPrefetch(
15991594
ur_queue_handle_t hQueue, const void *pMem, size_t size,
1600-
ur_usm_migration_flags_t flags, uint32_t numEventsInWaitList,
1595+
ur_usm_migration_flags_t /*flags*/, uint32_t numEventsInWaitList,
16011596
const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) {
1602-
std::ignore = flags;
16031597

16041598
size_t PointerRangeSize = 0;
16051599
UR_CHECK_ERROR(cuPointerGetAttribute(

unified-runtime/source/adapters/cuda/event.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urEventGetNativeHandle(
285285

286286
UR_APIEXPORT ur_result_t UR_APICALL urEventCreateWithNativeHandle(
287287
ur_native_handle_t hNativeEvent, ur_context_handle_t hContext,
288-
const ur_event_native_properties_t *pProperties,
288+
const ur_event_native_properties_t * /*pProperties*/,
289289
ur_event_handle_t *phEvent) {
290-
std::ignore = pProperties;
291290

292291
std::unique_ptr<ur_event_handle_t_> EventPtr{nullptr};
293292

unified-runtime/source/adapters/cuda/image.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,15 +259,13 @@ ur_result_t urTextureCreate(ur_sampler_handle_t hSampler,
259259

260260
UR_APIEXPORT ur_result_t UR_APICALL urUSMPitchedAllocExp(
261261
ur_context_handle_t hContext, ur_device_handle_t hDevice,
262-
const ur_usm_desc_t *pUSMDesc, ur_usm_pool_handle_t pool,
262+
const ur_usm_desc_t * /*pUSMDesc*/, ur_usm_pool_handle_t /*pool*/,
263263
size_t widthInBytes, size_t height, size_t elementSizeBytes, void **ppMem,
264264
size_t *pResultPitch) {
265265
UR_ASSERT(std::find(hContext->getDevices().begin(),
266266
hContext->getDevices().end(),
267267
hDevice) != hContext->getDevices().end(),
268268
UR_RESULT_ERROR_INVALID_CONTEXT);
269-
std::ignore = pUSMDesc;
270-
std::ignore = pool;
271269

272270
UR_ASSERT((height > 0), UR_RESULT_ERROR_INVALID_VALUE);
273271
UR_ASSERT((elementSizeBytes > 0), UR_RESULT_ERROR_INVALID_VALUE);

unified-runtime/source/adapters/cuda/kernel.cpp

Lines changed: 22 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelGetNativeHandle(
190190
}
191191

192192
UR_APIEXPORT ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
193-
ur_kernel_handle_t hKernel, ur_device_handle_t hDevice, uint32_t workDim,
194-
const size_t *pLocalWorkSize, size_t dynamicSharedMemorySize,
195-
uint32_t *pGroupCountRet) {
193+
ur_kernel_handle_t hKernel, ur_device_handle_t /*hDevice*/,
194+
uint32_t workDim, const size_t *pLocalWorkSize,
195+
size_t dynamicSharedMemorySize, uint32_t *pGroupCountRet) {
196196
UR_ASSERT(hKernel, UR_RESULT_ERROR_INVALID_KERNEL);
197197

198-
std::ignore = hDevice;
199-
200198
size_t localWorkSize = pLocalWorkSize[0];
201199
localWorkSize *= (workDim >= 2 ? pLocalWorkSize[1] : 1);
202200
localWorkSize *= (workDim == 3 ? pLocalWorkSize[2] : 1);
@@ -244,9 +242,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
244242

245243
UR_APIEXPORT ur_result_t UR_APICALL urKernelSetArgValue(
246244
ur_kernel_handle_t hKernel, uint32_t argIndex, size_t argSize,
247-
const ur_kernel_arg_value_properties_t *pProperties,
245+
const ur_kernel_arg_value_properties_t * /*pProperties*/,
248246
const void *pArgValue) {
249-
std::ignore = pProperties;
250247
UR_ASSERT(argSize, UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_SIZE);
251248

252249
ur_result_t Result = UR_RESULT_SUCCESS;
@@ -260,8 +257,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelSetArgValue(
260257

261258
UR_APIEXPORT ur_result_t UR_APICALL urKernelSetArgLocal(
262259
ur_kernel_handle_t hKernel, uint32_t argIndex, size_t argSize,
263-
const ur_kernel_arg_local_properties_t *pProperties) {
264-
std::ignore = pProperties;
260+
const ur_kernel_arg_local_properties_t * /*pProperties*/) {
265261
UR_ASSERT(argSize, UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_SIZE);
266262

267263
ur_result_t Result = UR_RESULT_SUCCESS;
@@ -357,11 +353,10 @@ urKernelGetSubGroupInfo(ur_kernel_handle_t hKernel, ur_device_handle_t hDevice,
357353
return UR_RESULT_ERROR_INVALID_ENUMERATION;
358354
}
359355

360-
UR_APIEXPORT ur_result_t UR_APICALL
361-
urKernelSetArgPointer(ur_kernel_handle_t hKernel, uint32_t argIndex,
362-
const ur_kernel_arg_pointer_properties_t *pProperties,
363-
const void *pArgValue) {
364-
std::ignore = pProperties;
356+
UR_APIEXPORT ur_result_t UR_APICALL urKernelSetArgPointer(
357+
ur_kernel_handle_t hKernel, uint32_t argIndex,
358+
const ur_kernel_arg_pointer_properties_t * /*pProperties*/,
359+
const void *pArgValue) {
365360
try {
366361
// setKernelArg is expecting a pointer to our argument
367362
hKernel->setKernelArg(argIndex, sizeof(pArgValue), &pArgValue);
@@ -416,14 +411,11 @@ urKernelSetArgMemObj(ur_kernel_handle_t hKernel, uint32_t argIndex,
416411
}
417412

418413
// A NOP for the CUDA backend
419-
UR_APIEXPORT ur_result_t UR_APICALL urKernelSetExecInfo(
420-
ur_kernel_handle_t hKernel, ur_kernel_exec_info_t propName, size_t propSize,
421-
const ur_kernel_exec_info_properties_t *pProperties,
422-
const void *pPropValue) {
423-
std::ignore = hKernel;
424-
std::ignore = propSize;
425-
std::ignore = pPropValue;
426-
std::ignore = pProperties;
414+
UR_APIEXPORT ur_result_t UR_APICALL
415+
urKernelSetExecInfo(ur_kernel_handle_t /*hKernel*/,
416+
ur_kernel_exec_info_t propName, size_t /*propSize*/,
417+
const ur_kernel_exec_info_properties_t * /*pProperties*/,
418+
const void * /*pPropValue*/) {
427419

428420
switch (propName) {
429421
case UR_KERNEL_EXEC_INFO_USM_INDIRECT_ACCESS:
@@ -436,23 +428,17 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelSetExecInfo(
436428
}
437429

438430
UR_APIEXPORT ur_result_t UR_APICALL urKernelCreateWithNativeHandle(
439-
ur_native_handle_t hNativeKernel, ur_context_handle_t hContext,
440-
ur_program_handle_t hProgram,
441-
const ur_kernel_native_properties_t *pProperties,
442-
ur_kernel_handle_t *phKernel) {
443-
std::ignore = hNativeKernel;
444-
std::ignore = hContext;
445-
std::ignore = hProgram;
446-
std::ignore = pProperties;
447-
std::ignore = phKernel;
431+
ur_native_handle_t /*hNativeKernel*/, ur_context_handle_t /*hContext*/,
432+
ur_program_handle_t /*hProgram*/,
433+
const ur_kernel_native_properties_t * /*pProperties*/,
434+
ur_kernel_handle_t * /*phKernel*/) {
448435
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
449436
}
450437

451-
UR_APIEXPORT ur_result_t UR_APICALL
452-
urKernelSetArgSampler(ur_kernel_handle_t hKernel, uint32_t argIndex,
453-
const ur_kernel_arg_sampler_properties_t *pProperties,
454-
ur_sampler_handle_t hArgValue) {
455-
std::ignore = pProperties;
438+
UR_APIEXPORT ur_result_t UR_APICALL urKernelSetArgSampler(
439+
ur_kernel_handle_t hKernel, uint32_t argIndex,
440+
const ur_kernel_arg_sampler_properties_t * /*pProperties*/,
441+
ur_sampler_handle_t hArgValue) {
456442

457443
ur_result_t Result = UR_RESULT_SUCCESS;
458444
try {

unified-runtime/source/adapters/cuda/platform.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -189,16 +189,14 @@ urPlatformGet(ur_adapter_handle_t, uint32_t, ur_platform_handle_t *phPlatforms,
189189
}
190190

191191
UR_APIEXPORT ur_result_t UR_APICALL urPlatformGetApiVersion(
192-
ur_platform_handle_t hDriver, ur_api_version_t *pVersion) {
193-
std::ignore = hDriver;
192+
ur_platform_handle_t /*hDriver*/, ur_api_version_t *pVersion) {
194193
*pVersion = UR_API_VERSION_CURRENT;
195194
return UR_RESULT_SUCCESS;
196195
}
197196

198-
UR_APIEXPORT ur_result_t UR_APICALL urPlatformGetNativeHandle(
199-
ur_platform_handle_t hPlatform, ur_native_handle_t *phNativePlatform) {
200-
std::ignore = hPlatform;
201-
std::ignore = phNativePlatform;
197+
UR_APIEXPORT ur_result_t UR_APICALL
198+
urPlatformGetNativeHandle(ur_platform_handle_t /*hPlatform*/,
199+
ur_native_handle_t * /*phNativePlatform*/) {
202200
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
203201
}
204202

@@ -214,9 +212,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urPlatformCreateWithNativeHandle(
214212
// Return empty string for cuda.
215213
// TODO: Determine correct string to be passed.
216214
UR_APIEXPORT ur_result_t UR_APICALL urPlatformGetBackendOption(
217-
ur_platform_handle_t hPlatform, const char *pFrontendOption,
215+
ur_platform_handle_t /*hPlatform*/, const char *pFrontendOption,
218216
const char **ppPlatformOption) {
219-
std::ignore = hPlatform;
220217
using namespace std::literals;
221218
if (pFrontendOption == nullptr)
222219
return UR_RESULT_ERROR_INVALID_NULL_POINTER;

unified-runtime/source/adapters/cuda/program.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramBuildExp(ur_program_handle_t,
260260
/// Loads the images from a UR program into a CUmodule that can be
261261
/// used later on to extract functions (kernels).
262262
/// See \ref ur_program_handle_t for implementation details.
263-
UR_APIEXPORT ur_result_t UR_APICALL urProgramBuild(ur_context_handle_t hContext,
264-
ur_program_handle_t hProgram,
265-
const char *pOptions) {
266-
std::ignore = hContext;
263+
UR_APIEXPORT ur_result_t UR_APICALL
264+
urProgramBuild(ur_context_handle_t /*hContext*/, ur_program_handle_t hProgram,
265+
const char *pOptions) {
267266

268267
ur_result_t Result = UR_RESULT_SUCCESS;
269268

@@ -361,11 +360,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramCreateWithNativeHandle(
361360
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
362361
}
363362

364-
UR_APIEXPORT ur_result_t UR_APICALL
365-
urProgramGetBuildInfo(ur_program_handle_t hProgram, ur_device_handle_t hDevice,
366-
ur_program_build_info_t propName, size_t propSize,
367-
void *pPropValue, size_t *pPropSizeRet) {
368-
std::ignore = hDevice;
363+
UR_APIEXPORT ur_result_t UR_APICALL urProgramGetBuildInfo(
364+
ur_program_handle_t hProgram, ur_device_handle_t /*hDevice*/,
365+
ur_program_build_info_t propName, size_t propSize, void *pPropValue,
366+
size_t *pPropSizeRet) {
369367

370368
UrReturnHelper ReturnValue(propSize, pPropValue, pPropSizeRet);
371369

unified-runtime/source/adapters/cuda/queue.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,15 +168,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urQueueFinish(ur_queue_handle_t hQueue) {
168168
// There is no CUDA counterpart for queue flushing and we don't run into the
169169
// same problem of having to flush cross-queue dependencies as some of the
170170
// other plugins, so it can be left as no-op.
171-
UR_APIEXPORT ur_result_t UR_APICALL urQueueFlush(ur_queue_handle_t hQueue) {
172-
std::ignore = hQueue;
171+
UR_APIEXPORT ur_result_t UR_APICALL urQueueFlush(ur_queue_handle_t /*hQueue*/) {
173172
return UR_RESULT_SUCCESS;
174173
}
175174

176-
UR_APIEXPORT ur_result_t UR_APICALL
177-
urQueueGetNativeHandle(ur_queue_handle_t hQueue, ur_queue_native_desc_t *pDesc,
178-
ur_native_handle_t *phNativeQueue) {
179-
std::ignore = pDesc;
175+
UR_APIEXPORT ur_result_t UR_APICALL urQueueGetNativeHandle(
176+
ur_queue_handle_t hQueue, ur_queue_native_desc_t * /*pDesc*/,
177+
ur_native_handle_t *phNativeQueue) {
180178

181179
ScopedContext Active(hQueue->getDevice());
182180
*phNativeQueue =

unified-runtime/source/adapters/cuda/usm.cpp

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urUSMFree(ur_context_handle_t hContext,
116116
ur_result_t USMDeviceAllocImpl(void **ResultPtr, ur_context_handle_t,
117117
ur_device_handle_t Device,
118118
ur_usm_device_mem_flags_t, size_t Size,
119-
uint32_t Alignment) {
119+
[[maybe_unused]] uint32_t Alignment) {
120120
try {
121121
ScopedContext Active(Device);
122122
*ResultPtr = umfPoolMalloc(Device->MemoryPoolDevice, Size);
@@ -125,20 +125,16 @@ ur_result_t USMDeviceAllocImpl(void **ResultPtr, ur_context_handle_t,
125125
return Err;
126126
}
127127

128-
#ifdef NDEBUG
129-
std::ignore = Alignment;
130-
#else
131128
assert((Alignment == 0 ||
132129
reinterpret_cast<std::uintptr_t>(*ResultPtr) % Alignment == 0));
133-
#endif
134130
return UR_RESULT_SUCCESS;
135131
}
136132

137133
ur_result_t USMSharedAllocImpl(void **ResultPtr, ur_context_handle_t,
138134
ur_device_handle_t Device,
139135
ur_usm_host_mem_flags_t,
140136
ur_usm_device_mem_flags_t, size_t Size,
141-
uint32_t Alignment) {
137+
[[maybe_unused]] uint32_t Alignment) {
142138
try {
143139
ScopedContext Active(Device);
144140
*ResultPtr = umfPoolMalloc(Device->MemoryPoolShared, Size);
@@ -147,31 +143,23 @@ ur_result_t USMSharedAllocImpl(void **ResultPtr, ur_context_handle_t,
147143
return Err;
148144
}
149145

150-
#ifdef NDEBUG
151-
std::ignore = Alignment;
152-
#else
153146
assert((Alignment == 0 ||
154147
reinterpret_cast<std::uintptr_t>(*ResultPtr) % Alignment == 0));
155-
#endif
156148
return UR_RESULT_SUCCESS;
157149
}
158150

159151
ur_result_t USMHostAllocImpl(void **ResultPtr, ur_context_handle_t hContext,
160152
ur_usm_host_mem_flags_t, size_t Size,
161-
uint32_t Alignment) {
153+
[[maybe_unused]] uint32_t Alignment) {
162154
try {
163155
*ResultPtr = umfPoolMalloc(hContext->MemoryPoolHost, Size);
164156
UMF_CHECK_PTR(*ResultPtr);
165157
} catch (ur_result_t Err) {
166158
return Err;
167159
}
168160

169-
#ifdef NDEBUG
170-
std::ignore = Alignment;
171-
#else
172161
assert((Alignment == 0 ||
173162
reinterpret_cast<std::uintptr_t>(*ResultPtr) % Alignment == 0));
174-
#endif
175163
return UR_RESULT_SUCCESS;
176164
}
177165

0 commit comments

Comments
 (0)