I am trying to use Metal.jl for a scientific computation and having difficulty with AutoDiff (ForwardDiff). I am using julia 1.9.
This is the code
dF = x->ForwardDiff.gradient(x->dot(x,x),x)
N = 7;
x = rand(Float32,N);
dF(MtlArray(x))
The code work for N=7, but not for N=8 and higher.
I get the following warning/error
┌ Warning: Compilation of MetalLib to native code failed.
│ If you think this is a bug, please file an issue and attach /var/folders/l_/mmy119_j47b_k4mtcn0ngfj00000gn/T/jl_43KX6d0bSl.metallib.
└ @ Metal ~/.julia/packages/Metal/TtPHW/src/compiler/compilation.jl:77 ERROR: NSError: Threadgroup memory size (36864) exceeds the maximum threadgroup memory allowed (32768) (AGXMetal13_3, code 3)
What am I doing wrong here?
Any help in this regard is much appreciated.
Thanks!
That’s strange; your code works here. Feel free to open an issue on Metal.jl, with more details (Manifest, including the metallib file, full backtrace, etc).