Skip to content

[CUDAX] Adjust some of the async_buffer interfaces - #4585

Merged
miscco merged 5 commits into
NVIDIA:mainfrom
pciolkosz:async_buffer_changes
Apr 30, 2025
Merged

miscco merged 5 commits into
NVIDIA:mainfrom
pciolkosz:async_buffer_changes

Conversation

@pciolkosz

Copy link
Copy Markdown
Contributor

This PR makes the following changes to async_buffer:

  • Removes all cases of internal stream synchronization in the buffer type, stream synchronization should be clearly visible and not side effect of a buffer API call. This means that:
    • get is removed as pure performance trap
    • operator== is removed, because its an inherently synchronous operation that needs an answer to return, while async_buffer is designed to represent data that is operated on asynchronously. We can think about some other way to expose comparison in the future.
    • Removes support for initialization from a non-contagious iterator. In order to not synchronize the internal stream we need batched memcpy API that allows to specify access to the source in stream order. We will add support back for it in CUDA 13.0 when minor version compatibility won't be an issue anymore.
    • sync is removed and get_stream().sync() should be used instead.
  • Switches the order of arguments in make_async_buffer to make the stream argument first. This is in preparation for graphs APIs, where make_async_buffer was designed to be applicable for both streams and graphs based on the first argument. Other overloads not taking an explicit streams are removed as not useful, constructor can serve that purpose.
  • Adds an explicit destroy function that allows to submit the deallocation into the stream before the object is otherwise destroyed allowing to avoid some potential false dependencies with operations inserted into the stream later on. It is possible that destroy should take an optional stream to destroy on a different stream, but I wasn't sure how to differentiate between version that does and does not wait on the stored stream before destruction. I decided that the pair of switch_stream[_unsynchronized] + destroy is better at disambiguating that.
  • Adds move assignment operator to make a buffer that had destroy called on it useful for something.

@pciolkosz
pciolkosz requested review from a team as code owners April 30, 2025 01:05
@pciolkosz
pciolkosz requested a review from griwes April 30, 2025 01:05
@github-project-automation github-project-automation Bot moved this to Todo in CCCL Apr 30, 2025
@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Review in CCCL Apr 30, 2025
@github-actions

Copy link
Copy Markdown
Contributor
🟩 CI finished in 20m 39s: Pass: 100%/26 | Total: 2h 27m | Avg: 5m 41s | Max: 13m 51s | Hits: 96%/14642
  • 🟩 cudax: Pass: 100%/26 | Total: 2h 27m | Avg: 5m 41s | Max: 13m 51s | Hits: 96%/14642

    🟩 cpu
      🟩 amd64              Pass: 100%/22  | Total:  2h 12m | Avg:  6m 00s | Max: 13m 51s | Hits:  96%/12298 
      🟩 arm64              Pass: 100%/4   | Total: 15m 25s | Avg:  3m 51s | Max:  3m 57s | Hits:  96%/2344  
    🟩 ctk
      🟩 12.0               Pass: 100%/3   | Total: 20m 30s | Avg:  6m 50s | Max: 12m 57s | Hits:  94%/1463  
      🟩 12.8               Pass: 100%/23  | Total:  2h 07m | Avg:  5m 32s | Max: 13m 51s | Hits:  96%/13179 
    🟩 cudacxx
      🟩 nvcc12.0           Pass: 100%/3   | Total: 20m 30s | Avg:  6m 50s | Max: 12m 57s | Hits:  94%/1463  
      🟩 nvcc12.8           Pass: 100%/23  | Total:  2h 07m | Avg:  5m 32s | Max: 13m 51s | Hits:  96%/13179 
    🟩 cudacxx_family
      🟩 nvcc               Pass: 100%/26  | Total:  2h 27m | Avg:  5m 41s | Max: 13m 51s | Hits:  96%/14642 
    🟩 cxx
      🟩 Clang14            Pass: 100%/2   | Total:  7m 51s | Avg:  3m 55s | Max:  4m 06s | Hits:  96%/1176  
      🟩 Clang15            Pass: 100%/1   | Total:  4m 18s | Avg:  4m 18s | Max:  4m 18s | Hits:  96%/586   
      🟩 Clang16            Pass: 100%/1   | Total:  4m 18s | Avg:  4m 18s | Max:  4m 18s | Hits:  96%/586   
      🟩 Clang17            Pass: 100%/1   | Total:  4m 34s | Avg:  4m 34s | Max:  4m 34s | Hits:  96%/586   
      🟩 Clang18            Pass: 100%/1   | Total:  4m 03s | Avg:  4m 03s | Max:  4m 03s | Hits:  96%/586   
      🟩 Clang19            Pass: 100%/4   | Total: 19m 15s | Avg:  4m 48s | Max:  7m 36s | Hits:  97%/2344  
      🟩 GCC10              Pass: 100%/2   | Total:  8m 02s | Avg:  4m 01s | Max:  4m 14s | Hits:  96%/1176  
      🟩 GCC11              Pass: 100%/1   | Total:  4m 06s | Avg:  4m 06s | Max:  4m 06s | Hits:  96%/586   
      🟩 GCC12              Pass: 100%/1   | Total:  4m 12s | Avg:  4m 12s | Max:  4m 12s | Hits:  96%/586   
      🟩 GCC13              Pass: 100%/8   | Total: 46m 34s | Avg:  5m 49s | Max: 13m 51s | Hits:  97%/4688  
      🟩 MSVC14.39          Pass: 100%/1   | Total: 12m 57s | Avg: 12m 57s | Max: 12m 57s | Hits:  88%/287   
      🟩 MSVC14.42          Pass: 100%/1   | Total: 10m 58s | Avg: 10m 58s | Max: 10m 58s | Hits:  88%/287   
      🟩 NVHPC25.3          Pass: 100%/2   | Total: 16m 38s | Avg:  8m 19s | Max:  8m 33s | Hits:  94%/1168  
    🟩 cxx_family
      🟩 Clang              Pass: 100%/10  | Total: 44m 19s | Avg:  4m 25s | Max:  7m 36s | Hits:  96%/5864  
      🟩 GCC                Pass: 100%/12  | Total:  1h 02m | Avg:  5m 14s | Max: 13m 51s | Hits:  96%/7036  
      🟩 MSVC               Pass: 100%/2   | Total: 23m 55s | Avg: 11m 57s | Max: 12m 57s | Hits:  88%/574   
      🟩 NVHPC              Pass: 100%/2   | Total: 16m 38s | Avg:  8m 19s | Max:  8m 33s | Hits:  94%/1168  
    🟩 gpu
      🟩 h100               Pass: 100%/2   | Total: 13m 24s | Avg:  6m 42s | Max:  9m 45s | Hits:  97%/1172  
      🟩 rtx2080            Pass: 100%/24  | Total:  2h 14m | Avg:  5m 35s | Max: 13m 51s | Hits:  96%/13470 
    🟩 jobs
      🟩 Build              Pass: 100%/23  | Total:  1h 56m | Avg:  5m 04s | Max: 12m 57s | Hits:  95%/12884 
      🟩 Test               Pass: 100%/3   | Total: 31m 12s | Avg: 10m 24s | Max: 13m 51s | Hits:  99%/1758  
    🟩 sm
      🟩 90                 Pass: 100%/3   | Total: 16m 57s | Avg:  5m 39s | Max:  9m 45s | Hits:  97%/1758  
      🟩 90a                Pass: 100%/1   | Total:  3m 37s | Avg:  3m 37s | Max:  3m 37s | Hits:  96%/586   
    🟩 std
      🟩 17                 Pass: 100%/4   | Total: 19m 48s | Avg:  4m 57s | Max:  8m 33s | Hits:  95%/2342  
      🟩 20                 Pass: 100%/22  | Total:  2h 07m | Avg:  5m 49s | Max: 13m 51s | Hits:  96%/12300 
    

