diff --git a/docs/src/index.md b/docs/src/index.md index 9342c32fc..9e28aaea3 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -141,10 +141,8 @@ end the CPU backend became an OpenCL backend meant every backend. Use `KernelAbstractions.@device_code_llvm` and `KernelAbstractions.@device_code_typed` instead, which report on the code a backend actually generates; see [Reflection](@ref). -- `KernelAbstractions.GPU` has been removed: it didn't mean GPU hardware (the `CPU` backend - was a subtype), and backends now subtype `KernelAbstractions.Backend` directly. Code - dispatching on `::GPU` should dispatch on `::Backend`, on concrete backend types, or on a - capability such as `KernelAbstractions.supports_float64`. +- `KernelAbstractions.GPU` is deprecated: and backends should now subtype `KernelAbstractions.Backend` directly. `GPU` is now an alias of `Backend` and will be removed in a future release. Code dispatching on `::GPU` should dispatch on `::Backend`, on concrete + backend types, or on a capability such as `KernelAbstractions.supports_float64`. - An exception thrown in a kernel on the `CPU` backend is reported as a `KernelAbstractions.POCL.KernelException` when the kernel has completed, like on GPU backends, and no longer as the original exception (e.g., a `BoundsError`). Depending on diff --git a/src/KernelAbstractions.jl b/src/KernelAbstractions.jl index c7c9c5504..d93ccdbbf 100644 --- a/src/KernelAbstractions.jl +++ b/src/KernelAbstractions.jl @@ -18,6 +18,10 @@ using KernelInterface: KernelInterface, Backend, get_backend, functional, synchr import KernelInterface as KI export KernelInterface +# `GPU` is deprecated in 0.10: and backends ends now subtype `Backend` directly. Keep the name working for code written +# against 0.9, both `x::GPU` and `struct MyBackend <: GPU`. +Base.@deprecate_binding GPU Backend + """ @kernel function f(args) end diff --git a/test/runtests.jl b/test/runtests.jl index 0b5d06e91..7e9c1b3ee 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -423,3 +423,9 @@ struct NewBackend <: KernelAbstractions.Backend end @test KernelAbstractions.functional(backend) === missing end + +@testset "Deprecated GPU alias" begin + @test KernelAbstractions.GPU === KernelAbstractions.Backend + @test CPU() isa KernelAbstractions.GPU + @test NewBackend <: KernelAbstractions.GPU +end