Skip to main content
Log in

Mojo module

semaphore

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 var lock = UnsafePointerInt32 var sem = Semaphore(lock, thread_id)

# Wait for a specific state
sem.wait(0)

# Release the semaphore
sem.release(1)
```
# Wait for a specific state
sem.wait(0)

# Release the semaphore
sem.release(1)
```

Structs

  • Semaphore: A device-wide semaphore implementation for GPUs.