mirror of
https://github.com/ml-explore/mlx.git
synced 2025-09-19 19:38:16 +08:00
Lazy metal_device_ initialization (#185)
This ensures it is defined when the Scheduler needs it.
This commit is contained in:
@@ -17,8 +17,6 @@ namespace fs = std::filesystem;
|
||||
|
||||
namespace mlx::core::metal {
|
||||
|
||||
static Device metal_device_;
|
||||
|
||||
namespace {
|
||||
|
||||
// TODO nicer way to set this or possibly expose as an environment variable
|
||||
@@ -240,6 +238,7 @@ MTL::ComputePipelineState* Device::get_kernel(
|
||||
}
|
||||
|
||||
Device& device(mlx::core::Device) {
|
||||
static Device metal_device_;
|
||||
return metal_device_;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user