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

block_memcpy

def block_memcpy[dst_addr_space: AddressSpace, src_addr_space: AddressSpace, //, num_bytes: Int, block_size: Int, bypass_l2: Bool = False, unroll: Int = Int(1), src_invariant: Bool = True](dst_p: Pointer[UInt8, address_space=dst_addr_space], src_p: Pointer[UInt8, address_space=src_addr_space], thread_idx: Int)

Copies a memory area from source to destination. This function will use the vectorized store and load instructions to copy the memory area. User should make sure pointers are aligned to the simd width.

Set bypass_l2 when the destination is another agent's memory and the caller publishes with _publish_peer_stores. On MI355X the stores then carry system-scope cache bits and are visible as they complete; elsewhere the flag changes nothing and the caller's release fence publishes them.

Set unroll above 1 when few threads copy a long message (one warp per message): each thread then issues unroll independent loads before their stores, so their latencies overlap instead of adding up one per trip.

Clear src_invariant when the source bytes were stored earlier in the same launch: an invariant load (ld.global.nc on NVIDIA) tells the compiler the memory does not change while the kernel runs.

Was this page helpful?