@@ -50,7 +50,7 @@ synchronize(backend)
5050```
5151"""
5252macro kernel (expr)
53- return __kernel (expr, #= generate_cpu =# true , #= force_inbounds=# false , #= unsafe_indices=# false )
53+ return __kernel (expr, #= force_inbounds=# false , #= unsafe_indices=# false )
5454end
5555
5656"""
@@ -66,18 +66,20 @@ This allows for two different configurations:
6666
6767!!! warn
6868 This is an experimental feature.
69+
70+ !!! note
71+ `cpu={true, false}` is deprecated for KernelAbstractions 1.0
6972"""
7073macro kernel (ex... )
7174 if length (ex) == 1
72- return __kernel (ex[1 ], true , false , false )
75+ return __kernel (ex[1 ], false , false )
7376 else
74- generate_cpu = true
7577 unsafe_indices = false
7678 force_inbounds = false
7779 for i in 1 : (length (ex) - 1 )
7880 if ex[i] isa Expr && ex[i]. head == :(= ) &&
7981 ex[i]. args[1 ] == :cpu && ex[i]. args[2 ] isa Bool
80- generate_cpu = ex[i] . args[ 2 ]
82+ # deprecated
8183 elseif ex[i] isa Expr && ex[i]. head == :(= ) &&
8284 ex[i]. args[1 ] == :inbounds && ex[i]. args[2 ] isa Bool
8385 force_inbounds = ex[i]. args[2 ]
@@ -94,7 +96,7 @@ macro kernel(ex...)
9496 )
9597 end
9698 end
97- return __kernel (ex[end ], generate_cpu, force_inbounds, unsafe_indices)
99+ return __kernel (ex[end ], force_inbounds, unsafe_indices)
98100 end
99101end
100102
@@ -190,6 +192,8 @@ After releasing the memory of an array, it should no longer be accessed.
190192"""
191193function unsafe_free! end
192194
195+ unsafe_free! (:: AbstractArray ) = return
196+
193197# ##
194198# Kernel language
195199# - @localmem
@@ -254,6 +258,9 @@ For storage that only persists between `@synchronize` statements, an `MArray` ca
254258instead.
255259
256260See also [`@uniform`](@ref).
261+
262+ !!! note
263+ `@private` is deprecated for KernelAbstractions 1.0
257264"""
258265macro private (T, dims)
259266 if dims isa Integer
269276
270277Creates a private local of `mem` per item in the workgroup. This can be safely used
271278across [`@synchronize`](@ref) statements.
279+
280+ !!! note
281+ `@private` is deprecated for KernelAbstractions 1.0
272282"""
273283macro private (expr)
274284 return esc (expr)
279289
280290`expr` is evaluated outside the workitem scope. This is useful for variable declarations
281291that span workitems, or are reused across `@synchronize` statements.
292+
293+ !!! note
294+ `@uniform` is deprecated for KernelAbstractions 1.0
282295"""
283296macro uniform (value)
284297 return esc (value)
@@ -330,6 +343,8 @@ Access the hidden context object used by KernelAbstractions.
330343!!! warn
331344 Only valid to be used from a kernel with `cpu=false`.
332345
346+ !!! note
347+ `@context` will be supported on all backends in KernelAbstractions 1.0
333348```
334349function f(@context, a)
335350 I = @index(Global, Linear)
@@ -478,31 +493,11 @@ Abstract type for all GPU based KernelAbstractions backends.
478493
479494!!! note
480495 New backend implementations **must** sub-type this abstract type.
481- """
482- abstract type GPU <: Backend end
483-
484- """
485- CPU(; static=false)
486-
487- Instantiate a CPU (multi-threaded) backend.
488-
489- ## Options:
490- - `static`: Uses a static thread assignment, this can be beneficial for NUMA aware code.
491- Defaults to false.
492- """
493- struct CPU <: Backend
494- static:: Bool
495- CPU (; static:: Bool = false ) = new (static)
496- end
497-
498- """
499- isgpu(::Backend)::Bool
500496
501- Returns true for all [`GPU`](@ref) backends.
497+ !!! note
498+ `GPU` will be removed in KernelAbstractions v1.0
502499"""
503- isgpu (:: GPU ) = true
504- isgpu (:: CPU ) = false
505-
500+ abstract type GPU <: Backend end
506501
507502"""
508503 get_backend(A::AbstractArray)::Backend
@@ -518,12 +513,9 @@ function get_backend end
518513# Should cover SubArray, ReshapedArray, ReinterpretArray, Hermitian, AbstractTriangular, etc.:
519514get_backend (A:: AbstractArray ) = get_backend (parent (A))
520515
521- get_backend (:: Array ) = CPU ()
522-
523516# Define:
524517# adapt_storage(::Backend, a::Array) = adapt(BackendArray, a)
525518# adapt_storage(::Backend, a::BackendArray) = a
526- Adapt. adapt_storage (:: CPU , a:: Array ) = a
527519
528520"""
529521 allocate(::Backend, Type, dims...)::AbstractArray
@@ -743,7 +735,7 @@ Partition a kernel for the given ndrange and workgroupsize.
743735 return iterspace, dynamic
744736end
745737
746- function construct (backend:: Backend , :: S , :: NDRange , xpu_name:: XPUName ) where {Backend <: Union{CPU, GPU} , S <: _Size , NDRange <: _Size , XPUName}
738+ function construct (backend:: Backend , :: S , :: NDRange , xpu_name:: XPUName ) where {Backend <: GPU , S <: _Size , NDRange <: _Size , XPUName}
747739 return Kernel {Backend, S, NDRange, XPUName} (backend, xpu_name)
748740end
749741
@@ -760,6 +752,10 @@ include("compiler.jl")
760752function __workitems_iterspace end
761753function __validindex end
762754
755+ # for reflection
756+ function mkcontext end
757+ function launch_config end
758+
763759include (" macros.jl" )
764760
765761# ##
829825end
830826
831827# CPU backend
828+ include (" pocl/pocl.jl" )
829+ using . POCL
830+ export POCLBackend
832831
833- include ( " cpu.jl " )
832+ const CPU = POCLBackend
834833
835834# precompile
836835PrecompileTools. @compile_workload begin
@@ -844,19 +843,4 @@ PrecompileTools.@compile_workload begin
844843 end
845844end
846845
847- if ! isdefined (Base, :get_extension )
848- using Requires
849- end
850-
851- @static if ! isdefined (Base, :get_extension )
852- function __init__ ()
853- @require EnzymeCore = " f151be2c-9106-41f4-ab19-57ee4f262869" include (" ../ext/EnzymeExt.jl" )
854- end
855- end
856-
857- if ! isdefined (Base, :get_extension )
858- include (" ../ext/LinearAlgebraExt.jl" )
859- include (" ../ext/SparseArraysExt.jl" )
860- end
861-
862846end # module
0 commit comments