@@ -50,7 +50,7 @@ synchronize(backend)
5050```
5151"""
5252macro kernel (expr)
53- return __kernel (expr, #= generate_cpu =# true , #= force_inbounds=# false )
53+ return __kernel (expr, #= force_inbounds=# false )
5454end
5555
5656"""
@@ -65,17 +65,19 @@ This allows for two different configurations:
6565
6666!!! warn
6767 This is an experimental feature.
68+
69+ !!! note
70+ `cpu={true, false}` is deprecated for KernelAbstractions 1.0
6871"""
6972macro kernel (ex... )
7073 if length (ex) == 1
71- return __kernel (ex[1 ], true , false )
74+ return __kernel (ex[1 ], false )
7275 else
73- generate_cpu = true
7476 force_inbounds = false
7577 for i in 1 : (length (ex) - 1 )
7678 if ex[i] isa Expr && ex[i]. head == :(= ) &&
7779 ex[i]. args[1 ] == :cpu && ex[i]. args[2 ] isa Bool
78- generate_cpu = ex[i] . args[ 2 ]
80+ # deprecated
7981 elseif ex[i] isa Expr && ex[i]. head == :(= ) &&
8082 ex[i]. args[1 ] == :inbounds && ex[i]. args[2 ] isa Bool
8183 force_inbounds = ex[i]. args[2 ]
@@ -88,7 +90,7 @@ macro kernel(ex...)
8890 )
8991 end
9092 end
91- return __kernel (ex[end ], generate_cpu, force_inbounds)
93+ return __kernel (ex[end ], force_inbounds)
9294 end
9395end
9496
@@ -184,6 +186,8 @@ After releasing the memory of an array, it should no longer be accessed.
184186"""
185187function unsafe_free! end
186188
189+ unsafe_free! (:: AbstractArray ) = return
190+
187191# ##
188192# Kernel language
189193# - @localmem
@@ -248,6 +252,9 @@ For storage that only persists between `@synchronize` statements, an `MArray` ca
248252instead.
249253
250254See also [`@uniform`](@ref).
255+
256+ !!! note
257+ `@private` is deprecated for KernelAbstractions 1.0
251258"""
252259macro private (T, dims)
253260 if dims isa Integer
263270
264271Creates a private local of `mem` per item in the workgroup. This can be safely used
265272across [`@synchronize`](@ref) statements.
273+
274+ !!! note
275+ `@private` is deprecated for KernelAbstractions 1.0
266276"""
267277macro private (expr)
268278 return esc (expr)
273283
274284`expr` is evaluated outside the workitem scope. This is useful for variable declarations
275285that span workitems, or are reused across `@synchronize` statements.
286+
287+ !!! note
288+ `@uniform` is deprecated for KernelAbstractions 1.0
276289"""
277290macro uniform (value)
278291 return esc (value)
@@ -324,6 +337,8 @@ Access the hidden context object used by KernelAbstractions.
324337!!! warn
325338 Only valid to be used from a kernel with `cpu=false`.
326339
340+ !!! note
341+ `@context` will be supported on all backends in KernelAbstractions 1.0
327342```
328343function f(@context, a)
329344 I = @index(Global, Linear)
@@ -472,31 +487,11 @@ Abstract type for all GPU based KernelAbstractions backends.
472487
473488!!! note
474489 New backend implementations **must** sub-type this abstract type.
475- """
476- abstract type GPU <: Backend end
477-
478- """
479- CPU(; static=false)
480-
481- Instantiate a CPU (multi-threaded) backend.
482-
483- ## Options:
484- - `static`: Uses a static thread assignment, this can be beneficial for NUMA aware code.
485- Defaults to false.
486- """
487- struct CPU <: Backend
488- static:: Bool
489- CPU (; static:: Bool = false ) = new (static)
490- end
491-
492- """
493- isgpu(::Backend)::Bool
494490
495- Returns true for all [`GPU`](@ref) backends.
491+ !!! note
492+ `GPU` will be removed in KernelAbstractions v1.0
496493"""
497- isgpu (:: GPU ) = true
498- isgpu (:: CPU ) = false
499-
494+ abstract type GPU <: Backend end
500495
501496"""
502497 get_backend(A::AbstractArray)::Backend
@@ -512,12 +507,9 @@ function get_backend end
512507# Should cover SubArray, ReshapedArray, ReinterpretArray, Hermitian, AbstractTriangular, etc.:
513508get_backend (A:: AbstractArray ) = get_backend (parent (A))
514509
515- get_backend (:: Array ) = CPU ()
516-
517510# Define:
518511# adapt_storage(::Backend, a::Array) = adapt(BackendArray, a)
519512# adapt_storage(::Backend, a::BackendArray) = a
520- Adapt. adapt_storage (:: CPU , a:: Array ) = a
521513
522514"""
523515 allocate(::Backend, Type, dims...)::AbstractArray
@@ -737,7 +729,7 @@ Partition a kernel for the given ndrange and workgroupsize.
737729 return iterspace, dynamic
738730end
739731
740- function construct (backend:: Backend , :: S , :: NDRange , xpu_name:: XPUName ) where {Backend <: Union{CPU, GPU} , S <: _Size , NDRange <: _Size , XPUName}
732+ function construct (backend:: Backend , :: S , :: NDRange , xpu_name:: XPUName ) where {Backend <: GPU , S <: _Size , NDRange <: _Size , XPUName}
741733 return Kernel {Backend, S, NDRange, XPUName} (backend, xpu_name)
742734end
743735
@@ -754,6 +746,10 @@ include("compiler.jl")
754746function __workitems_iterspace end
755747function __validindex end
756748
749+ # for reflection
750+ function mkcontext end
751+ function launch_config end
752+
757753include (" macros.jl" )
758754
759755# ##
823819end
824820
825821# CPU backend
822+ include (" pocl/pocl.jl" )
823+ using . POCL
824+ export POCLBackend
826825
827- include ( " cpu.jl " )
826+ const CPU = POCLBackend
828827
829828# precompile
830829PrecompileTools. @compile_workload begin
@@ -838,19 +837,4 @@ PrecompileTools.@compile_workload begin
838837 end
839838end
840839
841- if ! isdefined (Base, :get_extension )
842- using Requires
843- end
844-
845- @static if ! isdefined (Base, :get_extension )
846- function __init__ ()
847- @require EnzymeCore = " f151be2c-9106-41f4-ab19-57ee4f262869" include (" ../ext/EnzymeExt.jl" )
848- end
849- end
850-
851- if ! isdefined (Base, :get_extension )
852- include (" ../ext/LinearAlgebraExt.jl" )
853- include (" ../ext/SparseArraysExt.jl" )
854- end
855-
856840end # module
0 commit comments