For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).
Mojo struct
WaitHostValueWithDep
struct WaitHostValueWithDep
Variant of mo.wait_host_value that takes a fake mutable dependency operand.
Behaves identically to mo.wait_host_value at runtime -- the dep
tensor is never read or written by the kernel body -- but the
graph compiler sees dep as mutated by this op, which forces any
downstream op that consumes dep (e.g. mo.inplace_memcpy(scratch, dep)) to chain after this wait.
Use this when you need the wait to gate a cuStreamWaitValue64
followed by an inplace_memcpy of the buffer the host callback
fills: without a shared mutable operand the two custom ops carry no
data dependency and the graph compiler / cuGraph capture is free to
parallelise them, so the memcpy can read stale pinned data before
the worker signals the flag.
Implemented traitsโ
Methodsโ
executeโ
static def execute[target: StringSlice[ImmStaticOrigin], dep_dtype: DType, dep_rank: Int](payload: ManagedTensorSlice[IOSpec[_, _].MutableInput, static_spec=payload.static_spec], dep: ManagedTensorSlice[IOSpec[_, _].MutableInput, static_spec=dep.static_spec], ctx: DeviceContext)
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!