Skip to content

[flang][cuda][rt] Track asynchronous allocation stream for deallocation#137073

Merged
clementval merged 2 commits intollvm:mainfrom
clementval:stream_alloc
Apr 24, 2025
Merged

[flang][cuda][rt] Track asynchronous allocation stream for deallocation#137073
clementval merged 2 commits intollvm:mainfrom
clementval:stream_alloc

Conversation

@clementval
Copy link
Copy Markdown
Contributor

When an asynchronous allocation is made, we call cudaMallocAsync with a stream. For deallocation, we need to call cudaFreeAsync with the same stream. in order to achieve that, we need to track the allocation and their respective stream.

This patch adds a simple sorted array of asynchronous allocations. A binary search is performed to retrieve the allocation when deallocation is needed.

@clementval clementval requested a review from wangzpgi April 23, 2025 22:11
Comment thread flang-rt/lib/cuda/allocator.cpp Outdated
@clementval clementval merged commit 565a075 into llvm:main Apr 24, 2025
9 checks passed
@clementval clementval deleted the stream_alloc branch April 24, 2025 17:01
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…on (llvm#137073)

When an asynchronous allocation is made, we call `cudaMallocAsync` with
a stream. For deallocation, we need to call `cudaFreeAsync` with the
same stream. in order to achieve that, we need to track the allocation
and their respective stream.

This patch adds a simple sorted array of asynchronous allocations. A
binary search is performed to retrieve the allocation when deallocation
is needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants