Repository navigation
Vectorize the BiWFA overlap scan (affine2p BiWFA ~2x faster) - #49
Merged
Merged
Conversation
At every BiWFA step the new wavefronts are checked against the last max_score_scope scores of the other direction: one M scan plus four I1/D1/I2/D2 scans for affine2p. Only the M scan had SIMD (NEON); the indel scans, and every scan on x86, were scalar. Profiling affine2p ultralow put 73% of the time there. C has AVX2/AVX-512 versions of both scans, which is why C built with -march=native was ~2x faster than Rust on x86. All five scans now share scan_overlap: chunks of 8 diagonals are tested at once (NEON, or AVX2 inlined with target-cpu=native and runtime-detected otherwise), and only a chunk with a candidate is rechecked diagonal by diagonal. The visiting order is unchanged, so the breakpoint (and output) is the same as the scalar scan and C. M2: affine2p ultralow 0.38-0.52x C (was ~1.0x); affine 0.82x; others unchanged. Differential harness clean (20 known #22 diffs). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Open
11 of 18 tasks
Member
Author
|
Measured on x86 (EPYC 7713,
|
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.
Part of #31. After #45 and #48, the full EPYC 7713 sweep (
compute-5-6,8ccfb64) left affine2p BiWFA (--wfa-memory ultralow) as the main case where Rust is slower than C: 1.08–1.15× generic C, ~2.2× C built with-march=native, and 1.2–1.4× C's instructions.Cause
At every BiWFA step,
bialign_overlapchecks the new wavefronts against the lastmax_score_scopescores of the other direction. For affine2p that is one M scan plus four I1/D1/I2/D2 scans, with a scope of about 25 under the default penalties.sampleprofile on the M2 put 73% of affine2p BiWFA time inbialign_overlap, with 11% each for compute and extend.wavefront_bialign_breakpoint_*_avx2), used when built with-march=native. That's the C-native gap on x86.Change
scan_overlap(src/bialign.rs).target-cpu=nativeand runtime-detected otherwise.Results (M2, ultralow with CIGAR output, C 3282f83)
mainTesting
mainfor every case above.target-cpu=haswell) and a generic build match C on 1k and 10k subsets, across 7 penalty configurations.cargo test: 271 passed.cargo clippy --all-targets -D warnings: clean.Still to check on x86: a
bench/sweep.pyrun onhpcbioamdandhpcbio. I expect affine2p ultralow to end up near or below C-native.🤖 Generated with Claude Code