From 3c1996f3f5829fc8c6d2d80e5329c19bc39da5b3 Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Tue, 17 Oct 2023 14:21:36 +0530 Subject: [PATCH 1/3] Aggressive constprop in sparse * dense --- src/linalg.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/linalg.jl b/src/linalg.jl index 7acf5369..4d56bae0 100644 --- a/src/linalg.jl +++ b/src/linalg.jl @@ -35,7 +35,7 @@ LinearAlgebra.generic_matmatmul!(C::StridedMatrix, tA, tB, A::SparseMatrixCSCUni LinearAlgebra.generic_matvecmul!(C::StridedVecOrMat, tA, A::SparseMatrixCSCUnion, B::DenseInputVector, _add::MulAddMul) = spdensemul!(C, tA, 'N', A, B, _add) -function spdensemul!(C, tA, tB, A, B, _add) +Base.@constprop :aggressive function spdensemul!(C, tA, tB, A, B, _add) if tA == 'N' _spmatmul!(C, A, LinearAlgebra.wrap(B, tB), _add.alpha, _add.beta) elseif tA == 'T' From cf30ef7965cec79c211bedae75a18b5f5185def6 Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Tue, 17 Oct 2023 14:27:41 +0530 Subject: [PATCH 2/3] constprop in generic_matmatmul for dense * sparse --- src/linalg.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/linalg.jl b/src/linalg.jl index 4d56bae0..c5d16279 100644 --- a/src/linalg.jl +++ b/src/linalg.jl @@ -97,7 +97,7 @@ end *(A::AdjOrTrans{<:Any,<:AbstractSparseMatrixCSC}, B::DenseTriangular) = (T = promote_op(matprod, eltype(A), eltype(B)); mul!(similar(B, T, (size(A, 1), size(B, 2))), A, B)) -function LinearAlgebra.generic_matmatmul!(C::StridedMatrix, tA, tB, A::DenseMatrixUnion, B::AbstractSparseMatrixCSC, _add::MulAddMul) +Base.@constprop :aggressive function LinearAlgebra.generic_matmatmul!(C::StridedMatrix, tA, tB, A::DenseMatrixUnion, B::AbstractSparseMatrixCSC, _add::MulAddMul) transA = tA == 'N' ? identity : tA == 'T' ? transpose : adjoint if tB == 'N' _spmul!(C, transA(A), B, _add.alpha, _add.beta) From 634ff3fc929462e224196fd6ff4e3e3ac0073ce7 Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Wed, 18 Oct 2023 20:18:43 +0530 Subject: [PATCH 3/3] constprop in sparsevec multiplication --- src/sparsevector.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sparsevector.jl b/src/sparsevector.jl index 45034b9f..7a3a407a 100644 --- a/src/sparsevector.jl +++ b/src/sparsevector.jl @@ -1847,7 +1847,7 @@ function (*)(A::_StridedOrTriangularMatrix{Ta}, x::AbstractSparseVector{Tx}) whe mul!(y, A, x) end -function LinearAlgebra.generic_matvecmul!(y::AbstractVector, tA, A::StridedMatrix, x::AbstractSparseVector, +Base.@constprop :aggressive function LinearAlgebra.generic_matvecmul!(y::AbstractVector, tA, A::StridedMatrix, x::AbstractSparseVector, _add::MulAddMul = MulAddMul()) if tA == 'N' _spmul!(y, A, x, _add.alpha, _add.beta) @@ -1967,7 +1967,7 @@ function densemv(A::AbstractSparseMatrixCSC, x::AbstractSparseVector; trans::Abs end # * and mul! -function LinearAlgebra.generic_matvecmul!(y::AbstractVector, tA, A::AbstractSparseMatrixCSC, x::AbstractSparseVector, +Base.@constprop :aggressive function LinearAlgebra.generic_matvecmul!(y::AbstractVector, tA, A::AbstractSparseMatrixCSC, x::AbstractSparseVector, _add::MulAddMul = MulAddMul()) if tA == 'N' _spmul!(y, A, x, _add.alpha, _add.beta)