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

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

Was this page helpful?