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 struct
InplaceMemcpy
struct InplaceMemcpy[DstDevice: StringSlice[ImmStaticOrigin], SrcDevice: StringSlice[ImmStaticOrigin]]
Copies the contents of src into dst in place.
Semantically equivalent to Buffer.inplace_copy_from, but exposed
as a graph op so the copy can be scheduled as part of a compiled MAX
graph. Both operands must have the same dtype, rank, and total
element count.
Supports the four direction combinations expressible with a single
DeviceContext: GPU-to-GPU on the same device, GPU-to-CPU,
CPU-to-GPU, and CPU-to-CPU. Cross-GPU memcpy (different GPU ids) is
rejected by the Python wrapper at graph build time.
Parametersβ
- βDstDevice (
StringSlice[ImmStaticOrigin]): Device type of the destination buffer, for example,"gpu"or"cpu". - βSrcDevice (
StringSlice[ImmStaticOrigin]): Device type of the source buffer, for example,"gpu"or"cpu".
Implemented traitsβ
Methodsβ
executeβ
static def execute[target: StringSlice[ImmStaticOrigin], dtype: DType, rank: Int](dst: ManagedTensorSlice[IOSpec[_, _].MutableInput, static_spec=dst.static_spec], src: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=src.static_spec], ctx: DeviceContext)