semaphore | Modular
Mojo module
This module provides a device-wide semaphore implementation for NVIDIA GPUs.
The Semaphore struct enables inter-CTA (Cooperative Thread Array) synchronization by providing atomic operations and memory barriers. It uses NVIDIA-specific intrinsics to implement efficient thread synchronization.
Example:
```mojo
from gpu import Semaphore
var lock = UnsafePointer[Int32](...)
var sem = Semaphore(lock, thread_id)
# Wait for a specific state
sem.wait(0)
# Release the semaphore
sem.release(1)
```Structs
-
NamedBarrierSemaphore: A device-wide semaphore implementation for NVIDIA GPUs with named barriers. -
Semaphore: A device-wide semaphore implementation for GPUs.