NVIDIA / NVIDIA/cccl

Clarify async deallocation in PSTL

Open
#7,438 2 comments 0 reactions 3 assignees Claimed by @gevtushenko View on GitHub
Dominant language
C++
Stars
2.5k
Forks
486
Avg merge
2d 6h
Merged PRs (30d)
295

Description

While reviewing #7381, I pointed out that we should not need to sync the CUDA stream after deallocating temporary storage. By this time, the algorithm has finished, the result has been copied to the host (ready to be returned), and the stream was already synced for the memcpy.

The argument for syncing a second time after the deallocation was that the PSTL promises that all work has completed when a function returns. However, that unnecessarily pessimizes PSTL algortihms like `find_if` because now we sync twice, once after the copy of the result from device -> host and then a second time after we deallocate temporary storage.

We should reach a conclusion on whether we have to ensure async deallocation has finished when a PSTL algorithm returns or not.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.