1pub fn set_param_sharing_scope(label: &str) {
57 #[cfg(feature = "cuda")]
58 rlx_cuda::vmem::set_scope_from_label(label);
59 #[cfg(not(feature = "cuda"))]
60 let _ = label;
61}
62
63pub mod aot_cache;
64pub mod attn_mask;
65pub mod backend;
66pub mod backends_manifest;
67pub mod browser;
68pub mod browser_support;
69pub mod capabilities;
70pub mod check;
71pub mod compile_cache;
72pub mod compile_config;
73pub mod compiled;
74#[cfg(all(feature = "coreml", feature = "training"))]
76pub mod coreml_training;
77pub mod cost;
78mod cpu_low_precision;
79mod deferred;
80pub mod device_bench;
81pub mod device_ext;
82pub mod device_parse;
83pub mod device_policy;
84pub mod dist;
86pub mod expert_pool;
87pub mod export;
88pub mod graph_io;
89pub mod hnsw;
90pub mod hot_expert_cache;
91#[cfg(feature = "hwprofile")]
92pub mod hwprofile_select;
93#[cfg(feature = "hwprofile")]
95pub mod arena_budget;
96pub mod jacfwd;
97pub mod kernel_trace;
98pub mod kv_cache;
99#[cfg(feature = "mmap-kv")]
100pub mod kv_context_store;
101pub mod kv_metrics;
102pub mod kv_retention;
103pub mod lora_scheduler;
104pub mod memory_estimate;
105pub mod model_pipeline;
106pub mod moe_expert_store;
107pub mod obs;
111pub mod onnx_active;
112pub mod op_registry;
113pub mod options;
114pub mod paged_kv;
115pub mod pkg;
116pub mod precision;
117pub mod precompile;
118pub mod quantized_kv;
119pub mod record_replay;
120pub mod reflect;
121pub mod registry;
122pub mod resource_budget;
123pub mod router;
124pub mod samplers;
125pub mod session;
126pub mod stages;
127pub mod subgraph;
128pub mod trace;
129pub mod weight_registry;
130pub mod weights;
131pub mod worker_pool;
132pub use rlx_ir::perfetto;
137pub mod custom_ops;
138pub mod device_router;
139pub mod flexible_session;
140pub mod graph_devices;
141pub mod hetero;
142pub mod hwinfo;
143pub mod lm;
144pub mod logit_verify;
145pub mod nan_check;
146pub mod phase;
147pub mod spec_decode;
148pub mod telemetry;
149pub mod validators;
150
151pub mod mock_requests;
154
155pub use rlx_driver::{Buffer, BufferHandle, CommandStream, Device, DeviceArena, SyncStream};
157pub use rlx_driver::{
159 CollectiveError, LocalTransport, Rank, SymmetricBuffer, SymmetricHeap, SymmetricTransport,
160};
161pub use aot_cache::{AotCache, AotCacheError};
163#[cfg(feature = "hwprofile")]
164pub use arena_budget::{arena_budget, device_arena_limit, fit_batch, plan_arena_bytes};
165pub use backend::{Backend, ExecutableGraph, compile_hir, compile_module};
166pub use backends_manifest::BackendsManifest;
167pub use browser::{
168 BrowserCompiledGraph, BrowserError, BrowserSession, browser_block_reason, init_webgpu,
169 supports_browser_graph,
170};
171pub use browser_support::{
172 collective_block_reason, passes_browser_preflight, select_browser_device_for_graph,
173};
174pub use capabilities::ExecutableCapabilities;
175pub use compile_cache::{
176 BucketedCompileCache, CacheRunInput, CompileCache, DynamicDimCompileCache, pad_rows, slice_rows,
177};
178pub use compile_config::{
179 COMPILE_OUTPUT_CAP_ENV, COMPILE_OUTPUT_CAP_ENV_MLX, DEFAULT_COMPILE_OUTPUT_CAP,
180 compile_output_cap, device_has_compile_output_cap, reset_compile_output_cap,
181 set_compile_output_cap,
182};
183pub use compiled::CompiledGraph;
184#[cfg(all(feature = "coreml", feature = "training"))]
185pub use coreml_training::{
186 CoremlTrainingSession, MlUpdateEligibility, Optimizer, StepReport, TrainConfig, UpdatePath,
187};
188pub use cost::fastest_device_for;
189pub use device_bench::{DeviceBenchResult, benchmark_devices, warm_all};
190#[cfg(feature = "apple")]
191pub use device_ext::available_apple_devices;
192pub use device_ext::{
193 BROWSER_DEVICE_PRIORITY, available_browser_devices, available_devices,
194 detected_unavailable_devices, devices_for, dispatch_report_for_device,
195 dispatch_report_for_device_with_options, fastest_device, feature_compiled,
196 first_unsupported_op, first_unsupported_op_with_options, full_name, is_available,
197 legalize_graph_for_device, legalize_graph_for_device_with_options,
198 legalize_graph_for_device_with_report, preferred_browser_device, supports, supports_graph,
199 supports_graph_with_options, supports_run_slots, trim_accelerator_arena_pool,
200};
201pub use device_parse::{ParseDeviceError, device_label, parse_device, parse_device_list};
202pub use device_policy::{
203 DeviceCandidate, DeviceFallbackError, DevicePickStrategy, DevicePolicy, advisory_capabilities,
204 device_chain_from_env, device_chain_from_env_key, device_from_env, device_from_env_key,
205 device_report, devices_for_with_policy, resolve_device, resolve_device_chain,
206 run_with_fallback,
207};
208pub use device_router::DeviceRouter;
209pub use expert_pool::{
210 ExpertPool, ExpertPoolConfig, ExpertPoolStats, ExpertRefreshPolicy, ExpertRefreshResult,
211 HysteresisConfig, MoEExecMode, gpu_expert_budget_from_vram,
212};
213pub use export::{ExportOptions, ExportTarget, ExportedArtifacts, export_graph};
214#[cfg(feature = "fpga")]
215pub use export::{ExportSession, export_tinyconv_mnist};
216pub use flexible_session::FlexibleSession;
217pub use graph_devices::{GraphDevices, graph_param_names};
218pub use hetero::{DeviceMap, HeteroExecutable};
219pub use hot_expert_cache::{HotExpertCache, SlotLoad, SlotRoute, reconcile_layers};
220pub use hwinfo::{
221 GpuThermal, HwSnapshot, ThermalError, ThermalState, all_gpu_thermal, device_thermal,
222 device_thermal_count, power_cap_range, reset_fan, reset_locked_clocks, set_fan_percent,
223 set_locked_clocks, set_power_cap,
224};
225#[cfg(feature = "hwprofile")]
226pub use hwprofile_select::{device_vram_bytes, fastest_device_with_vram};
227pub use kv_cache::LayerKvCache;
228pub use lm::{
229 ConfigSource, LmRunner, LmRunnerBuilder, MirostatMode, ModelRegistration,
230 PACKED_GGUF_AUTO_THRESHOLD_BYTES, SampleOpts, WeightFormat, auto_runner_name,
231 registered_models,
232};
233pub use memory_estimate::{
234 DEFAULT_SOFT_MEMORY_FRACTION, MoeOffloadEstimate, available_unified_memory,
235 estimate_moe_offload, llama_decode_bucket_compile_peak_bytes,
236 llama_decode_bucket_resident_bytes, llama_decode_oneshot_compile_peak_bytes,
237 memory_headroom_bytes, process_rss_bytes, soft_memory_budget_bytes, soft_memory_fraction,
238 would_exceed_soft_budget,
239};
240pub use model_pipeline::ModelCompilePipeline;
241pub use options::CompileOptions;
242pub use precision::Precision;
243pub use reflect::{ModelReflection, load_hir_template_with_extensions, specialize_entry};
244pub use registry::{BackendFactory, backend_for, register_backend, registered_devices};
245pub use rlx_opt::rlx_compile::scaled_quant_insert::ScaledQuantConfig;
247
248pub const MLX_COMPILE_OUTPUT_CAP_ENV: &str = COMPILE_OUTPUT_CAP_ENV;
250
251pub const DEFAULT_MLX_COMPILE_OUTPUT_CAP: usize = DEFAULT_COMPILE_OUTPUT_CAP;
253
254#[inline]
256pub fn mlx_compile_output_cap() -> usize {
257 compile_output_cap()
258}
259
260#[inline]
262pub fn set_mlx_compile_output_cap(cap: usize) {
263 set_compile_output_cap(cap);
264}
265
266#[inline]
268pub fn reset_mlx_compile_output_cap() {
269 reset_compile_output_cap();
270}
271
272#[cfg(feature = "cpu")]
273pub use rlx_cpu::moe_residency::MoeResidencyStats;
274#[cfg(not(feature = "cpu"))]
279#[derive(Debug, Clone, Default)]
280pub struct MoeResidencyStats;
281pub use pkg::{
282 compile_rlxp, compile_rlxp_bind_params, compile_rlxp_with, load_rlxp_graph,
283 load_rlxp_placement, open_rlxp, tensors_for_rank, weight_names_for_rank,
284};
285#[cfg(feature = "cpu")]
286pub use rlx_cpu::moe_topk_capture::MoeTopkCapture;
287pub use rlx_driver::{
288 DEFAULT_HEAP_BYTES, NetTransport, ProcessGroup, TcpTransport, ThunderboltTransport, Transport,
289};
290pub use rlx_driver::{
291 ReduceKind, ReduceMode, all_gather, all_reduce, env_reduce_mode, reduce_scatter,
292};
293pub use rlx_ir::env::{self, RlxEnv, RuntimeOverrides};
294pub use rlx_ir::{EnvVarDoc, format_env_catalog, public_catalog_docs as ENV_CATALOG};
295pub use rlx_pkg::{MaterializeMode, Package, Placement};
298pub use session::Session;
299pub use stages::{
300 compile_graph_stages, compile_graph_stages_for_backend, compile_hir_stages,
301 compile_module_stages, fusion_target_for, graph_from_lir, maybe_log_fusion,
302 options_with_supported_ops, pipeline_for,
303};
304pub use subgraph::{SubgraphCache, run_if, run_while};
305
306pub use expert_pool::{merged_resident_mask, per_layer_resident_masks};
307pub use moe_expert_store::{ExpertStackF32, LayerMoeWeights, MoeExpertStore};
308pub use weight_registry::{WeightEntry, WeightHandle, WeightKind, WeightRegistry};
309pub use weights::{BytesWeightLoader, WeightLoader};
310
311pub use rlx_ir::{AsyncCopy, BarrierToken, DoubleBuffer, SyncCopy};
315pub use rlx_ir::{CacheBuster, Tick, time_ns};
316
317pub use rlx_ir::{
319 inspect_graph, inspect_hir, inspect_hir_stats, inspect_lir, inspect_mir, inspect_mir_stats,
320};
321pub use rlx_opt::FusionOptions;
324pub use rlx_opt::{OpKind, PrecisionPolicy};
325pub use rlx_opt::{PipelineInspect, inspect_pipeline};
326
327pub use rlx_ir::logical_kernel::{KernelDispatchConfig, KernelDispatchPolicy};
329pub use rlx_ir::op;
330pub use rlx_ir::{
331 BindingManifest, CompilationMode, DType, Graph, HirExtensionFn, HirReflection, IoBindingEntry,
332 ManifestDiff, ModelComponent, ModelPhase, ModelVariant, Node, NodeId, Op, RngBackend,
333 RngOptions, Shape, WeightBlock, apply_hir_extensions, register_hir_extension,
334 registered_hir_extensions,
335};
336
337pub use rlx_macros::pipeline_schedule;
339pub use rlx_macros::rlx_model;