Mojo function
named_barrier
named_barrier[num_threads: SIMD[int32, 1], id: SIMD[int32, 1] = __init__[__mlir_type.!pop.int_literal](0)]()
Performs a named synchronization barrier at the block level.
This function creates a synchronization point using a specific barrier ID, allowing for multiple independent barriers within a thread block. All threads in the block must execute this function with the same barrier ID and thread count before any thread can proceed past the barrier.
Notes:
- Only supported on NVIDIA GPUs.
- Maps directly to the `nvvm.barrier` instruction.
- Useful for fine-grained synchronization when different subsets of threads
need to synchronize independently.
- The barrier ID must not exceed 16.
- All threads participating in the barrier must specify the same num_threads value.
- Only supported on NVIDIA GPUs.
- Maps directly to the `nvvm.barrier` instruction.
- Useful for fine-grained synchronization when different subsets of threads
need to synchronize independently.
- The barrier ID must not exceed 16.
- All threads participating in the barrier must specify the same num_threads value.
Parameters:
- num_threads (
SIMD[int32, 1]
): The number of threads that must reach the barrier before any can proceed. - id (
SIMD[int32, 1]
): The barrier identifier (0-16). Default is 0.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!