allow compiling lambdas in C++ (#1650)

* allow compiling lambdas in C++

* fix test

* more tests

* auto detect capture-less lambda
This commit is contained in:
Awni Hannun
2024-12-06 13:13:21 -08:00
committed by GitHub
parent fd3377dd1f
commit 69a2991614
4 changed files with 115 additions and 12 deletions

View File

@@ -9,7 +9,7 @@ namespace mlx::core::detail {
// This is not part of the general C++ API as calling with a bad id is a bad
// idea.
std::function<std::vector<array>(const std::vector<array>&)> compile(
const std::function<std::vector<array>(const std::vector<array>&)>& fun,
std::function<std::vector<array>(const std::vector<array>&)> fun,
std::uintptr_t fun_id,
bool shapeless = false,
std::vector<uint64_t> constants = {});