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.
UsageAllocation-intent descriptor for Buffer.

Buffer operations​

batch_inplace_copyCopies srcs[i] into dsts[i] in as few driver submissions as possible.
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_countaccelerator_count() -> int
devices_existReturns True if all specified devices exist.
enable_all_peer_accessenable_all_peer_access() -> None
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_tracebegin_launch_trace() -> None
launch_traceRecords the device operations enqueued within the with block.
take_launch_tracetake_launch_trace() -> list[max.driver.LaunchTraceEntry]

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_targetget_virtual_cpu_target() -> str
get_virtual_device_apiget_virtual_device_api() -> str
get_virtual_device_countget_virtual_device_count() -> int
get_virtual_device_target_archget_virtual_device_target_arch() -> str
is_virtual_device_modeis_virtual_device_mode() -> bool
set_virtual_cpu_targetstr) -> None
set_virtual_device_apistr) -> None
set_virtual_device_countint) -> None
set_virtual_device_target_archstr) -> None