@@ -196,14 +196,14 @@ void cuda_memcpy_with_size_tracking_async_gpu_to_gpu(
196
196
return ;
197
197
cudaPointerAttributes attr_dest;
198
198
check_cuda_error (cudaPointerGetAttributes (&attr_dest, dest));
199
- if (attr_dest. type != cudaMemoryTypeDevice) {
200
- PANIC ( " Cuda error: invalid dest device pointer in copy from GPU to GPU. " )
201
- }
199
+ PANIC_IF_FALSE (
200
+ attr_dest. type == cudaMemoryTypeDevice,
201
+ " Cuda error: invalid dest device pointer in copy from GPU to GPU. " );
202
202
cudaPointerAttributes attr_src;
203
203
check_cuda_error (cudaPointerGetAttributes (&attr_src, src));
204
- if (attr_src. type != cudaMemoryTypeDevice) {
205
- PANIC ( " Cuda error: invalid src device pointer in copy from GPU to GPU. " )
206
- }
204
+ PANIC_IF_FALSE (
205
+ attr_src. type == cudaMemoryTypeDevice,
206
+ " Cuda error: invalid src device pointer in copy from GPU to GPU. " );
207
207
cuda_set_device (gpu_index);
208
208
if (attr_src.device == attr_dest.device ) {
209
209
check_cuda_error (
@@ -227,14 +227,14 @@ void cuda_memcpy_gpu_to_gpu(void *dest, void const *src, uint64_t size,
227
227
return ;
228
228
cudaPointerAttributes attr_dest;
229
229
check_cuda_error (cudaPointerGetAttributes (&attr_dest, dest));
230
- if (attr_dest. type != cudaMemoryTypeDevice) {
231
- PANIC ( " Cuda error: invalid dest device pointer in copy from GPU to GPU. " )
232
- }
230
+ PANIC_IF_FALSE (
231
+ attr_dest. type == cudaMemoryTypeDevice,
232
+ " Cuda error: invalid dest device pointer in copy from GPU to GPU. " );
233
233
cudaPointerAttributes attr_src;
234
234
check_cuda_error (cudaPointerGetAttributes (&attr_src, src));
235
- if (attr_src. type != cudaMemoryTypeDevice) {
236
- PANIC ( " Cuda error: invalid src device pointer in copy from GPU to GPU. " )
237
- }
235
+ PANIC_IF_FALSE (
236
+ attr_src. type == cudaMemoryTypeDevice,
237
+ " Cuda error: invalid src device pointer in copy from GPU to GPU. " );
238
238
cuda_set_device (gpu_index);
239
239
if (attr_src.device == attr_dest.device ) {
240
240
check_cuda_error (cudaMemcpy (dest, src, size, cudaMemcpyDeviceToDevice));
0 commit comments