rusty-shaper: 3x faster, lower-memory input-shaper calibration (Classic fallback retained) - #258
Draft
pdscomp wants to merge 1 commit into
Draft
rusty-shaper: 3x faster, lower-memory input-shaper calibration (Classic fallback retained)#258pdscomp wants to merge 1 commit into
pdscomp wants to merge 1 commit into
Conversation
Contributor
Author
Feedback from @suchmememanyskill
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
rusty-shaper: 3x faster, lower-memory input-shaper calibration (Classic fallback retained)
Split from #252. Draft — commits not yet merged into this branch.
Why this PR
Classic input-shaper calibration is the largest single memory event on the CC1: Python Welch-PSD arrays scale with the full capture. This PR (a) bounds Classic's allocations, and (b) adds Rusty Shaper as the default implementation — same output, 68% faster, with UI and camera left running the whole time.
Justification / measurements (A/B on same flashed CC1; both selected MZV, X 55.4 Hz, Y 47.2 Hz)
MemAvailableConservative result: Classic stops Grumpy/uStreamer during calibration; Rusty leaves both running and still wins.
Correctness gate:
cargo test --lockedreplays 14 real community captures against Kalico-generated goldens (693cd75b); recommended shaper matches exactly, frequency within 0.5 Hz, per-shaper metrics within tolerances.TBD: numbers re-measured on an image containing only this change set.
What changed
8450784: Kalico Welch PSD accumulates FFT energy in fixed 64-window batches;float32captures; largest temporaries bounded by batch size, not capture length. Classic path stays available and gets safer.8190d07: packages Rusty Shaper (GPL-3, checksummed Cargo deps), integrates into image/settings/macros.input_shaper = rustydefault;classicis one setting away. Async worker — never blocks Klipper's reactor.Risk / rollback
Low. Fallback is
input_shaper = classicin settings — no reflash needed to revert behavior. Batch FFT patch is algorithmically identical (accumulation order only).