👃 Inspect Changes

Modifications in project?

Project
CCCL Infrastructure
libcu++
CUB
Thrust
+/- CUDA Experimental
stdpar
python
CCCL C Parallel Library
Catch2Helper

Modifications in project or dependencies?

Project
CCCL Infrastructure
libcu++
CUB
Thrust
+/- CUDA Experimental
stdpar
python
CCCL C Parallel Library
Catch2Helper

🏃‍ Runner counts (total jobs: 26)

# Runner
17 linux-amd64-cpu16
4 linux-arm64-cpu16
2 windows-amd64-cpu16
2 linux-amd64-gpu-rtx2080-latest-1
1 linux-amd64-gpu-h100-latest-1

@github-actions

Copy link
Copy Markdown
Contributor
🟩 CI finished in 20m 24s: Pass: 100%/26 | Total: 2h 30m | Avg: 5m 47s | Max: 12m 58s | Hits: 96%/14642
  • 🟩 cudax: Pass: 100%/26 | Total: 2h 30m | Avg: 5m 47s | Max: 12m 58s | Hits: 96%/14642

    🟩 cpu
      🟩 amd64              Pass: 100%/22  | Total:  2h 15m | Avg:  6m 09s | Max: 12m 58s | Hits:  96%/12298 
      🟩 arm64              Pass: 100%/4   | Total: 15m 23s | Avg:  3m 50s | Max:  3m 56s | Hits:  96%/2344  
    🟩 ctk
      🟩 12.0               Pass: 100%/3   | Total: 18m 42s | Avg:  6m 14s | Max: 11m 18s | Hits:  95%/1463  
      🟩 12.8               Pass: 100%/23  | Total:  2h 11m | Avg:  5m 44s | Max: 12m 58s | Hits:  96%/13179 
    🟩 cudacxx
      🟩 nvcc12.0           Pass: 100%/3   | Total: 18m 42s | Avg:  6m 14s | Max: 11m 18s | Hits:  95%/1463  
      🟩 nvcc12.8           Pass: 100%/23  | Total:  2h 11m | Avg:  5m 44s | Max: 12m 58s | Hits:  96%/13179 
    🟩 cudacxx_family
      🟩 nvcc               Pass: 100%/26  | Total:  2h 30m | Avg:  5m 47s | Max: 12m 58s | Hits:  96%/14642 
    🟩 cxx
      🟩 Clang14            Pass: 100%/2   | Total:  7m 49s | Avg:  3m 54s | Max:  4m 08s | Hits:  96%/1176  
      🟩 Clang15            Pass: 100%/1   | Total:  4m 07s | Avg:  4m 07s | Max:  4m 07s | Hits:  96%/586   
      🟩 Clang16            Pass: 100%/1   | Total:  4m 15s | Avg:  4m 15s | Max:  4m 15s | Hits:  96%/586   
      🟩 Clang17            Pass: 100%/1   | Total:  4m 20s | Avg:  4m 20s | Max:  4m 20s | Hits:  96%/586   
      🟩 Clang18            Pass: 100%/1   | Total:  4m 13s | Avg:  4m 13s | Max:  4m 13s | Hits:  96%/586   
      🟩 Clang19            Pass: 100%/4   | Total: 19m 30s | Avg:  4m 52s | Max:  7m 43s | Hits:  97%/2344  
      🟩 GCC10              Pass: 100%/2   | Total:  8m 30s | Avg:  4m 15s | Max:  4m 47s | Hits:  94%/1176  
      🟩 GCC11              Pass: 100%/1   | Total:  4m 06s | Avg:  4m 06s | Max:  4m 06s | Hits:  96%/586   
      🟩 GCC12              Pass: 100%/1   | Total:  4m 26s | Avg:  4m 26s | Max:  4m 26s | Hits:  96%/586   
      🟩 GCC13              Pass: 100%/8   | Total: 49m 18s | Avg:  6m 09s | Max: 12m 58s | Hits:  97%/4688  
      🟩 MSVC14.39          Pass: 100%/1   | Total: 11m 18s | Avg: 11m 18s | Max: 11m 18s | Hits:  88%/287   
      🟩 MSVC14.42          Pass: 100%/1   | Total: 11m 28s | Avg: 11m 28s | Max: 11m 28s | Hits:  88%/287   
      🟩 NVHPC25.3          Pass: 100%/2   | Total: 17m 21s | Avg:  8m 40s | Max:  9m 03s | Hits:  94%/1168  
    🟩 cxx_family
      🟩 Clang              Pass: 100%/10  | Total: 44m 14s | Avg:  4m 25s | Max:  7m 43s | Hits:  97%/5864  
      🟩 GCC                Pass: 100%/12  | Total:  1h 06m | Avg:  5m 31s | Max: 12m 58s | Hits:  96%/7036  
      🟩 MSVC               Pass: 100%/2   | Total: 22m 46s | Avg: 11m 23s | Max: 11m 28s | Hits:  88%/574   
      🟩 NVHPC              Pass: 100%/2   | Total: 17m 21s | Avg:  8m 40s | Max:  9m 03s | Hits:  94%/1168  
    🟩 gpu
      🟩 h100               Pass: 100%/2   | Total: 16m 33s | Avg:  8m 16s | Max: 12m 49s | Hits:  98%/1172  
      🟩 rtx2080            Pass: 100%/24  | Total:  2h 14m | Avg:  5m 35s | Max: 12m 58s | Hits:  96%/13470 
    🟩 jobs
      🟩 Build              Pass: 100%/23  | Total:  1h 57m | Avg:  5m 05s | Max: 11m 28s | Hits:  95%/12884 
      🟩 Test               Pass: 100%/3   | Total: 33m 30s | Avg: 11m 10s | Max: 12m 58s | Hits:  99%/1758  
    🟩 sm
      🟩 90                 Pass: 100%/3   | Total: 20m 21s | Avg:  6m 47s | Max: 12m 49s | Hits:  97%/1758  
      🟩 90a                Pass: 100%/1   | Total:  3m 37s | Avg:  3m 37s | Max:  3m 37s | Hits:  96%/586   
    🟩 std
      🟩 17                 Pass: 100%/4   | Total: 20m 36s | Avg:  5m 09s | Max:  9m 03s | Hits:  95%/2342  
      🟩 20                 Pass: 100%/22  | Total:  2h 10m | Avg:  5m 54s | Max: 12m 58s | Hits:  96%/12300 
    

👃 Inspect Changes

Modifications in project?

Project
CCCL Infrastructure
libcu++
CUB
Thrust
+/- CUDA Experimental
stdpar
python
CCCL C Parallel Library
Catch2Helper

Modifications in project or dependencies?

Project
CCCL Infrastructure
libcu++
CUB
Thrust
+/- CUDA Experimental
stdpar
python
CCCL C Parallel Library
Catch2Helper

🏃‍ Runner counts (total jobs: 26)

# Runner
17 linux-amd64-cpu16
4 linux-arm64-cpu16
2 windows-amd64-cpu16
2 linux-amd64-gpu-rtx2080-latest-1
1 linux-amd64-gpu-h100-latest-1

@miscco miscco left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still not convinced the destroy method is actually something we want but it does not hurt

@miscco
miscco merged commit 1366330 into NVIDIA:main Apr 30, 2025
@github-project-automation github-project-automation Bot moved this from In Review to Done in CCCL Apr 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants