-
Notifications
You must be signed in to change notification settings - Fork 109
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
Backport filt
fix (#516 and #539) and bump version to 0.7.10
#566
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release-0.7 #566 +/- ##
==============================================
Coverage ? 97.03%
==============================================
Files ? 18
Lines ? 3104
Branches ? 0
==============================================
Hits ? 3012
Misses ? 92
Partials ? 0 ☔ View full report in Codecov by Sentry. |
Tests fail on nightly, but that's unrelated, pre-existing on v0.7.9, and should be "solved" with #565. |
* create `si` only once, and reuse * no inbounds faster for N < 24 * @generated `_small_filt_fir!` - use Base.Cartesian.@ntuple * inbounds if N > 18 major speedups for N > 18, much slower if inbounds for small N * reorder store in `_filt_fir` and `_filt_iir` >20% faster for fir * maybe prevent undefvarerror no need to assign values to enum * small things - eachindex stuff - `==` to `===` nothing - `npairs = max(nz, np)` * isone, iszero, etc. * `filt` for `FIRFilter`: remove redundant definitions * extract type instability from loop * remove fft conv type instability - in `unsafe_conv_kern_os!` - probably no real impact * correct `filt` arg types * nicer loop * inv plan * cleanup filt_order * use `muladd`s in filt.jl * `_prod_freq` * more `muladd`s * `fill!`, `reverse`, don't broadcast scalar / * micro-optimizations, cosmetics - reduced exceptions in `@code_llvm` for `N < 18` - `@noinline mul!`, `broadcast`, only for julia > v1.8 - name `SMALL_FILT_VECT_CUTOFF`, selective bounds check * Compat noinline * add test for error (cherry picked from commit 9de4c0c)
In some cases when `filt(::FIRFilter{FIRArbitrary}, x)` is called with certain values of `x`, `filt!(buffer, ::FIRFilter{FIRArbitrary}, x)` tries to write one sample too many to the buffer and a `BoundsError` is thrown. Add one extra sample to the buffer to catch these exceptional cases. (This code is really a hack and simply works around the deeper problem of calculating the correct output buffer length; this should instead be addressed properly in a future change.) Closes #317. (cherry picked from commit 73d3214)
ba53078
to
0079c28
Compare
filt
fix (#516 and #539)filt
fix (#516 and #539) and bump version to 0.7.10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may also be worth noting again (in release notes?) that a portion of #516's fix is for 1.9/1.10, and kind of trashes performance for at least 1.6...
Some time ago I was working on a sort of multi-versioning inside a generated function, but iirc it was rather finicky.
Ok, I think there's a way to mitigate the optimized So, on my For clarity, the regression I'm talking about, all on Julia 1.6: julia> x = rand(10_000); out = similar(x);
julia> function testvars(n)
a, b = 1., rand(n)
si, bs = zeros(n - 1), Val(n)
return (a, b, si, bs)
end
testvars (generic function with 1 method)
julia> @btime filt!($out, b, a, $x, si) setup=((a, b, si) = testvars(15));
18.400 μs (2 allocations: 96 bytes) # master
32.300 μs (0 allocations: 0 bytes) # tweaks branch
19.000 μs (0 allocations: 0 bytes) # tweaks branch, revert commit 407d30bd
julia> @btime filt!($out, b, a, $x, si) setup=((a, b, si) = testvars(18));
18.600 μs (2 allocations: 96 bytes)
47.600 μs (0 allocations: 0 bytes)
18.900 μs (0 allocations: 0 bytes)
julia> @btime filt!($out, b, a, $x, si) setup=((a, b, si) = testvars(30));
36.100 μs (2 allocations: 96 bytes)
34.400 μs (0 allocations: 0 bytes)
21.500 μs (0 allocations: 0 bytes)
julia> @btime filt!($out, b, a, $x, si) setup=((a, b, si) = testvars(50));
85.500 μs (2 allocations: 96 bytes)
47.300 μs (0 allocations: 0 bytes)
32.000 μs (0 allocations: 0 bytes) |
I was hoping for something which makes the backport simpler, not tack even more stuff on which hasn't even landed in master yet and might itself warrant some detailed review/discussion. If you open a PR, we discuss, backport (hoping it backports cleanly) ... that will take quite a while and the point is to do a timely release of v0.7.10 to get the bugfix out. So, I'll go ahead with this as is. If you PR your tweaks we can always think about backporting them and doing a v0.7.11, but finally cutting v0.8.0 would also be quite something... |
Backports #539 and, as a prerequisite, #516. (A more targeted subset of the latter might be in order, but including it wholesale was simplest to do.)