Skip to content

Commit 3c9dcc2

Browse files
committed
Use pitch*height, not the width*height for size of pitched allocations
1 parent 3a98a7d commit 3c9dcc2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ucm/cuda/cudamem.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,11 @@ UCM_CUDA_ALLOC_FUNC(cuMemAlloc_v2, CUresult, CUDA_SUCCESS, arg0, CUdeviceptr, *,
178178
UCM_CUDA_ALLOC_FUNC(cuMemAllocManaged, CUresult, CUDA_SUCCESS, arg0,
179179
CUdeviceptr, *, "size=%zu flags=0x%x", size_t, unsigned)
180180
UCM_CUDA_ALLOC_FUNC(cuMemAllocPitch, CUresult, CUDA_SUCCESS,
181-
((size_t)arg1) * (arg2), CUdeviceptr, *,
181+
((size_t)(*arg0)) * (arg2), CUdeviceptr, *,
182182
"pitch=%p width=%zu height=%zu elem=%u", size_t*, size_t,
183183
size_t, unsigned)
184184
UCM_CUDA_ALLOC_FUNC(cuMemAllocPitch_v2, CUresult, CUDA_SUCCESS,
185-
((size_t)arg1) * (arg2), CUdeviceptr, *,
185+
((size_t)(*arg0)) * (arg2), CUdeviceptr, *,
186186
"pitch=%p width=%zu height=%zu elem=%u", size_t*, size_t,
187187
size_t, unsigned)
188188
UCM_CUDA_ALLOC_FUNC(cuMemMap, CUresult, CUDA_SUCCESS, arg0, CUdeviceptr, ,
@@ -274,7 +274,7 @@ UCM_CUDA_ALLOC_FUNC(cudaMalloc, cudaError_t, cudaSuccess, arg0, void*, *,
274274
UCM_CUDA_ALLOC_FUNC(cudaMallocManaged, cudaError_t, cudaSuccess, arg0, void*, *,
275275
"size=%zu flags=0x%x", size_t, unsigned)
276276
UCM_CUDA_ALLOC_FUNC(cudaMallocPitch, cudaError_t, cudaSuccess,
277-
((size_t)arg1) * (arg2), void*, *,
277+
((size_t)(*arg0)) * (arg2), void*, *,
278278
"pitch=%p width=%zu height=%zu", size_t*, size_t, size_t)
279279
#if CUDART_VERSION >= 11020
280280
UCM_CUDA_ALLOC_FUNC(cudaMallocAsync, cudaError_t, cudaSuccess, arg0, void*, *,

0 commit comments

Comments
 (0)