Skip to content

Commit 1df670e

Browse files
authored
Switch to using LinearAlgebra.BLAS (#61)
Currently some of the rules are calling `blascopy!` and `scal!` without qualification, which fails, since we haven't done a full `using` for the BLAS submodule. This adds a `using` and an `import` for `dot` on earlier versions of Julia to avoid a name conflict between LinearAlgebra and BLAS which has since been fixed.
1 parent 8f754f3 commit 1df670e

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/ChainRules.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,17 @@ module ChainRules
22

33
using Cassette
44
using LinearAlgebra
5+
using LinearAlgebra.BLAS
56
using Base.Broadcast: materialize, materialize!, broadcasted, Broadcasted, broadcastable
67

7-
import NaNMath, SpecialFunctions, LinearAlgebra, LinearAlgebra.BLAS
8+
if VERSION < v"1.3.0-DEV.142"
9+
# In prior versions, the BLAS submodule also exported `dot`, which caused a conflict
10+
# with its parent module. To get around this, we can simply create a hard binding for
11+
# the one we want to use without qualification.
12+
import LinearAlgebra: dot
13+
end
14+
15+
import NaNMath, SpecialFunctions
816

917
export AbstractRule, Rule, frule, rrule
1018

src/rules/linalg/blas.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ package (https://github.com/invenia/DiffLinearAlgebra.jl).
44
=#
55

66
using LinearAlgebra: BlasFloat
7-
using LinearAlgebra.BLAS: gemm
87

98
_zeros(x) = fill!(similar(x), zero(eltype(x)))
109

0 commit comments

Comments
 (0)