|
Mila 0.13.48
Deep Neural Network Library
|
Metal device plugin for device-agnostic registration. More...
Static Public Member Functions | |
| static int | getDeviceCount () |
| Gets the number of available Metal devices. | |
| static std::string | getPluginName () |
| Gets the plugin name identifying the Metal device type. | |
| static bool | hasDefaultDevice () |
| Gets the default Metal device. | |
| static bool | isAvailable () |
| Checks if the Metal framework is available and functional. | |
| static bool | isMPSAvailable () |
| Checks if Metal Performance Shaders are available. | |
| static void | registerDevices () |
| Registers all available Metal devices with the DeviceRegistry. | |
Static Private Member Functions | |
| static bool | isDeviceUsable (void *device) |
| Checks if a specific Metal device is usable for computation. | |
Metal device plugin for device-agnostic registration.
This plugin encapsulates all Metal-specific logic for device discovery and registration, providing a clean static interface to the DeviceRegistrar while handling Metal framework API interactions internally.
Key responsibilities:
|
inlinestatic |
Gets the number of available Metal devices.
|
inlinestatic |
Gets the plugin name identifying the Metal device type.
|
inlinestatic |
Gets the default Metal device.
Returns information about the system's default Metal device, which is typically the primary GPU.
|
inlinestatic |
Checks if the Metal framework is available and functional.
Performs a lightweight check to determine if Metal operations can be performed. This is useful for early detection of Metal availability without attempting full device enumeration.
|
inlinestaticprivate |
Checks if a specific Metal device is usable for computation.
Performs device-specific capability checking to ensure the device meets minimum requirements for neural network operations. This includes feature set validation and memory availability checks.
| device | Metal device to check |

|
inlinestatic |
Checks if Metal Performance Shaders are available.
Metal Performance Shaders (MPS) provide optimized neural network primitives for Apple Silicon and other Metal-capable devices.
|
inlinestatic |
Registers all available Metal devices with the DeviceRegistry.
Performs Metal framework initialization, enumerates available Metal devices, and registers each device with an appropriate factory function. Handles Metal unavailability gracefully without throwing exceptions.
Device naming convention: "Metal:N" where N is the device index (0-based)
