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
Accelerator | Creates an accelerator device with the specified ID and memory limit. |
|---|---|
CompletionFlag | An 8-byte completion flag in pinned host memory mapped into a device's address space. |
CPU | Creates a CPU device. |
Device | Represents a compute device available for tensor operations. |
DeviceEvent | Provides access to an event object. |
DeviceQueue | Provides access to a queue of execution on a device. |
DeviceSpec | A device specification containing an ID and device type. |
Buffers
Buffer | Device-resident buffer representation. |
|---|---|
DLPackArray | Protocol for objects that exchange data through the DLPack interface. |
HostHazardError | Raised when host code waits on a completion whose producer failed. |
SymmetricPool | A driver-owned symmetric multicast pool shared by a set of devices. |
Usage | Allocation-intent descriptor for Buffer. |
Buffer operations
batch_inplace_copy | Copies srcs[i] into dsts[i] in as few driver submissions as possible. |
|---|---|
copy_pinned_to_destinations | Copies a host buffer into destination buffers safely. |
load_max_buffer | Experimental method for loading serialized MAX buffers. |
Device discovery
accelerator_api | Returns the API used to program the accelerator. |
|---|---|
accelerator_architecture_name | Returns the architecture name of the accelerator device. |
accelerator_count | Returns number of accelerator devices available. |
devices_exist | Returns True if all specified devices exist. |
enable_all_peer_access | Enables peer-to-peer memory access between all available GPU pairs. |
load_devices | Initializes and returns a list of Device objects from a sequence of DeviceSpec objects. |
scan_available_devices | Returns all available accelerators, or a CPU device if none are available. |
Launch tracing
LaunchTraceEntry | One operation recorded by max.driver.begin_launch_trace. |
|---|
Launch tracing functions
begin_launch_trace | Starts a process-global recording of enqueued device operations. |
|---|---|
launch_trace | Records the device operations enqueued within the with block. |
take_launch_trace | Stops the global recording and returns the recorded entries. |
Virtual devices
calculate_virtual_device_count | Calculates the minimum virtual device count needed for the given device specs. |
|---|---|
calculate_virtual_device_count_from_cli | Calculates the minimum virtual device count from raw CLI inputs (before parsing). |
get_virtual_cpu_target | Gets the current virtual CPU target. |
get_virtual_device_api | Gets the current target API for virtual devices. |
get_virtual_device_count | Gets the current virtual device count. |
get_virtual_device_target_arch | Gets the current target GPU architecture for virtual devices. |
is_virtual_device_mode | Checks if virtual device mode is currently enabled. |
set_virtual_cpu_target | Sets the CPU target for host-independent kernel codegen. |
set_virtual_device_api | Sets the target API for virtual devices in compile-only mode. |
set_virtual_device_count | Sets the number of virtual devices for device creation. |
set_virtual_device_target_arch | Sets the target GPU architecture for virtual devices in compile-only mode. |