Skip to content

Commit 528d02b

Browse files
committed
only allow host arrays for blas mul
1 parent 44bfe87 commit 528d02b

2 files changed

Lines changed: 13 additions & 10 deletions

File tree

ext/StridedGPUArraysExt.jl

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,6 @@ function Base.Array(a::GPUStridedView)
2020
return Array(b)
2121
end
2222

23-
function Strided.__mul!(
24-
C::GPUStridedView{TC, 2},
25-
A::GPUStridedView{TA, 2},
26-
B::GPUStridedView{TB, 2},
27-
α::Number, β::Number
28-
) where {TC, TA, TB}
29-
return GPUArrays.generic_matmatmul!(C, A, B, α, β)
30-
end
31-
3223
# ---------- GPU mapreduce support ----------
3324

3425
@inline _gpu_init_acc(::Nothing, current_val) = current_val

src/linalg.jl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ function LinearAlgebra.mul!(
7272
return C
7373
end
7474

75-
function isblasmatrix(A::StridedView{T, 2}) where {T <: LinearAlgebra.BlasFloat}
75+
isblasmatrix(A::StridedView{T, 2}) where {T} = false
76+
function isblasmatrix(A::StridedView{T, 2, <:Array}) where {T <: LinearAlgebra.BlasFloat}
7677
if A.op == identity
7778
return stride(A, 1) == 1 || stride(A, 2) == 1
7879
elseif A.op == conj
@@ -81,6 +82,17 @@ function isblasmatrix(A::StridedView{T, 2}) where {T <: LinearAlgebra.BlasFloat}
8182
return false
8283
end
8384
end
85+
@static if isdefined(Core, :Memory)
86+
function isblasmatrix(A::StridedView{T, 2, <:Memory}) where {T <: LinearAlgebra.BlasFloat}
87+
if A.op == identity
88+
return stride(A, 1) == 1 || stride(A, 2) == 1
89+
elseif A.op == conj
90+
return stride(A, 2) == 1
91+
else # should never happen
92+
return false
93+
end
94+
end
95+
end
8496
function getblasmatrix(A::StridedView{T, 2}) where {T <: LinearAlgebra.BlasFloat}
8597
if A.op == identity
8698
if stride(A, 1) == 1

0 commit comments

Comments
 (0)