mod bindings;
mod compile;
mod metal;
mod operations;
mod runtime;
mod types;
pub mod error;
pub mod raw;
pub use bindings::context::MlxBindingsContext;
pub use compile::elementwise_graphs::MlxCompiledElementwiseGraphs;
pub use compile::gated_delta_rate_activation::MlxCompiledGatedDeltaRateActivation;
pub use compile::graph::{
MlxGraphBuilder, array_from_vector, graph_output_array, set_graph_output,
set_graph_output_vector,
};
pub use compile::multi_output_graph::MlxCompiledMultiOutputGraph;
pub use compile::norm_fusion::MlxCompiledDualHeadNorm;
pub use compile::swiglu::MlxCompiledSwiGlu;
pub use compile::transforms::{
MlxCompileCache, disable_compile, enable_compile, jvp_of_closure, set_compile_mode,
value_and_grad_of_closure, vjp_of_closure, vmap_replace, vmap_trace,
};
pub use error::{
MlxCError, check_status, clear_captured_mlx_error, install_non_terminating_error_handler,
take_captured_mlx_error,
};
pub use metal::cuda_kernel::{MlxCudaKernel, MlxCudaKernelConfig};
pub use metal::kernel::{
MlxMetalKernel, MlxMetalKernelConfig, MlxMetalKernelOutput, MlxMetalKernelTemplateArgument,
apply_metal_kernel_in_graph,
};
pub use metal::metallib::set_metallib_path;
pub use runtime::export::{
GraphOutputFile, MlxFunctionExporter, MlxImportedFunction, MlxNodeNamer, export_function,
export_function_with_keywords, export_graph_to_dot, print_graph,
};
pub use runtime::io::{
MlxIoGguf, MlxIoReader, MlxIoWriter, load_array_from_reader, load_safetensors,
load_safetensors_from_reader, save_array_to_writer, save_safetensors,
save_safetensors_to_writer,
};
pub use runtime::memory::{
active_memory_bytes, cache_memory_bytes, clear_allocator_cache, memory_limit_bytes,
peak_memory_bytes, reset_peak_memory, set_cache_limit, set_memory_limit, synchronize,
};
pub use runtime::platform::{
MlxDistributedGroup, cuda_is_available, distributed_is_available, initialize_distributed,
metal_is_available, metallib_path, set_wired_limit,
};
pub use runtime::stream_defaults::{
MlxStreamThreadLocal, clear_streams, set_default_stream, synchronize_all_defaults,
};
pub use types::array::{MlxArray, MlxDtype};
pub use types::array_vector::MlxArrayVector;
pub use types::closure_custom::{MlxClosureCustom, MlxClosureCustomJvp, MlxClosureCustomVmap};
pub use types::closures::{MlxClosure, MlxClosureKwargs, MlxClosureValueAndGrad};
pub use types::device::{MlxDeviceHandle, MlxDeviceInfo};
pub use types::maps::{
MlxMapStringToArray, MlxMapStringToArrayIterator, MlxMapStringToString,
MlxMapStringToStringIterator,
};
pub use types::stream::MlxStream;
pub use types::string::MlxString;
pub use types::vectors::{MlxVectorInt, MlxVectorStream, MlxVectorString, MlxVectorVectorArray};