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

s_waitcnt_barrier

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).