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

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

Performs an s_waitcnt instruction with the specified counters on AMD GPUs.

This function waits until the number of remaining outstanding memory operations matches the given counter values: vector (vmcnt), export (expcnt), and LGKM (local/global/memory/constant, lgkmcnt). It does not wait for this many instructions to complete, but for the counters to have these exact values before proceeding.

Only effective on AMD GPUs.

Note:

  • Only has an effect on AMD GPUs. On other platforms, raises a compile-time error if called.
  • The counters should be set carefully to avoid deadlocks or missed synchronization.
  • For example, s_waitcnt(vmcnt=0, expcnt=0, lgkmcnt=0) waits until all memory operations are complete.

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