Improved support for Metal.jl kernels#192
Conversation
|
Thanks, this looks like the right minimal extension to treat Metal like CUDA. Are these failed tests wrong values, or errors from MtlArrays? I would have guessed it should all be same as CuArray, Tracker doesn't seem to load anything GPU-related: https://github.com/FluxML/Tracker.jl/blob/master/Project.toml |
|
I think it would be a good idea to refine the "backend selection" bit in They are wrong values, the gradient computation does not error out, just gives erroneous values. I'm also surprised it's not working. Could it be that there is also some dispatch on the gradient computation code that assumes |
|
Ok. Yes everything about how Tullio interacts with other packages is a bit of a hack. Ideally it would dispatch to AbstractGPUArray as you say. But I'm not sure whether there's a generic replacement for Re tests this should probably be rebased on top of #193. Can any CI can test Metal right now, maybe github does in fact support this? For CUDA the buildkite jobs run this on Julia's GPU servers. |
|
I agree, I think the extension would still be necessary. But obviously that's just intuition, the codebase is very new to me. What we could do there is use Not sure how #193 interacts with the gradient tests, but I can give it a go and see what happens. As for CI, I think I read somewhere there are some GitHub MacOS machines. Not sure if they have Metal GPUs though |
|
Another issue with the kernel launching I just came across. Since the backend selection checks |
Fixes #191
It turns out that adding the Metal extension was not enough, the Act functions that generated kernels assumed
CuArray. The current implementation has several issues, for instance, it fails with weird errors when both CUDA and Metal are loaded. Also currently broken: some gradient testsI'm opening this as draft because I think it would be a good idea to make to overhaul the GPU backend selection code and wanted to get your thoughts on it @mcabbott
Some gradient tests that fail with Metal:
I have no clue why the gradients fail