8000 perf(seed): raise SA-lookup batch depth 20 -> 128 for more MLP by nh13 · Pull Request #48 · nh13/minibwa · GitHub
[go: up one dir, main page]

Skip to content

perf(seed): raise SA-lookup batch depth 20 -> 128 for more MLP - #48

Draft
nh13 wants to merge 1 commit into
masterfrom
perf/sa-batch-128
Draft

nh13 wants to merge 1 commit into
masterfrom
perf/sa-batch-128

Conversation

@nh13
@nh13 nh13 commented Sep 7, 2026
Copy link
Copy Markdown
Owner

Summary

Raise the SA-lookup batch depth in mb_anchor (seed.c) from 20 to 128. This is the number of small SA intervals accumulated before mb_bwt_sa_batch() resolves them together; a deeper batch keeps more independent SA walks in flight, so the software-pipelined prefetch hides more FM-index DRAM latency per stall.

Output is byte-identical

The change only affects how many SA lookups are batched, never their results. Verified SAM byte-identical to stock (order-independent record comparison):

  • arm64 (M3 Ultra): WGS 10,048,111 records + HiFi 122,111 records — IDENTICAL
  • x86 AVX2 (AMD EPYC / c6a): WGS 10,032,791 records — IDENTICAL

Performance

Whole-aligner wall, -t 16, hg38, runs sized to >=30 s:

  • arm64 (idle M3 Ultra): +1.9% short-read (WGS 5M), +3.9% HiFi. 128 beat 64.
  • x86 AVX2 (c6a): +0.53% — non-regressive (the extra prefetch depth is MSHR-capped on x86, so it is neutral-to-slightly-positive rather than a win).

Safety

batch_size sizes nothing on the stack: m_a = max(max_occ, batch_size) and the working arrays a/b are Kmalloc'd to m_a, and the flush test q->size + m > batch_size is a threshold. Raising the constant only enlarges a heap allocation and defers flushes.

cf. lh3#16, which proposed 64.

mb_anchor() batches suffix-array lookups (mb_bwt_sa_batch) so their cold-DRAM
latency overlaps. Raising the batch depth from 20 to 128 keeps more SA walks in
flight, hiding more of the 6.4 GB BWT's memory latency. Byte-identical: the depth
only changes how many lookups overlap, not the results.

Measured end-to-end wall on an idle arm64 host (M3 Ultra), >=30s runs, SAM
byte-identical: +1.9% WGS short-read (5M pairs, 31.8s) and +3.9% HiFi (110k reads,
43s). 128 beat 64 on both workloads. cf. lh3#16 (which filed 64).
@coderabbitai
coderabbitai Bot commented Sep 7, 2026 •
Copy link
Copy Markdown

Note

Reviews paused

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nh13 nh13 added feature review vehicle for a manifest feature; never a merge vehicle uninstalled No features.toml block yet; not installed into the distribution (dist). Remove when installed. labels Sep 7, 2026
@nh13
nh13 commented Sep 7, 2026
Copy link
Copy Markdown
Owner Author

@coderabbitai pause

@coderabbitai
coderabbitai Bot commented Sep 7, 2026
Copy link
Copy Markdown
✅ Action performed

Reviews paused.

nh13 added a commit that referenced this pull request Oct 20, 2026
Raise the SA-lookup batch depth in mb_anchor from 20 to 128 (#48).
Placed after cp-occ-backend and before the alt-liftgroup hub so every existing
feature keeps its merge order. A trial assembly onto master 74bdd48 merged all
18 features with none dropped, and every byte-identity gate passed.
@nh13 nh13 removed the uninstalled No features.toml block yet; not installed into the distribution (dist). Remove when installed. label Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature review vehicle for a manifest feature; never a merge vehicle

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0