2024-02-05 22:51:22 +08:00
|
|
|
// Copyright © 2023-2024 Apple Inc.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "mlx/array.h"
|
|
|
|
|
|
|
|
namespace mlx::core {
|
|
|
|
|
|
|
|
enum class CompileMode { disabled, no_simplify, no_fuse, enabled };
|
|
|
|
|
2024-02-20 13:43:54 +08:00
|
|
|
/** Compile takes a function and returns a compiled function. */
|
2024-02-05 22:51:22 +08:00
|
|
|
std::function<std::vector<array>(const std::vector<array>&)> compile(
|
2024-02-20 13:43:54 +08:00
|
|
|
const std::function<std::vector<array>(const std::vector<array>&)>& fun,
|
|
|
|
bool shapeless = false);
|
2024-02-05 22:51:22 +08:00
|
|
|
|
|
|
|
/** Globally disable compilation.
|
|
|
|
* Setting the environment variable ``MLX_DISABLE_COMPILE`` can also
|
|
|
|
* be used to disable compilation.
|
|
|
|
*/
|
|
|
|
void disable_compile();
|
|
|
|
|
|
|
|
/** Globally enable compilation.
|
|
|
|
* This will override the environment variable ``MLX_DISABLE_COMPILE``.
|
|
|
|
*/
|
|
|
|
void enable_compile();
|
|
|
|
|
|
|
|
/** Set the compiler mode to the given value. */
|
|
|
|
void set_compile_mode(CompileMode mode);
|
|
|
|
} // namespace mlx::core
|