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).

Python module

max.driver

Device programming for MAX: allocate buffers, manage devices, and dispatch work through device queues.

Devices​

AcceleratorCreates an accelerator device with the specified ID and memory limit.
CompletionFlagAn 8-byte completion flag in pinned host memory mapped into a device's address space.
CPUCreates a CPU device.
DeviceRepresents a compute device available for tensor operations.
DeviceEventProvides access to an event object.
DeviceQueueProvides access to a queue of execution on a device.
DeviceSpecA device specification containing an ID and device type.

Buffers​

BufferDevice-resident buffer representation.
DLPackArrayProtocol for objects that exchange data through the DLPack interface.
HostHazardErrorRaised when host code waits on a completion whose producer failed.
SymmetricPoolA driver-owned symmetric multicast pool shared by a set of devices.
UsageAllocation-intent descriptor for Buffer.

Buffer operations​

batch_inplace_copyCopies srcs[i] into dsts[i] in as few driver submissions as possible.
copy_pinned_to_destinationsCopies a host buffer into destination buffers safely.
load_max_bufferExperimental method for loading serialized MAX buffers.

Device discovery​

accelerator_apiReturns the API used to program the accelerator.
accelerator_architecture_nameReturns the architecture name of the accelerator device.
accelerator_countReturns number of accelerator devices available.
devices_existReturns True if all specified devices exist.
enable_all_peer_accessEnables peer-to-peer memory access between all available GPU pairs.
load_devicesInitializes and returns a list of Device objects from a sequence of DeviceSpec objects.
scan_available_devicesReturns all available accelerators, or a CPU device if none are available.

Launch tracing​

LaunchTraceEntryOne operation recorded by max.driver.begin_launch_trace.

Launch tracing functions​

begin_launch_traceStarts a process-global recording of enqueued device operations.
launch_traceRecords the device operations enqueued within the with block.
take_launch_traceStops the global recording and returns the recorded entries.

Virtual devices​

calculate_virtual_device_countCalculates the minimum virtual device count needed for the given device specs.
calculate_virtual_device_count_from_cliCalculates the minimum virtual device count from raw CLI inputs (before parsing).
get_virtual_cpu_targetGets the current virtual CPU target.
get_virtual_device_apiGets the current target API for virtual devices.
get_virtual_device_countGets the current virtual device count.
get_virtual_device_target_archGets the current target GPU architecture for virtual devices.
is_virtual_device_modeChecks if virtual device mode is currently enabled.
set_virtual_cpu_targetSets the CPU target for host-independent kernel codegen.
set_virtual_device_apiSets the target API for virtual devices in compile-only mode.
set_virtual_device_countSets the number of virtual devices for device creation.
set_virtual_device_target_archSets the target GPU architecture for virtual devices in compile-only mode.