Class representing a Metal compute device instance.
More...
Class representing a Metal compute device instance.
This class provides an interface to interact with a specific Apple Metal-capable GPU within the Mila framework. It handles device properties and capabilities for a single device instance. Device discovery and registration is handled by MetalDevicePlugin. Device activation and context management is handled by the DeviceContext class.
◆ MetalDevice()
| Mila::Dnn::Compute::MetalDevice::MetalDevice |
( |
int | device_index | ) |
|
|
inlineexplicit |
Constructs a MetalDevice with specified device index.
- Parameters
-
| device_index | The Metal device index to initialize. |
◆ getDeviceId()
| DeviceId Mila::Dnn::Compute::MetalDevice::getDeviceId |
( |
| ) |
const |
|
inlineoverride |
Gets the CUDA device ID.
- Returns
- int The device ID for this CUDA device (0-based)
◆ getDeviceIndex()
| int Mila::Dnn::Compute::MetalDevice::getDeviceIndex |
( |
| ) |
const |
|
inline |
Gets the Metal device index.
- Returns
- int The device index for this Metal device.
◆ getDeviceMemorySize()
| size_t Mila::Dnn::Compute::MetalDevice::getDeviceMemorySize |
( |
| ) |
const |
|
inline |
Gets device memory information.
- Returns
- size_t Available device memory in bytes, or 0 if unavailable.
◆ getDeviceName()
| std::string Mila::Dnn::Compute::MetalDevice::getDeviceName |
( |
| ) |
const |
|
inlineoverride |
Gets the name of this Metal device.
- Returns
- std::string The device name in format "Metal:<device_index>" or actual device name if available.
◆ getDeviceType()
| DeviceType Mila::Dnn::Compute::MetalDevice::getDeviceType |
( |
| ) |
const |
|
inlineconstexproverride |
Gets the type of this compute device.
- Returns
- DeviceType The device type (Metal).
◆ getMaxThreadsPerThreadgroup()
| size_t Mila::Dnn::Compute::MetalDevice::getMaxThreadsPerThreadgroup |
( |
| ) |
const |
|
inline |
Gets the maximum threads per threadgroup.
- Returns
- size_t Maximum threads per threadgroup, or 0 if unavailable.
◆ getNativeDevice()
| void * Mila::Dnn::Compute::MetalDevice::getNativeDevice |
( |
| ) |
const |
|
inline |
Gets the raw Metal device handle.
- Returns
- Native Metal device handle (id<MTLDevice> on Apple platforms, nullptr elsewhere)
- Note
- This returns a platform-specific handle for advanced Metal operations
-
Returns nullptr on non-Apple platforms
◆ getRecommendedMaxWorkingSetSize()
| size_t Mila::Dnn::Compute::MetalDevice::getRecommendedMaxWorkingSetSize |
( |
| ) |
const |
|
inline |
Gets the recommended maximum working set size.
- Returns
- size_t Recommended maximum working set size in bytes, or 0 if unavailable.
◆ isMPSSupported()
| bool Mila::Dnn::Compute::MetalDevice::isMPSSupported |
( |
| ) |
const |
|
inline |
Checks if the device supports Metal Performance Shaders.
- Returns
- bool True if MPS is supported, false otherwise.
◆ isUnifiedMemorySupported()
| bool Mila::Dnn::Compute::MetalDevice::isUnifiedMemorySupported |
( |
| ) |
const |
|
inline |
Checks if the device supports unified memory.
- Returns
- bool True if unified memory is supported, false otherwise.
◆ supportsComputeShaders()
| bool Mila::Dnn::Compute::MetalDevice::supportsComputeShaders |
( |
| ) |
const |
|
inline |
Checks if the device supports compute shaders.
- Returns
- bool True if compute shaders are supported, false otherwise.
◆ supportsGPUFamily()
| bool Mila::Dnn::Compute::MetalDevice::supportsGPUFamily |
( |
| ) |
const |
|
inline |
Checks if the device supports specific Metal GPU family.
- Returns
- bool True if the specified GPU family is supported, false otherwise.
◆ device_index_
| int Mila::Dnn::Compute::MetalDevice::device_index_ |
|
private |
◆ device_name_
| std::string Mila::Dnn::Compute::MetalDevice::device_name_ |
|
private |
The documentation for this class was generated from the following file: