2024-02-25 14:20:57 +08:00
|
|
|
// Copyright © 2023-2024 Apple Inc.
|
2023-12-01 03:12:53 +08:00
|
|
|
|
2023-11-30 02:30:41 +08:00
|
|
|
#include <stdexcept>
|
|
|
|
|
|
|
|
#include "mlx/backend/metal/metal.h"
|
2024-04-08 12:47:43 +08:00
|
|
|
#include "mlx/backend/metal/metal_impl.h"
|
2023-11-30 02:30:41 +08:00
|
|
|
namespace mlx::core::metal {
|
|
|
|
|
2024-02-25 14:20:57 +08:00
|
|
|
bool is_available() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-11-30 02:30:41 +08:00
|
|
|
void new_stream(Stream) {}
|
2024-04-17 21:16:02 +08:00
|
|
|
|
|
|
|
std::unique_ptr<void, std::function<void(void*)>> new_scoped_memory_pool() {
|
2023-12-23 03:01:26 +08:00
|
|
|
return nullptr;
|
|
|
|
}
|
2023-11-30 02:30:41 +08:00
|
|
|
|
2024-10-26 00:35:33 +08:00
|
|
|
std::function<void()> make_task(array, bool) {
|
2023-11-30 02:30:41 +08:00
|
|
|
throw std::runtime_error(
|
|
|
|
"[metal::make_task] Cannot make GPU task without metal backend");
|
|
|
|
}
|
|
|
|
|
2024-04-22 23:25:46 +08:00
|
|
|
std::function<void()> make_synchronize_task(
|
2024-10-26 00:35:33 +08:00
|
|
|
Stream,
|
|
|
|
std::shared_ptr<std::promise<void>>) {
|
2024-04-22 23:25:46 +08:00
|
|
|
throw std::runtime_error(
|
|
|
|
"[metal::make_synchronize_task] Cannot synchronize GPU"
|
|
|
|
" without metal backend");
|
|
|
|
}
|
|
|
|
|
2024-03-02 11:51:58 +08:00
|
|
|
// No-ops when Metal is not available.
|
|
|
|
size_t get_active_memory() {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
size_t get_peak_memory() {
|
|
|
|
return 0;
|
|
|
|
}
|
2024-05-04 08:12:51 +08:00
|
|
|
void reset_peak_memory() {}
|
2024-03-02 11:51:58 +08:00
|
|
|
size_t get_cache_memory() {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
size_t set_memory_limit(size_t, bool) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
size_t set_cache_limit(size_t) {
|
|
|
|
return 0;
|
2024-01-19 02:01:59 +08:00
|
|
|
}
|
2024-10-26 00:35:33 +08:00
|
|
|
size_t set_wired_limit(size_t) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void start_capture(std::string) {}
|
2024-03-29 00:40:31 +08:00
|
|
|
void stop_capture() {}
|
2024-04-25 07:48:51 +08:00
|
|
|
void clear_cache() {}
|
2024-01-19 02:01:59 +08:00
|
|
|
|
2024-05-01 06:47:27 +08:00
|
|
|
std::unordered_map<std::string, std::variant<std::string, size_t>>
|
|
|
|
device_info() {
|
|
|
|
throw std::runtime_error(
|
|
|
|
"[metal::device_info] Cannot get device info without metal backend");
|
|
|
|
};
|
|
|
|
|
2023-11-30 02:30:41 +08:00
|
|
|
} // namespace mlx::core::metal
|