-
Notifications
You must be signed in to change notification settings - Fork 42
WIP: get rid of A*_mul_B! #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## master #74 +/- ##
===========================================
- Coverage 98.50% 88.47% -10.04%
===========================================
Files 10 10
Lines 738 651 -87
===========================================
- Hits 727 576 -151
- Misses 11 75 +64
Continue to review full report at Codecov.
|
Currently, tests are failing in the linearcombinations tests, where a single allocation counting test fails. I can't reproduce this locally (on macos), tests pass all fine here on all available Julia versions. Would be great if somebody could check out this branch and see if that is spurious. I did notice though that 5-arg mul! with matrices is certainly not allocation-free on Julia v1.3.rc's. using LinearAlgebra, BenchmarkTools
A = rand(100,200)
x = rand(size(A, 2), 10)
y = rand(size(A, 1), 10)
α = rand()
β = rand()
@benchmark mul!($y, $A, $x, $α, $β)
BenchmarkTools.Trial:
memory estimate: 64 bytes
allocs estimate: 3
--------------
minimum time: 19.190 μs (0.00% GC)
median time: 20.584 μs (0.00% GC)
mean time: 24.629 μs (0.00% GC)
maximum time: 475.044 μs (0.00% GC)
--------------
samples: 10000
evals/sample: 1 And it does seem to cost performance. I assume this is due to the generation of the |
This PR requires a little work to merge the other PRs in, e.g., the mulstyle trait. When those are merged, I'll finalize this one and shout again for review. |
I hope to return to #65 ( |
This is totally outdated. I took some of the benchmarks and put them in #116. The final thing that this PR tried to address is to allocate only a single intermediate vector when doing 5-arg map-matrix multiplication for a |
This started innocently, and became a major code overhaul. I realized somewhere in #72 I guess that one can get rid of all the
A*_mul_B!
by dispatchingmul!
on things likeAdjointMap{<:Any,<:SomeLinearMap}
. This turned out to be really nice, because for subtypes ofLinearMap
s, that are invariant under transposition/adjoint, certain combinations are now impossible to obtain by standard means, even when artificially wrapping, say, aCompositeMap
in aLinearMap
and only then taking the tranpose/adjoint. The beauty of it is that, eventually, up to some helper functions, this package is back where at was pre-0.7, that is, provides types and function overloads forBase
orLinearAlgebra
functions (withkronsum
and some symbols the only exceptions).For review, I suggest to skip
blockmap.jl
, because that may require a rebase after #72 is merged (even though I simplified some code already).EDIT: I forgot to mention that this also takes big steps forward in providing specialized 5-arg
mul!
s for both vectors and matrices.