@@ -65,6 +65,9 @@ This allows for two different configurations:
65
65
66
66
!!! warn
67
67
This is an experimental feature.
68
+
69
+ !!! note
70
+ `cpu={true, false}` is deprecated for KernelAbstractions 1.0
68
71
"""
69
72
macro kernel (ex... )
70
73
if length (ex) == 1
@@ -184,6 +187,8 @@ After releasing the memory of an array, it should no longer be accessed.
184
187
"""
185
188
function unsafe_free! end
186
189
190
+ unsafe_free! (:: AbstractArray ) = return
191
+
187
192
# ##
188
193
# Kernel language
189
194
# - @localmem
@@ -248,6 +253,9 @@ For storage that only persists between `@synchronize` statements, an `MArray` ca
248
253
instead.
249
254
250
255
See also [`@uniform`](@ref).
256
+
257
+ !!! note
258
+ `@private` is deprecated for KernelAbstractions 1.0
251
259
"""
252
260
macro private (T, dims)
253
261
if dims isa Integer
263
271
264
272
Creates a private local of `mem` per item in the workgroup. This can be safely used
265
273
across [`@synchronize`](@ref) statements.
274
+
275
+ !!! note
276
+ `@private` is deprecated for KernelAbstractions 1.0
266
277
"""
267
278
macro private (expr)
268
279
return esc (expr)
273
284
274
285
`expr` is evaluated outside the workitem scope. This is useful for variable declarations
275
286
that span workitems, or are reused across `@synchronize` statements.
287
+
288
+ !!! note
289
+ `@uniform` is deprecated for KernelAbstractions 1.0
276
290
"""
277
291
macro uniform (value)
278
292
return esc (value)
@@ -316,6 +330,8 @@ Access the hidden context object used by KernelAbstractions.
316
330
!!! warn
317
331
Only valid to be used from a kernel with `cpu=false`.
318
332
333
+ !!! note
334
+ `@context` will be supported on all backends in KernelAbstractions 1.0
319
335
```
320
336
function f(@context, a)
321
337
I = @index(Global, Linear)
@@ -464,31 +480,11 @@ Abstract type for all GPU based KernelAbstractions backends.
464
480
465
481
!!! note
466
482
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
486
483
487
- Returns true for all [`GPU`](@ref) backends.
484
+ !!! note
485
+ `GPU` will be removed in KernelAbstractions v1.0
488
486
"""
489
- isgpu (:: GPU ) = true
490
- isgpu (:: CPU ) = false
491
-
487
+ abstract type GPU <: Backend end
492
488
493
489
"""
494
490
get_backend(A::AbstractArray)::Backend
@@ -504,12 +500,9 @@ function get_backend end
504
500
# Should cover SubArray, ReshapedArray, ReinterpretArray, Hermitian, AbstractTriangular, etc.:
505
501
get_backend (A:: AbstractArray ) = get_backend (parent (A))
506
502
507
- get_backend (:: Array ) = CPU ()
508
-
509
503
# Define:
510
504
# adapt_storage(::Backend, a::Array) = adapt(BackendArray, a)
511
505
# adapt_storage(::Backend, a::BackendArray) = a
512
- Adapt. adapt_storage (:: CPU , a:: Array ) = a
513
506
514
507
"""
515
508
allocate(::Backend, Type, dims...)::AbstractArray
@@ -729,7 +722,7 @@ Partition a kernel for the given ndrange and workgroupsize.
729
722
return iterspace, dynamic
730
723
end
731
724
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}
733
726
return Kernel {Backend, S, NDRange, XPUName} (backend, xpu_name)
734
727
end
735
728
@@ -746,6 +739,10 @@ include("compiler.jl")
746
739
function __workitems_iterspace end
747
740
function __validindex end
748
741
742
+ # for reflection
743
+ function mkcontext end
744
+ function launch_config end
745
+
749
746
include (" macros.jl" )
750
747
751
748
# ##
815
812
end
816
813
817
814
# CPU backend
815
+ include (" pocl/pocl.jl" )
816
+ using . POCL
817
+ export POCLBackend
818
818
819
- include ( " cpu.jl " )
819
+ const CPU = POCLBackend
820
820
821
821
# precompile
822
822
PrecompileTools. @compile_workload begin
@@ -830,19 +830,4 @@ PrecompileTools.@compile_workload begin
830
830
end
831
831
end
832
832
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
-
848
833
end # module
0 commit comments