Skip to content

perf(classify): pack move tables; vote once per read - #481

Merged
jayhesselberth merged 1 commit into
mainfrom
fix/479-anchored-read-votes
Oct 11, 2026
Merged

jayhesselberth merged 1 commit into
mainfrom
fix/479-anchored-read-votes

Conversation

@jayhesselberth

Copy link
Copy Markdown
Member

Closes #479

(1) Packed move table: shipped (bar cleared)

AnchoredRead.seq_to_sig: Vec<i64> (8 B/base, held for the whole BAM) becomes moves: PackedMoves (one bit per stride) with AnchoredRead::seq_to_sig() deriving the map where used. A unit test pins the packed expansion equal to the old seq_to_sig_map over 200 random move arrays (values 0/1/2, trailing zeros, non-byte lengths).

Measured on ldx14_frozen_edx06 (70,188 anchored reads, 65,821 classified, 2 POD5, --threads 8, profiling profile), anon RSS peak from /proc/PID/smaps_rollup (Anonymous:, polled 0.2 s), arms interleaved, 3 reps on one node:

arm peak anon RSS (KB)
main 394292 / 393880 / 398492
this PR 268360 / 275616 / 268468

About 125 MB saved, 32% of peak (bar: 10% at test scale or 1 GB at 57 M reads), ~1.8 KB/read, so ~100 GB extrapolated at 57 M reads. Wall unchanged within noise (9.4-10.5 s warm; the first main rep was cold, 38 s).

Identity: cl tags and TSV byte-for-byte equal after sorting in all 3 reps (BAM record bodies equal in order, 73,551 records; TSV 70,189 lines).

(2) One vote per read: shipped (correctness fix)

Votes are now tallied from the deduped map after the scan (BamScan::tally_votes), not per record. a_read_with_several_alignments_votes_once_on_the_one_kept fails with the old per-record counting (time: 3, reversed: 1, total 4 instead of 2). On the real run the frame vote is unchanged (time=0, reversed=66943 on both): secondary and supplementary records are already skipped, so multi-anchored reads do not occur in this set.

Not changed

Scorers, GPU, the waveform path's layout. Library callers: AnchoredRead::seq_to_sig is a method now; the field is moves. Benches updated.

CI-equivalent run clean (fmt, workspace clippy --all-targets, gpu x3, waveform-onnx, models-download, train, crf-decode, classify benches; nextest workspace/cli experimental/classify waveform-onnx; doctests).

@jayhesselberth
jayhesselberth merged commit 7716b4c into main Oct 11, 2026
9 checks passed
@jayhesselberth
jayhesselberth deleted the fix/479-anchored-read-votes branch October 11, 2026 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

classify: compact AnchoredRead.seq_to_sig; count orientation votes once per read

1 participant