Essentials

Versions and Support

Metal.metal_targetFunction
Metal.metal_target(macos=macos_version())::VersionNumber

Returns the Metal Shading Language version Metal.jl emits by default, which tracks the host-supported version (see Metal.metal_support) to expose the newest intrinsics.

source
Metal.air_targetFunction
Metal.air_target(macos=macos_version())::VersionNumber

Returns the embedded-AIR-bitcode version Metal.jl emits by default, which tracks the host-supported version (see Metal.air_support).

source

Global State

Metal.device!Function
device!(dev::MTLDevice)

Sets the Metal GPU device associated with the current Julia task.

source
Metal.deviceFunction
device()::MTLDevice

Return the Metal GPU device associated with the current Julia task.

Since all M-series systems currently only externally show a single GPU, this function effectively returns the only system GPU.

source
device(<:MtlArray)

Get the Metal device for an MtlArray.

source
Metal.global_queueFunction
global_queue(dev::MTLDevice)::MTLCommandQueue

Return the Metal command queue associated with the current Julia thread.

source
Metal.synchronizeFunction
synchronize(queue::MTLCommandQueue=global_queue(device()))

Wait for currently committed GPU work on queue to finish.

source
synchronize(cmdbuf::MTLCommandBufferLike)

Wait for cmdbuf (which must already have been committed) and all preceding work on the same queue to complete.

source