Express borrowed k-mer and alignment buffers with spans

Merged
AD
1mo ago
+132-69

Use std::span where code borrows a contiguous buffer:

  • Give the k-mer extractor's stored lookup table its actual fixed extent of 128 entries.
  • Replace Bloom-filter batch pointer pairs with spans, and bound SIMD loops by the remaining element count.
  • Pass the tail of an alignment seed directly to expand, removing a temporary vector allocation and copy.

The extractor still borrows its table, and the batch/seed functions consume their inputs synchronously. Consumers must rebuild and update raw pointer-pair calls; stored index formats are unchanged.

Validation: 41 Bloom/k-mer tests, including empty and short batches; seed expansion/lifetime probes and affected translation-unit compilation. The extractor's size is unchanged, its optimized encode functions are byte-identical, and Bloom batch functions retain their vector instructions with three fewer total instructions each (GCC).

Depends on #649 for C++20.


Summary by cubic

Expresses borrowed contiguous buffers as std::span across Bloom filters, k-mer extraction, and seed expansion. This removes raw pointer-pair arguments and a temporary vector allocation when expanding a seed from the tail of another seed, and moves Seed::expand out of the header to avoid a GCC 13 warning.

  • Bloom-filter batch insert and check now take std::span<const uint64_t> instead of pointer pairs, with SIMD loops bounded by the remaining element count.
  • The k-mer extractor's lookup table is stored as a fixed-size std::span<const uint8_t, 128>, preserving the borrowed lifetime contract with the actual extent.
  • Seed::expand now accepts a span, so the aligner can pass a slice of the current seed's nodes directly; its definition lives in the .cpp file.
  • Pulls in SDSL C++20 integration and dependency configuration cleanup from the parent branch.
  • Adds tests covering SIMD boundary cases, empty views, borrowed table mutation, and seed expansion from a borrowed tail.

Consumers must update raw pointer-pair calls to pass spans; stored index formats and extractor size are unchanged.