From 28c125bb0e0e21f5109d6c3542c979748cc253f0 Mon Sep 17 00:00:00 2001 From: Valentin Clement Date: Wed, 30 Apr 2025 21:38:50 -0700 Subject: [PATCH] [flang][cuda] Fix signatures after argument change --- flang-rt/lib/cuda/allocatable.cpp | 8 ++++---- flang-rt/lib/cuda/allocator.cpp | 4 ++-- flang/include/flang/Runtime/CUDA/allocator.h | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/flang-rt/lib/cuda/allocatable.cpp b/flang-rt/lib/cuda/allocatable.cpp index 432974d18a3e3..c77819e9440d7 100644 --- a/flang-rt/lib/cuda/allocatable.cpp +++ b/flang-rt/lib/cuda/allocatable.cpp @@ -23,7 +23,7 @@ namespace Fortran::runtime::cuda { extern "C" { RT_EXT_API_GROUP_BEGIN -int RTDEF(CUFAllocatableAllocateSync)(Descriptor &desc, int64_t stream, +int RTDEF(CUFAllocatableAllocateSync)(Descriptor &desc, int64_t *stream, bool *pinned, bool hasStat, const Descriptor *errMsg, const char *sourceFile, int sourceLine) { int stat{RTNAME(CUFAllocatableAllocate)( @@ -41,7 +41,7 @@ int RTDEF(CUFAllocatableAllocateSync)(Descriptor &desc, int64_t stream, return stat; } -int RTDEF(CUFAllocatableAllocate)(Descriptor &desc, int64_t stream, +int RTDEF(CUFAllocatableAllocate)(Descriptor &desc, int64_t *stream, bool *pinned, bool hasStat, const Descriptor *errMsg, const char *sourceFile, int sourceLine) { if (desc.HasAddendum()) { @@ -63,7 +63,7 @@ int RTDEF(CUFAllocatableAllocate)(Descriptor &desc, int64_t stream, } int RTDEF(CUFAllocatableAllocateSource)(Descriptor &alloc, - const Descriptor &source, int64_t stream, bool *pinned, bool hasStat, + const Descriptor &source, int64_t *stream, bool *pinned, bool hasStat, const Descriptor *errMsg, const char *sourceFile, int sourceLine) { int stat{RTNAME(CUFAllocatableAllocate)( alloc, stream, pinned, hasStat, errMsg, sourceFile, sourceLine)}; @@ -76,7 +76,7 @@ int RTDEF(CUFAllocatableAllocateSource)(Descriptor &alloc, } int RTDEF(CUFAllocatableAllocateSourceSync)(Descriptor &alloc, - const Descriptor &source, int64_t stream, bool *pinned, bool hasStat, + const Descriptor &source, int64_t *stream, bool *pinned, bool hasStat, const Descriptor *errMsg, const char *sourceFile, int sourceLine) { int stat{RTNAME(CUFAllocatableAllocateSync)( alloc, stream, pinned, hasStat, errMsg, sourceFile, sourceLine)}; diff --git a/flang-rt/lib/cuda/allocator.cpp b/flang-rt/lib/cuda/allocator.cpp index 3a92c5b21c9af..f4289c55bd8de 100644 --- a/flang-rt/lib/cuda/allocator.cpp +++ b/flang-rt/lib/cuda/allocator.cpp @@ -98,7 +98,7 @@ static unsigned findAllocation(void *ptr) { return allocNotFound; } -static void insertAllocation(void *ptr, std::size_t size, std::int64_t stream) { +static void insertAllocation(void *ptr, std::size_t size, cudaStream_t stream) { CriticalSection critical{lock}; initAllocations(); if (numDeviceAllocations >= maxDeviceAllocations) { @@ -106,7 +106,7 @@ static void insertAllocation(void *ptr, std::size_t size, std::int64_t stream) { } deviceAllocations[numDeviceAllocations].ptr = ptr; deviceAllocations[numDeviceAllocations].size = size; - deviceAllocations[numDeviceAllocations].stream = (cudaStream_t)stream; + deviceAllocations[numDeviceAllocations].stream = stream; ++numDeviceAllocations; qsort(deviceAllocations, numDeviceAllocations, sizeof(DeviceAllocation), compareDeviceAlloc); diff --git a/flang/include/flang/Runtime/CUDA/allocator.h b/flang/include/flang/Runtime/CUDA/allocator.h index 18ddf75ac3852..b6ef88744bdcb 100644 --- a/flang/include/flang/Runtime/CUDA/allocator.h +++ b/flang/include/flang/Runtime/CUDA/allocator.h @@ -20,16 +20,16 @@ extern "C" { void RTDECL(CUFRegisterAllocator)(); } -void *CUFAllocPinned(std::size_t, std::int64_t); +void *CUFAllocPinned(std::size_t, std::int64_t*); void CUFFreePinned(void *); -void *CUFAllocDevice(std::size_t, std::int64_t); +void *CUFAllocDevice(std::size_t, std::int64_t*); void CUFFreeDevice(void *); -void *CUFAllocManaged(std::size_t, std::int64_t); +void *CUFAllocManaged(std::size_t, std::int64_t*); void CUFFreeManaged(void *); -void *CUFAllocUnified(std::size_t, std::int64_t); +void *CUFAllocUnified(std::size_t, std::int64_t*); void CUFFreeUnified(void *); } // namespace Fortran::runtime::cuda