This repository has been archived by the owner on Mar 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add documentation for the barrier::wait_parity extension
- Loading branch information
Showing
2 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
docs/extended_api/synchronization_primitives/barrier/wait_parity.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
grand_parent: Extended API | ||
parent: Barriers | ||
--- | ||
|
||
# `cuda::barrier::wait_parity` and `cuda::barrier::try_wait_parity` | ||
|
||
Defined in header `<cuda/std/barrier>`: | ||
|
||
```cuda | ||
__host__ __device__ void cuda::std::barrier::wait_parity(bool phase); | ||
__host__ __device__ bool cuda::std::barrier::try_wait_parity(bool phase); | ||
``` | ||
|
||
`barrier::wait_parity` stalls execution while the barrier is not at the specified phase. | ||
`barrier::try_wait_parity` queries the the state of the barrier against the specified phase. | ||
|
||
## Return Value | ||
|
||
`barrier::try_wait_parity` returns a boolean representing whether the barrier is at the given phase | ||
|
||
<!-- TODO: Create an example when trunk is live on godbolt | ||
## Example | ||
```cuda | ||
#include <cuda/barrier> | ||
__global__ void example_kernel(cuda::barrier<cuda::thread_scope_block>& bar) { | ||
bar.wait_parity(false); | ||
} | ||
``` | ||
--> | ||
|
||
[See it on Godbolt](https://godbolt.org/z/dr4798Y76){: .btn } | ||
|
||
|
||
[`cuda::thread_scope`]: ./thread_scopes.md | ||
|
||
[thread.barrier.class paragraph 12]: https://eel.is/c++draft/thread.barrier.class#12 | ||
|
||
[coalesced threads]: https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#coalesced-group-cg | ||
|
||
[`concurrentManagedAccess` property]: https://docs.nvidia.com/cuda/cuda-runtime-api/structcudaDeviceProp.html#structcudaDeviceProp_116f9619ccc85e93bc456b8c69c80e78b | ||
[`hostNativeAtomicSupported` property]: https://docs.nvidia.com/cuda/cuda-runtime-api/structcudaDeviceProp.html#structcudaDeviceProp_1ef82fd7d1d0413c7d6f33287e5b6306f | ||
|