From 5d26167c7f790bcc7ee6464bcc33b11a9745ce92 Mon Sep 17 00:00:00 2001 From: Michael Abbott <32575566+mcabbott@users.noreply.github.com> Date: Mon, 25 Jul 2022 09:30:00 -0400 Subject: [PATCH] Move `AbstractGPUArrayStyle` to `GPUArraysCore`? (#417) --- Project.toml | 4 ++-- lib/GPUArraysCore/Project.toml | 2 +- lib/GPUArraysCore/src/GPUArraysCore.jl | 11 ++++++++++- src/host/broadcast.jl | 10 ---------- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/Project.toml b/Project.toml index 1f26a563..28f980e1 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "GPUArrays" uuid = "0c68f7d7-f131-5f86-a1c3-88cf8149b2d7" -version = "8.4.1" +version = "8.4.2" [deps] Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" @@ -15,7 +15,7 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" [compat] Adapt = "2.0, 3.0" -GPUArraysCore = "0.1" +GPUArraysCore = "= 0.1.1" LLVM = "3.9, 4" Reexport = "1" julia = "1.6" diff --git a/lib/GPUArraysCore/Project.toml b/lib/GPUArraysCore/Project.toml index df9046bf..80b926e8 100644 --- a/lib/GPUArraysCore/Project.toml +++ b/lib/GPUArraysCore/Project.toml @@ -1,7 +1,7 @@ name = "GPUArraysCore" uuid = "46192b85-c4d5-4398-a991-12ede77f4527" authors = ["Tim Besard "] -version = "0.1.0" +version = "0.1.1" [deps] Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" diff --git a/lib/GPUArraysCore/src/GPUArraysCore.jl b/lib/GPUArraysCore/src/GPUArraysCore.jl index c33f415e..7b988b94 100644 --- a/lib/GPUArraysCore/src/GPUArraysCore.jl +++ b/lib/GPUArraysCore/src/GPUArraysCore.jl @@ -6,7 +6,7 @@ using Adapt ## essential types export AbstractGPUArray, AbstractGPUVector, AbstractGPUMatrix, AbstractGPUVecOrMat, - WrappedGPUArray, AnyGPUArray + WrappedGPUArray, AnyGPUArray, AbstractGPUArrayStyle """ AbstractGPUArray{T, N} <: DenseArray{T, N} @@ -25,6 +25,15 @@ const AbstractGPUVecOrMat{T} = Union{AbstractGPUArray{T, 1}, AbstractGPUArray{T, const WrappedGPUArray{T,N} = WrappedArray{T,N,AbstractGPUArray,AbstractGPUArray{T,N}} const AnyGPUArray{T,N} = Union{AbstractGPUArray{T,N}, WrappedGPUArray{T,N}} +## broadcasting + +""" +Abstract supertype for GPU array styles. The `N` parameter is the dimensionality. + +Downstream implementations should provide a concrete array style type that inherits from +this supertype. +""" +abstract type AbstractGPUArrayStyle{N} <: Base.Broadcast.AbstractArrayStyle{N} end ## scalar iteration diff --git a/src/host/broadcast.jl b/src/host/broadcast.jl index 7a037985..7b8d1d30 100644 --- a/src/host/broadcast.jl +++ b/src/host/broadcast.jl @@ -1,7 +1,5 @@ # broadcasting operations -export AbstractGPUArrayStyle - using Base.Broadcast import Base.Broadcast: BroadcastStyle, Broadcasted, AbstractArrayStyle, instantiate @@ -9,14 +7,6 @@ import Base.Broadcast: BroadcastStyle, Broadcasted, AbstractArrayStyle, instanti const BroadcastGPUArray{T} = Union{AnyGPUArray{T}, Base.RefValue{<:AbstractGPUArray{T}}} -""" -Abstract supertype for GPU array styles. The `N` parameter is the dimensionality. - -Downstream implementations should provide a concrete array style type that inherits from -this supertype. -""" -abstract type AbstractGPUArrayStyle{N} <: AbstractArrayStyle{N} end - # Wrapper types otherwise forget that they are GPU compatible # NOTE: don't directly use GPUArrayStyle here not to lose downstream customizations. BroadcastStyle(W::Type{<:WrappedGPUArray})= BroadcastStyle(Adapt.parent(W){Adapt.eltype(W), Adapt.ndims(W)})