-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port MetalKernels #131
Port MetalKernels #131
Conversation
I think the original version by @tgymnich already uses those queries - https://github.com/JuliaGPU/Metal.jl/pull/131/files#diff-2c3eb99b21164848c74517fc0b0e49e5d8785051cd61bf8ecda6fb5e2dfcfb22R146-R168 |
Ah, right, not sure how I overlooked those. |
We should expose a query in KA that checks capabilities of the backend. E.g. atomics and |
@vchuravy Sounds good, I'll take a stab at adding it. By the way I have a question about julia> a = MtlArray(Float32[1.0])
1-element MtlVector{Float32}:
1.0
julia> gamma.(a)
ERROR: InvalidIRError: compiling broadcast_kernel(Metal.mtlKernelContext, MtlDeviceVector{Float32, 1}, Val{CartesianIndices((1,))}, Base.Broadcast.Broadcasted{Metal.MtlArrayStyle{1}, Tuple{Base.OneTo{Int64}}, typeof(gamma), Tuple{Base.Broadcast.Extruded{MtlDeviceVector{Float32, 1}, Tuple{Bool}, Tuple{Int64}}}}, Int64) in world 32495 resulted in invalid LLVM IR
Reason: unsupported call to an unknown function (call to gpu_malloc)
...
Reason: unsupported call through a literal pointer (call to tgammaf)
Stacktrace:
[1] _gamma
@ ~/.julia/packages/SpecialFunctions/gXPNz/src/gamma.jl:578
[2] gamma
@ ~/.julia/packages/SpecialFunctions/gXPNz/src/gamma.jl:567
[3] _broadcast_getindex_evalf
@ ./broadcast.jl:670
... The second error complains about a |
Oh found it - https://github.com/JuliaGPU/CUDA.jl/blob/master/src/device/intrinsics/special_math.jl |
Once JuliaGPU/KernelAbstractions.jl#369 and JuliaGPU/KernelAbstractions.jl#374 are merged, most tests should pass. There's one weird issue remaining however -- the To disable unrelated tests: diff --git a/test/kernelabstractions.jl b/test/kernelabstractions.jl
index 6542799..17c79ff 100644
--- a/test/kernelabstractions.jl
+++ b/test/kernelabstractions.jl
@@ -13,4 +13,8 @@ Testsuite.testsuite(()->MetalBackend(), "Metal", Metal, MtlArray, Metal.MtlDevic
"Convert", # depends on https://github.com/JuliaGPU/Metal.jl/issues/69
"SpecialFunctions", # no equivalent Metal intrinsics for gamma, erf, etc
"sparse", # not supported yet
+
+ "partition", "get_backend", "indextest", "Const", "CPU synchronization",
+ "Zero iteration space $(MetalBackend())", "return statement", "fallback test: callable types", "priority",
+ "Localmem", "Private", "Unroll", "Printing", "Compiler", "Reflection", "Examples",
])) |
Ok landed both PRs. I can tag |
Yeah we just need to skip that test. |
Co-authored-by: Tim Besard <tim.besard@gmail.com>
Co-authored-by: Tim Besard <tim.besard@gmail.com>
Outstanding issues
copyto_testsuite
used to fail for strange reasons, but seems consistently passing now?Unsupported currently
get_backend(sparse)
: Depends onsparse(MtlArray)
, skippedconvert
: Depends on Support for exceptions #69, skippedspecialfunction
: Missing device intrinsics in Metal, skipped