Skip to content

Commit 5977da5

Browse files
committed
More specific error
1 parent 6e8533d commit 5977da5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/linalg.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ end
3232

3333
# Supported values are :auto, :MPS, :MPSGraph, and :GPUArrays
3434
const matmul_alg = ScopedValue(:auto)
35-
matmul_alg_error(alg, inT, outT) = error("Matrix multiplication algorithm `:$alg` is not supported for input eltype $inT and output eltype $outT.")
35+
matmul_alg_error(alg, inT, outT, vec) = error("Matrix-$(vec ? "Vector" : "Matrix") multiplication algorithm `:$alg` is not supported for input eltype $inT and output eltype $outT.")
3636

3737
LinearAlgebra.generic_matmatmul!(C::MtlMatrix, tA, tB, A::MtlMatrix, B::MtlMatrix, _add::MulAddMul) =
3838
LinearAlgebra.generic_matmatmul!(C, tA, tB, A, B, _add.alpha, _add.beta)
@@ -64,10 +64,10 @@ LinearAlgebra.generic_matmatmul!(C::MtlMatrix, tA, tB, A::MtlMatrix, B::MtlMatri
6464
mpsgraph_supported = supports_mpsgraph_matmul(A, B, C, MPSGRAPH_VALID_MATMUL_TYPES)
6565
# If possible, dispatch to MPSGraphs, then performance shaders
6666
if alg === :MPSGraph || (alg === :auto && mpsgraph_supported && !should_use_MPS(A, B, C))
67-
mpsgraph_supported || matmul_alg_error(alg, eltype(A), eltype(C))
67+
mpsgraph_supported || matmul_alg_error(alg, eltype(A), eltype(C), false)
6868
graph_matmul!(C, A, B, alpha, beta, transA, transB)
6969
elseif alg === :MPS || (alg === :auto && mps_supported)
70-
mps_supported || matmul_alg_error(alg, eltype(A), eltype(C))
70+
mps_supported || matmul_alg_error(alg, eltype(A), eltype(C), false)
7171
matmul!(C, A, B, alpha, beta, transA, transB)
7272
elseif alg === :GPUArrays || alg === :auto
7373
GPUArrays.generic_matmatmul!(C, wrap(A, tA), wrap(B, tB), alpha, beta)
@@ -106,10 +106,10 @@ LinearAlgebra.generic_matvecmul!(C::MtlVector, tA::AbstractChar, A::MtlMatrix, B
106106
mpsgraph_supported = supports_mpsgraph_matmul(A, B, C, MPSGRAPH_VALID_MATVECMUL_TYPES)
107107
# If possible, dispatch to MPSGraphs, then performance shaders
108108
if alg === :MPSGraph || (alg === :auto && mpsgraph_supported)
109-
mpsgraph_supported || matmul_alg_error(alg, eltype(A), eltype(C))
109+
mpsgraph_supported || matmul_alg_error(alg, eltype(A), eltype(C), true)
110110
graph_matvecmul!(C, A, B, alpha, beta, transA)
111111
elseif alg === :MPS || (alg === :auto && mps_supported)
112-
mps_supported || matmul_alg_error(alg, eltype(A), eltype(C))
112+
mps_supported || matmul_alg_error(alg, eltype(A), eltype(C), true)
113113
matvecmul!(C, A, B, alpha, beta, transA)
114114
elseif alg === :GPUArrays || alg === :auto
115115
GPUArrays.generic_matmatmul!(C, wrap(A, tA), B, alpha, beta)

0 commit comments

Comments
 (0)