@@ -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)
@@ -316,6 +329,8 @@ Access the hidden context object used by KernelAbstractions.
316329!!! warn
317330 Only valid to be used from a kernel with `cpu=false`.
318331
332+ !!! note
333+ `@context` will be supported on all backends in KernelAbstractions 1.0
319334```
320335function f(@context, a)
321336 I = @index(Global, Linear)
@@ -464,31 +479,11 @@ Abstract type for all GPU based KernelAbstractions backends.
464479
465480!!! note
466481 New backend implementations **must** sub-type this abstract type.
467- """
468- abstract type GPU <: Backend end
469-
470- """
471- CPU(; static=false)
472-
473- Instantiate a CPU (multi-threaded) backend.
474-
475- ## Options:
476- - `static`: Uses a static thread assignment, this can be beneficial for NUMA aware code.
477- Defaults to false.
478- """
479- struct CPU <: Backend
480- static:: Bool
481- CPU (; static:: Bool = false ) = new (static)
482- end
483-
484- """
485- isgpu(::Backend)::Bool
486482
487- Returns true for all [`GPU`](@ref) backends.
483+ !!! note
484+ `GPU` will be removed in KernelAbstractions v1.0
488485"""
489- isgpu (:: GPU ) = true
490- isgpu (:: CPU ) = false
491-
486+ abstract type GPU <: Backend end
492487
493488"""
494489 get_backend(A::AbstractArray)::Backend
@@ -504,12 +499,9 @@ function get_backend end
504499# Should cover SubArray, ReshapedArray, ReinterpretArray, Hermitian, AbstractTriangular, etc.:
505500get_backend (A:: AbstractArray ) = get_backend (parent (A))
506501
507- get_backend (:: Array ) = CPU ()
508-
509502# Define:
510503# adapt_storage(::Backend, a::Array) = adapt(BackendArray, a)
511504# adapt_storage(::Backend, a::BackendArray) = a
512- Adapt. adapt_storage (:: CPU , a:: Array ) = a
513505
514506"""
515507 allocate(::Backend, Type, dims...)::AbstractArray
@@ -729,7 +721,7 @@ Partition a kernel for the given ndrange and workgroupsize.
729721 return iterspace, dynamic
730722end
731723
732- function construct (backend:: Backend , :: S , :: NDRange , xpu_name:: XPUName ) where {Backend <: Union{CPU, GPU} , S <: _Size , NDRange <: _Size , XPUName}
724+ function construct (backend:: Backend , :: S , :: NDRange , xpu_name:: XPUName ) where {Backend <: GPU , S <: _Size , NDRange <: _Size , XPUName}
733725 return Kernel {Backend, S, NDRange, XPUName} (backend, xpu_name)
734726end
735727
@@ -746,6 +738,10 @@ include("compiler.jl")
746738function __workitems_iterspace end
747739function __validindex end
748740
741+ # for reflection
742+ function mkcontext end
743+ function launch_config end
744+
749745include (" macros.jl" )
750746
751747# ##
815811end
816812
817813# CPU backend
814+ include (" pocl/pocl.jl" )
815+ using . POCL
816+ export POCLBackend
818817
819- include ( " cpu.jl " )
818+ const CPU = POCLBackend
820819
821820# precompile
822821PrecompileTools. @compile_workload begin
@@ -830,19 +829,4 @@ PrecompileTools.@compile_workload begin
830829 end
831830end
832831
833- if ! isdefined (Base, :get_extension )
834- using Requires
835- end
836-
837- @static if ! isdefined (Base, :get_extension )
838- function __init__ ()
839- @require EnzymeCore = " f151be2c-9106-41f4-ab19-57ee4f262869" include (" ../ext/EnzymeExt.jl" )
840- end
841- end
842-
843- if ! isdefined (Base, :get_extension )
844- include (" ../ext/LinearAlgebraExt.jl" )
845- include (" ../ext/SparseArraysExt.jl" )
846- end
847-
848832end # module
0 commit comments