jax.experimental.pallas.mosaic_gpu.semaphore_wait

Contents

jax.experimental.pallas.mosaic_gpu.semaphore_wait#

jax.experimental.pallas.mosaic_gpu.semaphore_wait(semaphore, value=1, *, decrement=True, memory_scope='sys')[source]#

Waits on a semaphore until it reaches at least value.

This is the MGPU specific variant of pallas.semaphore_wait(), which additionally exposes the memory_scope of the underlying atomic.

Parameters:
  • semaphore – The semaphore reference to wait on.

  • value (int | jax.Array) – The target value that the semaphore should reach before unblocking.

  • decrement (bool) – Whether to decrement the semaphore by value once the wait succeeds.

  • memory_scope (Literal['sys', 'gpu']) – The memory scope of the underlying atomic. Must be "sys" or "gpu". Defaults to "sys".