

sitofp rewritten to AIR-specific intrinsicĭefine void i8 addrspace(1)*, } addrspace(1)* %array, %thread_position_in_grid argument added Target triple = "air64-apple-macosx13.0.0" If i threads=512 grid=2 memset_kernel(a, 42) A small demonstration: # a simple kernel that sets elements of an array to a value Metal.jl's array operations are implemented in Julia, using our native kernel programming capabilities and accompanying JIT-compiler. As a result, MtlArray is already pretty capable, and should be usable with realistic array-based applications. Much of this functionality comes from the GPUArrays.jl package, which provides vendor-neutral implementations of common array operations. # perform some GPU-accelerated operationsīeyond these simple operations, Julia's higher-order array abstractions can be used to express more complex operations without ever having to write a kernel: julia> mapreduce(sin, +, a dims=1) The abstraction centers around the MtlArray type that can be used to manage memory and perform GPU computations: # allocate + initialize

Just like our other GPU back-ends, Metal.jl offers an array abstraction that greatly simplifies GPU programming. macOS Monterey with an Intel GPU, but it's an untested combination that may suffer from bugs. These choices were made to simplify development, and aren't technical limitations. We also only support M-series GPUs, even though Metal does support other GPUs. call the versioninfo() method for some details on the toolchain: julia> using MetalĪnd there we go! You'll note here that I'm using the upcoming macOS 13 (Ventura) this is currently the only supported operating system.

Then, leave the package manager by pressing backspace, import the Metal package, and e.g. Installation is as easy as that, and we'll automatically download the necessary binary artifacts (a C wrapper for the Metal APIs, and an LLVM back-end). Start by getting a hold of the upcoming Julia 1.8, launch it, and enter the package manager by pressing ]: julia> ] If you're interesting in using Metal.jl, please consider contributing to its development! Most of the package is written in Julia, and checking-out the source code is a single Pkg.develop away :-) Quick start We also haven't optimized for performance yet. In the following post I'll demonstrate some of that functionality and explain how it works.īut first, note that Metal.jl is under heavy development: The package is considered experimental for now, as we're still working on squashing bugs and adding essential functionality. The back-end is built on the same foundations that make up existing GPU packages like CUDA.jl and AMDGPU.jl, so it should be familiar to anybody who's already programmed GPUs in Julia. Julia has gained a new GPU back-end: Metal.jl, for working with Apple's M1 GPUs.

Technical preview: Programming Apple M1 GPUs in Julia with Metal.jl Jun 24, 2022
