Skip to main content

Mojo function

s_waitcnt_barrier

s_waitcnt_barrier[*, vmcnt: UInt32 = _WaitCountArg.MAX_VM_CNT, expcnt: UInt32 = _WaitCountArg.MAX_EXP_CNT, lgkmcnt: UInt32 = _WaitCountArg.MAX_LGKM_CNT]()

Performs an s_waitcnt followed by a barrier on AMD GPUs.

This function first waits until the number of outstanding memory operations matches the specified values (see s_waitcnt above), then forces all threads in the block to synchronize via a barrier. Only effective on AMD GPUs.

Note:

  • Only has an effect on AMD GPUs. On other platforms, raises a compile-time error if called.
  • Use this to guarantee memory visibility and thread ordering for precise synchronization.
  • For example, s_waitcnt_barrier(0,0,0) ensures all outstanding memory instructions are completed and then all threads are synchronized.

Parameters:

  • โ€‹vmcnt (UInt32): Waits until the remaining VMEM instructions is equal to this value (default: max).
  • โ€‹expcnt (UInt32): Waits until the remaining export (GDS) instructions is equal to this value (default: max).
  • โ€‹lgkmcnt (UInt32): Waits until the remaining LDS, GDS, constant-fetch, and message instructions is equal to this value (default: max).

Was this page helpful?