MetalHardwareChecker

public class MetalHardwareChecker

This util class contains APIs that check the device’s hardware capabilities and limits accroding to Apple’s official docs.

Note

The limits values of each type of hardware device should be checked and updated with Apple’s doc frequently. If you find any mismatching with Apple’s official doc, please make a PR at github.
  • Maximum length of a data block for a function, per render or compute command encode

    Declaration

    Swift

    public static let MAX_BYTES_OF_DATA_BLOCK_PER_KERNEL = 4000
  • Undocumented

    Declaration

    Swift

    public static let MAX_BUFFER_SIZE_IN_BYTES = Int(2.56e+8)
  • Check if tesor’s data size largser thant MAX_BUFFER_SIZE_IN_BYTES

    Declaration

    Swift

    public static func tensorSizeFitCheck(tensor: Tensor) -> (result: Bool, info: String)

    Parameters

    tensor

    tensor

    Return Value

    • result: If fitting
    • info: Checking infomation
  • If current GPU support MetalPerformanceShaser

    Declaration

    Swift

    public static func supportMPS() -> Bool

    Return Value

    result bool