@@ -65,6 +65,9 @@ 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
@@ -184,6 +187,8 @@ After releasing the memory of an array, it should no longer be accessed.
184187"""
185188function unsafe_free! end
186189
190+ unsafe_free! (:: AbstractArray ) = return
191+
187192# ##
188193# Kernel language
189194# - @localmem
@@ -248,6 +253,9 @@ For storage that only persists between `@synchronize` statements, an `MArray` ca
248253instead.
249254
250255See also [`@uniform`](@ref).
256+
257+ !!! note
258+ `@private` is deprecated for KernelAbstractions 1.0
251259"""
252260macro private (T, dims)
253261 if dims isa Integer
263271
264272Creates a private local of `mem` per item in the workgroup. This can be safely used
265273across [`@synchronize`](@ref) statements.
274+
275+ !!! note
276+ `@private` is deprecated for KernelAbstractions 1.0
266277"""
267278macro private (expr)
268279 return esc (expr)
273284
274285`expr` is evaluated outside the workitem scope. This is useful for variable declarations
275286that span workitems, or are reused across `@synchronize` statements.
287+
288+ !!! note
289+ `@uniform` is deprecated for KernelAbstractions 1.0
276290"""
277291macro uniform (value)
278292 return esc (value)
@@ -316,6 +330,8 @@ Access the hidden context object used by KernelAbstractions.
316330!!! warn
317331 Only valid to be used from a kernel with `cpu=false`.
318332
333+ !!! note
334+ `@context` will be supported on all backends in KernelAbstractions 1.0
319335```
320336function f(@context, a)
321337 I = @index(Global, Linear)
@@ -464,31 +480,11 @@ Abstract type for all GPU based KernelAbstractions backends.
464480
465481!!! note
466482 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
486483
487- Returns true for all [`GPU`](@ref) backends.
484+ !!! note
485+ `GPU` will be removed in KernelAbstractions v1.0
488486"""
489- isgpu (:: GPU ) = true
490- isgpu (:: CPU ) = false
491-
487+ abstract type GPU <: Backend end
492488
493489"""
494490 get_backend(A::AbstractArray)::Backend
@@ -504,12 +500,9 @@ function get_backend end
504500# Should cover SubArray, ReshapedArray, ReinterpretArray, Hermitian, AbstractTriangular, etc.:
505501get_backend (A:: AbstractArray ) = get_backend (parent (A))
506502
507- get_backend (:: Array ) = CPU ()
508-
509503# Define:
510504# adapt_storage(::Backend, a::Array) = adapt(BackendArray, a)
511505# adapt_storage(::Backend, a::BackendArray) = a
512- Adapt. adapt_storage (:: CPU , a:: Array ) = a
513506
514507"""
515508 allocate(::Backend, Type, dims...)::AbstractArray
@@ -729,7 +722,7 @@ Partition a kernel for the given ndrange and workgroupsize.
729722 return iterspace, dynamic
730723end
731724
732- function construct (backend:: Backend , :: S , :: NDRange , xpu_name:: XPUName ) where {Backend <: Union{CPU, GPU} , S <: _Size , NDRange <: _Size , XPUName}
725+ function construct (backend:: Backend , :: S , :: NDRange , xpu_name:: XPUName ) where {Backend <: GPU , S <: _Size , NDRange <: _Size , XPUName}
733726 return Kernel {Backend, S, NDRange, XPUName} (backend, xpu_name)
734727end
735728
@@ -746,6 +739,10 @@ include("compiler.jl")
746739function __workitems_iterspace end
747740function __validindex end
748741
742+ # for reflection
743+ function mkcontext end
744+ function launch_config end
745+
749746include (" macros.jl" )
750747
751748# ##
815812end
816813
817814# CPU backend
815+ include (" pocl/pocl.jl" )
816+ using . POCL
817+ export POCLBackend
818818
819- include ( " cpu.jl " )
819+ const CPU = POCLBackend
820820
821821# precompile
822822PrecompileTools. @compile_workload begin
@@ -830,19 +830,4 @@ PrecompileTools.@compile_workload begin
830830 end
831831end
832832
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-
848833end # module
0 commit comments