ChainRules.jl
ChainRules.jl copied to clipboard
Smarter conjugation for inplace BLAS rules
@sethaxen wrote in https://github.com/JuliaDiff/ChainRules.jl/pull/279#pullrequestreview-506908830
not allocate new conjugated matrices in the BLAS rules? e.g. in
https://github.com/JuliaDiff/ChainRules.jl/blob/c877550430a3cb0f657f43ccbf4e64b13b7177a7/src/rulesets/LinearAlgebra/blas.jl#L134-L137 , we allocate a new matrix
A, which I think can be made faster by allocating a new vector instead and then conjugating a vector in-place:∂x = InplaceableThunk( @thunk(gemv('N', α', conj(A), ȳ)), x̄ -> conj!(gemv!('N', α, A, conj(ȳ), one(T), conj!(x̄))) )
Definately worth benchmarking