Skip to content

Commit 4128c3d

Browse files
authored
Backends are adaptors (#364)
1 parent cb69589 commit 4128c3d

File tree

6 files changed

+387
-5
lines changed

6 files changed

+387
-5
lines changed

.buildkite/pipeline.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ steps:
66
- "1.6"
77
- "1.7"
88
- "1.8"
9-
cuda:
10-
- "vc/ka_transition"
119
env:
1210
KERNELABSTRACTIONS_TEST_BACKEND: "CUDA"
1311
plugins:
@@ -19,10 +17,10 @@ steps:
1917
- src
2018
commands:
2119
- |
22-
julia -e 'using Pkg
20+
julia --project=test/projects/cuda -e 'using Pkg
2321
println("--- :julia: Instantiating project")
22+
Pkg.instantiate()
2423
Pkg.develop(; path=pwd())
25-
Pkg.add(; name="CUDA", rev="{{matrix.cuda}}")
2624
println("+++ :julia: Running tests")
2725
Pkg.test("CUDA"; coverage=true, test_args=["kernelabstractions"])'
2826
agents:

src/KernelAbstractions.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,11 @@ get_backend(A::Tridiagonal) = get_backend(A.d)
360360

361361
get_backend(::Array) = CPU()
362362

363+
# Define:
364+
# adapt_storage(::Backend, a::Array) = adapt(BackendArray, a)
365+
# adapt_storage(::Backend, a::BackendArray) = a
366+
Adapt.adapt_storage(::CPU, a::Array) = a
367+
363368
"""
364369
allocate(::Backend, Type, dims...)
365370

test/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[deps]
2+
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
23
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
34
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
45
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

0 commit comments

Comments
 (0)