File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 99#include " flang/Runtime/CUDA/allocator.h"
1010#include " flang-rt/runtime/allocator-registry.h"
1111#include " flang-rt/runtime/derived.h"
12+ #include " flang-rt/runtime/descriptor.h"
1213#include " flang-rt/runtime/environment.h"
1314#include " flang-rt/runtime/stat.h"
1415#include " flang-rt/runtime/terminator.h"
@@ -43,14 +44,18 @@ void *CUFAllocPinned(
4344
4445void CUFFreePinned (void *p) { CUDA_REPORT_IF_ERROR (cudaFreeHost (p)); }
4546
46- void *CUFAllocDevice (
47- std::size_t sizeInBytes, [[maybe_unused]] std::int64_t asyncId) {
47+ void *CUFAllocDevice (std::size_t sizeInBytes, std::int64_t asyncId) {
4848 void *p;
4949 if (Fortran::runtime::executionEnvironment.cudaDeviceIsManaged ) {
5050 CUDA_REPORT_IF_ERROR (
5151 cudaMallocManaged ((void **)&p, sizeInBytes, cudaMemAttachGlobal));
5252 } else {
53- CUDA_REPORT_IF_ERROR (cudaMalloc (&p, sizeInBytes));
53+ if (asyncId == kNoAsyncId ) {
54+ CUDA_REPORT_IF_ERROR (cudaMalloc (&p, sizeInBytes));
55+ } else {
56+ CUDA_REPORT_IF_ERROR (
57+ cudaMallocAsync (&p, sizeInBytes, (cudaStream_t)asyncId));
58+ }
5459 }
5560 return p;
5661}
You can’t perform that action at this time.
0 commit comments