Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ uuid = "08131aa3-fb12-5dee-8b74-c09406e224a2"
version = "0.10.9"

[deps]
AcceleratedKernels = "6a4ca0a5-0e36-4168-a932-d9be78d558f1"
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
GPUArrays = "0c68f7d7-f131-5f86-a1c3-88cf8149b2d7"
GPUCompiler = "61eb1bfa-7361-4325-ad38-22787b887f55"
Expand All @@ -25,6 +26,7 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
SPIRVIntrinsics = {path = "lib/intrinsics"}

[compat]
AcceleratedKernels = "0.3.1, 0.4"
Adapt = "4"
GPUArrays = "11.2.1"
GPUCompiler = "1.7.1"
Expand Down
4 changes: 4 additions & 0 deletions src/OpenCL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ using Random
using Preferences

import KernelAbstractions: KernelAbstractions
import AcceleratedKernels as AK

using Core: LLVMPtr

Expand Down Expand Up @@ -47,4 +48,7 @@ include("random.jl")
include("OpenCLKernels.jl")
import .OpenCLKernels: OpenCLBackend
export OpenCLBackend

include("sorting.jl")
include("accumulate.jl")
end
21 changes: 21 additions & 0 deletions src/accumulate.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Use a smaller block size to work around a scan correctness issue
# with the Blelloch parallel prefix sum at larger block sizes (>=128).
const _ACCUMULATE_BLOCK_SIZE = 64

Base.accumulate!(
op, B::CLArray, A::CLArray; init = zero(eltype(A)),
block_size = _ACCUMULATE_BLOCK_SIZE, kwargs...
) =
AK.accumulate!(op, B, A, OpenCLBackend(); init, block_size, kwargs...)

Base.accumulate(
op, A::CLArray; init = zero(eltype(A)),
block_size = _ACCUMULATE_BLOCK_SIZE, kwargs...
) =
AK.accumulate(op, A, OpenCLBackend(); init, block_size, kwargs...)

Base.cumsum(src::CLArray; block_size = _ACCUMULATE_BLOCK_SIZE, kwargs...) =
AK.cumsum(src, OpenCLBackend(); block_size, kwargs...)

Base.cumprod(src::CLArray; block_size = _ACCUMULATE_BLOCK_SIZE, kwargs...) =
AK.cumprod(src, OpenCLBackend(); block_size, kwargs...)
3 changes: 3 additions & 0 deletions src/sorting.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Base.sort!(x::CLArray; kwargs...) = (AK.sort!(x; kwargs...); return x)
Base.sortperm!(ix::CLArray, x::CLArray; kwargs...) = (AK.sortperm!(ix, x; kwargs...); return ix)
Base.sortperm(x::CLArray; kwargs...) = sortperm!(CLArray(1:length(x)), x; kwargs...)
2 changes: 1 addition & 1 deletion test/setup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function runtests(f, name, platform_filter)
end

# some tests require native execution capabilities
requires_il = name in ["atomics", "execution", "intrinsics", "kernelabstractions"] ||
requires_il = name in ["acceleratedkernels", "atomics", "execution", "intrinsics", "kernelabstractions"] ||
startswith(name, "gpuarrays/") || startswith(name, "device/")

ex = quote
Expand Down
Loading