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
8 changes: 2 additions & 6 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
SPIRVIntrinsics = "71d1d633-e7e8-4a92-83a1-de8814b09ba8"
SPIRV_LLVM_Backend_jll = "4376b9bf-cff8-51b6-bb48-39421dff0d0c"
SPIRV_Tools_jll = "6ac6d60f-d740-5983-97d7-a4482c0689f4"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
pocl_jll = "627d6b7a-bbe6-5189-83e7-98cc0a5aeadd"

[weakdeps]
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
Expand All @@ -29,6 +29,7 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
EnzymeExt = "EnzymeCore"
LinearAlgebraExt = "LinearAlgebra"
SparseArraysExt = "SparseArrays"
StaticArraysExt = "StaticArrays"

[compat]
Adapt = "0.4, 1.0, 2.0, 3.0, 4"
Expand All @@ -48,8 +49,3 @@ StaticArrays = "0.12, 1.0"
UUIDs = "<0.0.1, 1.6"
julia = "1.10"
pocl_jll = "7"

[extras]
EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
9 changes: 9 additions & 0 deletions ext/StaticArraysExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module StaticArraysExt

import KernelAbstractions: get_backend, POCLBackend
using StaticArrays: SizedArray, MArray

get_backend(A::SizedArray) = get_backend(A.data)
get_backend(::MArray) = POCLBackend()

end
1 change: 0 additions & 1 deletion src/KernelAbstractions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import PrecompileTools
import Atomix: @atomic, @atomicswap, @atomicreplace

using MacroTools
using StaticArrays
using Adapt

"""
Expand Down
13 changes: 13 additions & 0 deletions test/test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ using InteractiveUtils
using LinearAlgebra
using SparseArrays
using Adapt
using StaticArrays

identity(x) = x

Expand Down Expand Up @@ -104,6 +105,18 @@ function unittest_testsuite(Backend, backend_str, backend_mod, BackendArrayT; sk
@test @inferred(KernelAbstractions.get_backend(sparse(A))) isa backendT
end

@conditional_testset "StaticArrays" skip_tests begin
backend = Backend()
backendT = typeof(backend).name.wrapper # To look through CUDABackend{true, false}
@test backend isa backendT

@test KernelAbstractions.get_backend(@MMatrix [1.0]) isa KernelAbstractions.POCLBackend
@test_throws ArgumentError KernelAbstractions.get_backend(@SMatrix [1.0])

A = allocate(backend, Float32, 5, 5)
@test @inferred(KernelAbstractions.get_backend(SizedMatrix{5, 5}(A))) isa backendT
end

@conditional_testset "adapt" skip_tests begin
backend = Backend()
x = allocate(backend, Float32, 5)
Expand Down
Loading