@@ -12,32 +12,16 @@ include("utils.jl")
1212include (" collect.jl" )
1313include (" sort.jl" )
1414include (" lazy.jl" )
15- include (" tables.jl" )
16- include (" staticarrays_support.jl" )
1715
18- # Implement refarray and refvalue to deal with pooled arrays and weakrefstrings effectively
19- import DataAPI: refarray, refvalue
20- using DataAPI: defaultarray
21-
22- refarray (s:: StructArray ) = StructArray (map (refarray, components (s)))
23-
24- function refvalue (s:: StructArray{T} , v:: Tup ) where {T}
25- createinstance (T, map (refvalue, components (s), v)... )
16+ @static if ! isdefined (Base, :get_extension )
17+ include (" ../ext/StructArraysDataAPIExt.jl" )
18+ include (" ../ext/StructArraysGPUArraysCoreExt.jl" )
19+ include (" ../ext/StructArraysTablesExt.jl" )
20+ include (" ../ext/StructArraysStaticArraysCoreExt.jl" )
2621end
2722
2823# Use Adapt allows for automatic conversion of CPU to GPU StructArrays
2924import Adapt
3025Adapt. adapt_structure (to, s:: StructArray ) = replace_storage (x-> Adapt. adapt (to, x), s)
3126
32- # for GPU broadcast
33- import GPUArraysCore
34- function GPUArraysCore. backend (:: Type{T} ) where {T<: StructArray }
35- backends = map_params (GPUArraysCore. backend, array_types (T))
36- backend, others = backends[1 ], tail (backends)
37- isconsistent = mapfoldl (isequal (backend), & , others; init= true )
38- isconsistent || throw (ArgumentError (" all component arrays must have the same GPU backend" ))
39- return backend
40- end
41- always_struct_broadcast (:: GPUArraysCore.AbstractGPUArrayStyle ) = true
42-
4327end # module
0 commit comments