Skip to content

Commit 18b01d9

Browse files
committed
Manually update NDEBUG blocks for [[maybe_unused]] variables
1 parent 5074ca7 commit 18b01d9

File tree

1 file changed

+3
-12
lines changed
  • unified-runtime/source/adapters/cuda

1 file changed

+3
-12
lines changed

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

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urUSMFree(ur_context_handle_t hContext,
113113
ur_result_t USMDeviceAllocImpl(void **ResultPtr, ur_context_handle_t,
114114
ur_device_handle_t Device,
115115
ur_usm_device_mem_flags_t, size_t Size,
116-
uint32_t Alignment) {
116+
[[maybe_unused]] uint32_t Alignment) {
117117
try {
118118
ScopedContext Active(Device);
119119
*ResultPtr = umfPoolMalloc(Device->MemoryPoolDevice, Size);
@@ -122,19 +122,16 @@ ur_result_t USMDeviceAllocImpl(void **ResultPtr, ur_context_handle_t,
122122
return Err;
123123
}
124124

125-
#ifdef NDEBUG
126-
#else
127125
assert((Alignment == 0 ||
128126
reinterpret_cast<std::uintptr_t>(*ResultPtr) % Alignment == 0));
129-
#endif
130127
return UR_RESULT_SUCCESS;
131128
}
132129

133130
ur_result_t USMSharedAllocImpl(void **ResultPtr, ur_context_handle_t,
134131
ur_device_handle_t Device,
135132
ur_usm_host_mem_flags_t,
136133
ur_usm_device_mem_flags_t, size_t Size,
137-
uint32_t Alignment) {
134+
[[maybe_unused]] uint32_t Alignment) {
138135
try {
139136
ScopedContext Active(Device);
140137
*ResultPtr = umfPoolMalloc(Device->MemoryPoolShared, Size);
@@ -143,29 +140,23 @@ ur_result_t USMSharedAllocImpl(void **ResultPtr, ur_context_handle_t,
143140
return Err;
144141
}
145142

146-
#ifdef NDEBUG
147-
#else
148143
assert((Alignment == 0 ||
149144
reinterpret_cast<std::uintptr_t>(*ResultPtr) % Alignment == 0));
150-
#endif
151145
return UR_RESULT_SUCCESS;
152146
}
153147

154148
ur_result_t USMHostAllocImpl(void **ResultPtr, ur_context_handle_t hContext,
155149
ur_usm_host_mem_flags_t, size_t Size,
156-
uint32_t Alignment) {
150+
[[maybe_unused]] uint32_t Alignment) {
157151
try {
158152
*ResultPtr = umfPoolMalloc(hContext->MemoryPoolHost, Size);
159153
UMF_CHECK_PTR(*ResultPtr);
160154
} catch (ur_result_t Err) {
161155
return Err;
162156
}
163157

164-
#ifdef NDEBUG
165-
#else
166158
assert((Alignment == 0 ||
167159
reinterpret_cast<std::uintptr_t>(*ResultPtr) % Alignment == 0));
168-
#endif
169160
return UR_RESULT_SUCCESS;
170161
}
171162

0 commit comments

Comments
 (0)