Skip to main content

Module tensor_kernels

Module tensor_kernels 

Source
Expand description

Safe-ish wrappers around the CUDA block/universal packing kernels.

The core ideas:

  • A “block” represents the stack of nl * no tensors arranged either as NHD (inner axes [nt, nh, hd]) or HND (inner axes [nh, nt, hd]).
  • A “universal” tensor is [nh, nl, no, nt, hd] stored contiguously.
  • An “operational” tensor is [nl, no, inner] with inner = nt * nh * hd.

All pointer-list parameters (e.g. universal_ptrs, src_ptrs) must be device-accessible: allocated via cudaMalloc (device memory) or cudaMallocHost / cuMemHostRegister (pinned/registered/page-locked host memory).

Host code calls these helpers with flattened pointer tables so a single launch can move many logical blocks in one go.

Enums§

MemcpyBatchMode
Controls how memcpy_batch dispatches copies.

Functions§

is_memcpy_batch_available
Check if cudaMemcpyBatchAsync is available.
is_using_stubs
Check if this library was built with stub kernels (no real CUDA).
memcpy_batch
Batched memcpy using cudaMemcpyBatchAsync (CUDA 12.9+) and/or individual cudaMemcpyAsync.
vectorized_copy
Launch vectorized copy between arbitrary device-visible pointer pairs.