Skip to contents
  • mlx_disable_compile() prevents all compilation globally. Compiled functions will execute without optimization.

  • mlx_enable_compile() enables compilation (overrides the MLX_DISABLE_COMPILE environment variable).

Usage

mlx_disable_compile()

mlx_enable_compile()

Value

Invisibly returns NULL.

Details

These functions control whether MLX compilation is enabled globally.

These are useful for debugging (to check if compilation is causing issues) or benchmarking (to measure compilation overhead vs speedup).

You can also disable compilation by setting the MLX_DISABLE_COMPILE environment variable before loading the package.

Examples

if (FALSE) { # \dontrun{
# Disable compilation for debugging
mlx_disable_compile()
result <- compiled_fn(x)  # Runs without optimization

# Re-enable compilation
mlx_enable_compile()
result <- compiled_fn(x)  # Runs with optimization
} # }