Skip to content

Commit 0b61b2d

Browse files
committed
[SYCL][CUDA][NFC] Check alignment of USM allocations
1 parent ebc9886 commit 0b61b2d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

sycl/plugins/cuda/pi_cuda.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4164,6 +4164,9 @@ pi_result cuda_piextUSMHostAlloc(void **result_ptr, pi_context context,
41644164
result = error;
41654165
}
41664166

4167+
assert(alignment == 0 ||
4168+
(result == PI_SUCCESS &&
4169+
reinterpret_cast<std::uintptr_t>(*result_ptr) % alignment == 0));
41674170
return result;
41684171
}
41694172

@@ -4185,6 +4188,9 @@ pi_result cuda_piextUSMDeviceAlloc(void **result_ptr, pi_context context,
41854188
result = error;
41864189
}
41874190

4191+
assert(alignment == 0 ||
4192+
(result == PI_SUCCESS &&
4193+
reinterpret_cast<std::uintptr_t>(*result_ptr) % alignment == 0));
41884194
return result;
41894195
}
41904196

@@ -4207,6 +4213,9 @@ pi_result cuda_piextUSMSharedAlloc(void **result_ptr, pi_context context,
42074213
result = error;
42084214
}
42094215

4216+
assert(alignment == 0 ||
4217+
(result == PI_SUCCESS &&
4218+
reinterpret_cast<std::uintptr_t>(*result_ptr) % alignment == 0));
42104219
return result;
42114220
}
42124221

0 commit comments

Comments
 (0)