Skip to content

Commit f722961

Browse files
committed
Add CPU definition
1 parent e0e1ea3 commit f722961

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/cpu.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
unsafe_free!(::AbstractArray) = return
22
synchronize(::CPU) = nothing
33

4-
allocate(::CPU, ::Type{T}, dims::Tuple) where {T} = Array{T}(undef, dims)
4+
allocate(::CPU, ::Type{T}, dims::Tuple; unified::Bool=false) where {T} = Array{T}(undef, dims)
55

6-
function zeros(backend::CPU, ::Type{T}, dims::Tuple) where {T}
7-
arr = allocate(backend, T, dims)
6+
function zeros(backend::CPU, ::Type{T}, dims::Tuple; kwargs...) where {T}
7+
arr = allocate(backend, T, dims; kwargs...)
88
kernel = init_kernel(backend)
99
kernel(arr, zero, T, ndrange = length(arr))
1010
return arr
1111
end
12-
function ones(backend::CPU, ::Type{T}, dims::Tuple) where {T}
13-
arr = allocate(backend, T, dims)
12+
function ones(backend::CPU, ::Type{T}, dims::Tuple; kwargs...) where {T}
13+
arr = allocate(backend, T, dims; kwargs...)
1414
kernel = init_kernel(backend)
1515
kernel(arr, one, T; ndrange = length(arr))
1616
return arr
@@ -34,6 +34,7 @@ end
3434

3535
functional(::CPU) = true
3636
pagelock!(::CPU, x) = nothing
37+
supports_unified(::CPU) = true
3738

3839
function (obj::Kernel{CPU})(args...; ndrange = nothing, workgroupsize = nothing)
3940
ndrange, workgroupsize, iterspace, dynamic = launch_config(obj, ndrange, workgroupsize)

0 commit comments

Comments
 (0)