IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Mojo function

s_waitcnt_barrier

def s_waitcnt_barrier[*, vmcnt: UInt32 = UInt32(63), expcnt: UInt32 = UInt32(7), lgkmcnt: UInt32 = UInt32(15)]()

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?