mirror of
https://github.com/ml-explore/mlx.git
synced 2025-08-09 02:36:42 +08:00
Lazy metal_device_ initialization (#185)
This ensures it is defined when the Scheduler needs it.
This commit is contained in:
parent
f24200db2c
commit
83f266c44c
@ -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_;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user