Expand description
Raw FFI bindings to the Modular MAX C API.
Generated by bindgen from the headers in max/include/max/c/.
These are opaque-struct-based bindings — you interact through
function pointers, not by reading struct fields directly.
For a safe, ergonomic API, use pyroxide instead.
Structs§
- M_
Async Compiled Model - M_
Async Model - M_
Async Tensor - M_
Async Tensor Map - M_
Compile Config - M_
Device - M_
Runtime Config - M_
Runtime Context - M_
Status - M_
Tensor Name Array - M_
Tensor Spec - M_
Weights Registry
Constants§
- M_
Allocator Type_ kCaching - M_
Allocator Type_ kSystem - M_
Device Type_ M_ ACCELERATOR - M_
Device Type_ M_ HOST - M_
Dtype_ M_ BFLOA T16 - Some slots are left blank here to enable us to support more lower precision types in the future.
- M_
Dtype_ M_ BOOL - Some slots are left blank here to enable us to support more lower precision types in the future.
- M_
Dtype_ M_ FLOA T4_ E2M1FN - Bits 0 through 3 indicate the kind of FP value.
- M_
Dtype_ M_ FLOA T8_ E3M4 - Some slots are left blank here to enable us to support more lower precision types in the future.
- M_
Dtype_ M_ FLOA T8_ E4M3FN - Some slots are left blank here to enable us to support more lower precision types in the future.
- M_
Dtype_ M_ FLOA T8_ E4M3FNUZ - Some slots are left blank here to enable us to support more lower precision types in the future.
- M_
Dtype_ M_ FLOA T8_ E5M2 - Some slots are left blank here to enable us to support more lower precision types in the future.
- M_
Dtype_ M_ FLOA T8_ E5M2FNUZ - Some slots are left blank here to enable us to support more lower precision types in the future.
- M_
Dtype_ M_ FLOA T8_ E8M0FNU - Some slots are left blank here to enable us to support more lower precision types in the future.
- M_
Dtype_ M_ FLOA T16 - Some slots are left blank here to enable us to support more lower precision types in the future.
- M_
Dtype_ M_ FLOA T32 - Some slots are left blank here to enable us to support more lower precision types in the future.
- M_
Dtype_ M_ FLOA T64 - Some slots are left blank here to enable us to support more lower precision types in the future.
- M_
Dtype_ M_ INT1 - Bit 0 encodes “isSigned”.
- M_
Dtype_ M_ INT2 - Bit 0 encodes “isSigned”.
- M_
Dtype_ M_ INT4 - Bit 0 encodes “isSigned”.
- M_
Dtype_ M_ INT8 - Bit 0 encodes “isSigned”.
- M_
Dtype_ M_ INT16 - Bit 0 encodes “isSigned”.
- M_
Dtype_ M_ INT32 - Bit 0 encodes “isSigned”.
- M_
Dtype_ M_ INT64 - Bit 0 encodes “isSigned”.
- M_
Dtype_ M_ INT128 - Bit 0 encodes “isSigned”.
- M_
Dtype_ M_ UINT1 - Bit 0 encodes “isSigned”.
- M_
Dtype_ M_ UINT2 - Bit 0 encodes “isSigned”.
- M_
Dtype_ M_ UINT4 - Bit 0 encodes “isSigned”.
- M_
Dtype_ M_ UINT8 - Bit 0 encodes “isSigned”.
- M_
Dtype_ M_ UINT16 - Bit 0 encodes “isSigned”.
- M_
Dtype_ M_ UINT32 - Bit 0 encodes “isSigned”.
- M_
Dtype_ M_ UINT64 - Bit 0 encodes “isSigned”.
- M_
Dtype_ M_ UINT128 - Bit 0 encodes “isSigned”.
- M_
Dtype_ M_ UNKNOWN - M_
Dtype_ kInt Width Shift - Bit 0 encodes “isSigned”.
- M_
Dtype_ mIsComplex - M_
Dtype_ mIsFloat - M_
Dtype_ mIsInteger - M_
Dtype_ mIsSigned - Bit 0 encodes “isSigned”.
- M_
Result Output Style_ M_ BINARY - M_
Result Output Style_ M_ BINARY_ MAX_ CHECKPOINT - M_
Result Output Style_ M_ COMPACT - M_
Result Output Style_ M_ FULL - M_
Result Output Style_ M_ NONE - M_
Value Type_ M_ BOOL_ VALUE - M_
Value Type_ M_ DICT_ VALUE - M_
Value Type_ M_ DOUBLE_ VALUE - M_
Value Type_ M_ LIST_ VALUE - M_
Value Type_ M_ LONG_ VALUE - M_
Value Type_ M_ MOJO_ VALUE - M_
Value Type_ M_ NONE_ VALUE - M_
Value Type_ M_ PYTHON_ MOJO_ VALUE - M_
Value Type_ M_ STRING_ VALUE - M_
Value Type_ M_ TENSOR_ VALUE - M_
Value Type_ M_ TUPLE_ VALUE - M_
Value Type_ M_ UNKNOWN_ VALUE
Functions§
- M_
borrow ⚠Tensor Into - Adds a tensor to the tensor map.
- M_
capture ⚠Model Sync - Captures model execution into a device graph for later replay.
- M_
compile ⚠Model - Compiles a model.
- M_
compile ⚠Model Sync - Synchronously compiles a model.
- M_
copy ⚠Tensor ToDevice - Copies a tensor to a different device.
- M_
debug ⚠Verify Replay Model Sync - Executes eagerly and verifies that the kernel launch trace matches a previously captured device graph.
- M_
execute ⚠Model Sync - Executes a model synchronously.
- M_
free ⚠Async Tensor Map - Deallocates the memory for the tensor map. No-op if
tensorMapisNULL. - M_
free ⚠Compile Config - Deallocates the memory for the compile config. No-op if
configisNULL. - M_
free ⚠Compiled Model - Deallocates the memory for the compiled model. No-op if
modelisNULL. - M_
free ⚠Device - Deallocates the memory for a device. No-op if
deviceisNULL. - M_
free ⚠Model - Deallocates the memory for the model. No-op if
modelisNULL. - M_
free ⚠Runtime Config - Deallocates the memory for a runtime config. No-op if
configisNULL. - M_
free ⚠Runtime Context - Deallocates the memory for a runtime context. No-op if
contextisNULL. - M_
free ⚠Status - Deallocates the memory for the status object. No-op if
statusisNULL. - M_
free ⚠Tensor - Deallocates the memory for the tensor. No-op if
tensoris NULL. - M_
free ⚠Tensor Name Array - Deallocates the memory for the array of tensor names. No-op if
namesisNULL. - M_
free ⚠Tensor Spec - Deallocates the memory for the tensor spec. No-op if
specisNULL. - M_
free ⚠Weights Registry - Deallocates the memory for the weights registry. No-op if
weightsRegistryisNULL. - M_
getAccelerator ⚠Count - Returns the number of available accelerator (GPU) devices.
- M_
getDevice ⚠Id - Gets the ID of a device.
- M_
getDevice ⚠IdFrom Spec - Gets the device ID from a tensor specification.
- M_
getDevice ⚠Label - Gets the label of a device (e.g., “cpu” or “gpu”).
- M_
getDevice ⚠Type - Gets the type of a device.
- M_
getDevice ⚠Type From Spec - Gets the device type from a tensor specification.
- M_
getDim ⚠At - Gets the element at a particular axis.
- M_
getDtype ⚠ - Gets the datatype from the tensor spec.
- M_
getError ⚠ - Gets an error message from the
M_Statusparameter. - M_
getName ⚠ - Gets the name of the tensor from the tensor spec.
- M_
getRank ⚠ - Gets the rank from the tensor spec.
- M_
getTensor ⚠ByName From - Gets a tensor from the tensor map by name.
- M_
getTensor ⚠Data - Gets a pointer to underlying data of the tensor.
- M_
getTensor ⚠Device - Gets the device on which a tensor resides.
- M_
getTensor ⚠NumElements - Gets the number of elements for the tensor.
- M_
getTensor ⚠Spec - Gets a Tensor Spec for the tensor.
- M_
getTensor ⚠Type - Gets the corresponding
M_Dtypefor the tensor. - M_
init ⚠Model - Sets up a model for execution.
- M_
isDynamic ⚠Ranked - Returns if the given spec has a dynamic rank.
- M_
isError ⚠ - Checks if status holds an error value.
- M_
isHost ⚠Device - Checks if the device is a host device.
- M_
newAsync ⚠Tensor Map - Creates a map of tensor names to async tensors.
- M_
newCompile ⚠Config - Creates an object you can use to configure model compilation.
- M_
newDevice ⚠ - Creates a device of the specified type and ID.
- M_
newRuntime ⚠Config - Creates a new runtime config.
- M_
newRuntime ⚠Context - Creates a runtime context.
- M_
newStatus ⚠ - Creates a new status object.
- M_
newTensor ⚠Spec - Creates a tensor specification.
- M_
newWeights ⚠Registry - Creates a weights registry from parallel arrays of weight names and data pointers.
- M_
replay ⚠Model Sync - Replays a previously captured device graph.
- M_
runtime ⚠Config AddDevice - Adds a device to be accessible from the runtime.
- M_
setDebug ⚠Print Options - Set the options for debugging printing of tensors when executing a model.
- M_
setModel ⚠Path - Sets the path to a model.
- M_
setMojo ⚠Define Bool - Sets a mojo compile-time define with an boolean value.
- M_
setMojo ⚠Define Int - Sets a mojo compile-time define with an integer value.
- M_
setMojo ⚠Define String - Sets a mojo compile-time define with an string value.
- M_
synchronize ⚠Device - Synchronizes the device, ensuring all operations complete.
- M_
version ⚠ - Gets the MAX Engine version.
- M_
wait ⚠ForCompilation - Blocks execution until the model is compiled.
- M_
wait ⚠ForModel - Blocks execution until the model is initialized.
Type Aliases§
- M_
Allocator Type - Contains an
AllocatorType. You can choose between kCaching and kSystem kCaching trades off higher memory usage for better performance. kSystem uses the default system allocator. - M_
Device Type - M_Dtype
- M_
Result Output Style - Represents the result output style for debug printing.
- M_
Value Type - Represents the type of a value.