|
cuSBF
|
Namespaces | |
| namespace | xxhash |
| XXHash_64 implementation from. | |
Classes | |
| struct | BitwiseOr |
Device functor for bitwise OR reduction (CUB WarpReduce). More... | |
| class | ChunkStreamPair |
| Two non-blocking CUDA streams for overlapping chunk H2D and kernel work. More... | |
| struct | cuda_free_memory |
| Driver-reported free device memory (bytes available for new allocations). More... | |
| struct | DensePackedKmerInput |
| Device-side view of a dense packed symbol sequence. More... | |
| class | FastxBufferReader |
| FASTA/FASTQ parser over a contiguous in-memory buffer. More... | |
| class | FastxFileBuffer |
| Read-only contiguous file payload for in-memory FASTX parsing. More... | |
| class | FastxPinnedSequenceBuffer |
| Page-locked host buffer for fused FASTX normalize + H2D staging. More... | |
| class | FastxPipelineReleaseGuard |
| class | FastxPipelineState |
| class | FastxReader |
| Streaming FASTA/FASTQ parser. More... | |
| struct | FastxRecord |
| A single sequence record extracted from a FASTA/FASTQ stream. More... | |
| class | GzIstream |
std::istream adapter for GzStreambuf. More... | |
| class | GzStreambuf |
std::streambuf over a gzip file (zlib gzread). More... | |
| class | QueryLayout |
| struct | QueryLayoutRecord |
| struct | SaltLiteral |
| struct | SaltLiteral< 0 > |
| struct | SaltLiteral< 1 > |
| struct | SaltLiteral< 10 > |
| struct | SaltLiteral< 11 > |
| struct | SaltLiteral< 12 > |
| struct | SaltLiteral< 13 > |
| struct | SaltLiteral< 14 > |
| struct | SaltLiteral< 15 > |
| struct | SaltLiteral< 2 > |
| struct | SaltLiteral< 3 > |
| struct | SaltLiteral< 4 > |
| struct | SaltLiteral< 5 > |
| struct | SaltLiteral< 6 > |
| struct | SaltLiteral< 7 > |
| struct | SaltLiteral< 8 > |
| struct | SaltLiteral< 9 > |
| struct | SequenceKmerInput |
| Device-side view of an encoded sequence for k-mer / s-mer counting. More... | |
Concepts | |
| concept | cusbf_result_like |
| concept | fastx_dispatch_handler |
| Handler invoked by dispatch_fastx_file with either reader type and a dispatch path. | |
Typedefs | |
| template<typename Handler > | |
| using | fastx_dispatch_handler_result_t = std::invoke_result_t< Handler &, FastxReader &, fastx_dispatch_path > |
| Return type of a fastx_dispatch_handler when invoked with a stream reader. | |
Enumerations | |
| enum class | fastx_chunk_mode { insert , query } |
| FASTX mode used to size GPU staging buffers. More... | |
| enum class | fastx_dispatch_path { single_chunk_stream , single_chunk_mmap , chunked_mmap , chunked_stream } |
| How a FASTX file is read and chunked for GPU processing. More... | |
| enum class | FastxFormat : uint8_t { unknown , fasta , fastq } |
| Detected file format for a FASTA/FASTQ stream. More... | |
Variables | |
| constexpr size_t | kDefaultFastxHostRamSlackBytes = 4u << 30 |
| Default headroom left for the OS and other processes when sizing mmap. | |
| constexpr uint32_t | kContainsSequenceStride = 4 |
| K-mers processed per query thread per inner loop iteration. | |
| constexpr uint64_t | kInvalidHash = std::numeric_limits<uint64_t>::max() |
| Sentinel hash value indicating "no valid minimizer found". | |
| using cusbf::detail::fastx_dispatch_handler_result_t = typedef std::invoke_result_t<Handler&, FastxReader&, fastx_dispatch_path> |
Return type of a fastx_dispatch_handler when invoked with a stream reader.
Definition at line 136 of file fastx_dispatch.hpp.
FASTX mode used to size GPU staging buffers.
| Enumerator | |
|---|---|
| insert | |
| query | |
Definition at line 24 of file fastx_chunk.cuh.
How a FASTX file is read and chunked for GPU processing.
Definition at line 29 of file fastx_dispatch.hpp.
|
strong |
| __device__ __forceinline__ uint64_t cusbf::detail::advance_packed_kmer | ( | uint64_t | packed, |
| uint8_t | new_base | ||
| ) |
Slides a packed k-mer window by one encoded base.
Definition at line 86 of file sequence_kmer.cuh.
| __device__ __forceinline__ void cusbf::detail::atomicOrWord | ( | uint64_t * | ptr, |
| uint64_t | value | ||
| ) |
64-bit atomic OR used for sectorized Bloom inserts.
Definition at line 137 of file filter_common.cuh.
| __device__ __forceinline__ uint32_t cusbf::detail::build_stride_kmer_valid_mask | ( | uint64_t | thread_offset, |
| uint64_t | block_kmers, | ||
| bool | block_all_valid, | ||
| const uint8_t * | sequence_tile | ||
| ) |
Builds the per-thread validity bitmask for strided query kernels.
Definition at line 129 of file sequence_kmer.cuh.
|
inline |
Appends the next FASTX record from reader into chunk.
Definition at line 13 of file fastx_dense_batch.hpp.
| __global__ void cusbf::detail::contains_dense_packed_kmers_kernel | ( | DensePackedKmerInput< Config > | input, |
| device_span< const filter_block< Config > > | shards, | ||
| device_span< uint8_t > | output | ||
| ) |
Query kernel for a dense packed symbol buffer (DensePackedKmerInput).
Definition at line 248 of file kernels.cuh.
| __device__ __forceinline__ void cusbf::detail::contains_kmers_from_symbol_tile | ( | const uint8_t * | sequence_tile, |
| uint64_t | block_start_kmer, | ||
| uint64_t | block_kmers, | ||
| bool | block_all_valid, | ||
| device_span< const filter_block< Config > > | shards, | ||
| device_span< uint8_t > | output | ||
| ) |
Shared query path after a block symbol tile has been prepared.
Used by both byte-sequence and dense-packed symbol kernels.
Definition at line 41 of file kernels.cuh.
| __global__ void cusbf::detail::contains_sequence_kmers_kernel | ( | SequenceKmerInput< Config > | input, |
| device_span< const filter_block< Config > > | shards, | ||
| device_span< uint8_t > | output | ||
| ) |
Query kernel: one byte per k-mer (1 = present, 0 = absent or invalid).
Threads stride kContainsSequenceStride k-mers, warps sharing a shard load it once.
Definition at line 180 of file kernels.cuh.
|
inline |
Fills positive_kmers_out with per-record positive k-mer counts.
positive_kmers_out must hold at least records.size() elements.
Definition at line 70 of file count_positive_kmers.cuh.
| __global__ void cusbf::detail::count_positive_kmers_per_record_kernel | ( | const uint8_t * | hits, |
| const QueryLayoutRecord * | records, | ||
| uint64_t * | positive_kmers_out, | ||
| uint64_t | record_count | ||
| ) |
Per-record kernel: sums hits[hit_offset ..] for each QueryLayoutRecord.
Definition at line 22 of file count_positive_kmers.cuh.
|
inline |
Device-wide count of set bits in a per-k-mer hit buffer.
Definition at line 50 of file count_positive_kmers.cuh.
Maximum uint64_t words loaded for a dense-packed insert block tile.
Definition at line 22 of file kernels.cuh.
Returns the number of k-mer windows in a dense packed symbol sequence.
Definition at line 26 of file dense_packed.cuh.
Maximum uint64_t words loaded for a dense-packed query block tile.
Definition at line 29 of file kernels.cuh.
| __device__ __forceinline__ uint8_t cusbf::detail::dense_packed_symbol_at | ( | const uint64_t * | words, |
| uint64_t | symbol_index | ||
| ) |
Decodes one packed symbol at global index symbol_index.
Definition at line 59 of file dense_packed.cuh.
| __device__ __forceinline__ uint8_t cusbf::detail::dense_packed_symbol_at_local | ( | const uint64_t * | word_tile, |
| uint64_t | first_word_index, | ||
| uint64_t | symbol_index | ||
| ) |
Decodes one packed symbol from a block-local word tile.
Definition at line 69 of file dense_packed.cuh.
Encoded symbols stored in each uint64_t word for Config.
Definition at line 14 of file dense_packed.cuh.
Returns the number of uint64_t words required for num_symbols encoded symbols.
Definition at line 20 of file dense_packed.cuh.
| fastx_dispatch_handler_result_t< Handler > cusbf::detail::dispatch_fastx_file | ( | const std::filesystem::path & | path, |
| fastx_chunk_mode | mode, | ||
| double | fill_fraction, | ||
| Handler && | handler | ||
| ) |
Opens a FASTX path and invokes handler with a reader and dispatch path.
handler receives the reader and how the file was opened. Small files use fastx_dispatch_path::single_chunk_stream, GPU-sized inputs use fastx_dispatch_path::single_chunk_mmap, larger inputs use pipelined mmap or stream.
Definition at line 159 of file fastx_dispatch.hpp.
|
constexprnoexcept |
Peak device bytes for insert staging (d_sequence_) for a host chunk.
Definition at line 82 of file fastx_chunk.cuh.
|
constexprnoexcept |
Upper bound on normalized sequence bytes for a raw host chunk.
Definition at line 75 of file fastx_chunk.cuh.
|
constexprnoexcept |
Peak device bytes for query staging (d_sequence_ + d_resultBuffer_).
Definition at line 89 of file fastx_chunk.cuh.
|
constexpr |
Extracts an m-mer or s-mer subwindow from a packed k-mer at start.
Definition at line 130 of file filter_common.cuh.
|
inlineconstexprnoexcept |
True when raw_chunk_bytes reaches the optional host assembly cap.
Definition at line 40 of file fastx_host_limits.cuh.
|
constexprnoexcept |
Whether estimated device staging meets or exceeds staging_budget_bytes.
Definition at line 110 of file fastx_chunk.cuh.
|
inlinenoexcept |
Whether a host chunk should flush based on GPU staging and host byte limits.
Definition at line 143 of file fastx_chunk.cuh.
Reserved device memory left for allocator and kernel temporaries.
Definition at line 44 of file fastx_chunk.cuh.
1-based column at byte_index within line (clamped to the line end).
Definition at line 268 of file Fastx.hpp.
Definition at line 48 of file fastx_chunk.cuh.
|
inline |
Whether the entire uncompressed file fits in one GPU staging pass.
Definition at line 158 of file fastx_chunk.cuh.
True when uncompressed path size is within fastx_memory_map_max_bytes.
Definition at line 66 of file fastx_host_memory.cuh.
True when path is not gzip-compressed (mmap path is usable).
Definition at line 164 of file fastx_file_buffer.hpp.
|
inline |
Whether the entire file fits in a single GPU staging chunk at fill_fraction.
Definition at line 56 of file fastx_dispatch.hpp.
|
inline |
Optional host assembly byte cap before flush (debug / low-RAM safety valve).
Returns SIZE_MAX when unset so fastx_chunk_should_flush uses GPU staging only.
Definition at line 25 of file fastx_host_limits.cuh.
|
inline |
Definition at line 22 of file fastx_host_memory.cuh.
|
constexprnoexcept |
True for fastx_dispatch_path::single_chunk_stream or fastx_dispatch_path::single_chunk_mmap.
Definition at line 42 of file fastx_dispatch.hpp.
|
inline |
Upper bound on file bytes that may be mmap'd (env cap and available RAM minus slack).
Definition at line 48 of file fastx_host_memory.cuh.
|
constexprnoexcept |
Per-chunk flush budget for dual-stream ping-pong (two device sequence buffers).
Definition at line 131 of file fastx_chunk.cuh.
|
inline |
1-based column of the first quality byte that exceeds expected_length.
Definition at line 276 of file Fastx.hpp.
|
inline |
Definition at line 68 of file fastx_chunk.cuh.
Definition at line 63 of file fastx_chunk.cuh.
|
inline |
Max raw file size for fastx_dispatch_path::single_chunk_stream (istream, no mmap).
Larger files that still fit one GPU chunk use fastx_dispatch_path::single_chunk_mmap.
Definition at line 77 of file fastx_dispatch.hpp.
|
constexprnoexcept |
Device staging byte budget derived from free VRAM and fill_fraction.
Definition at line 97 of file fastx_chunk.cuh.
|
constexprnoexcept |
True when dispatch uses FastxBufferReader over an mmap'd file.
Definition at line 48 of file fastx_dispatch.hpp.
| __host__ __device__ __forceinline__ void cusbf::detail::forEachHashIndex | ( | Fn && | fn | ) |
Invokes fn once per Bloom hash index (compile-time unrolled).
Definition at line 111 of file filter_common.cuh.
| __host__ __device__ __forceinline__ void cusbf::detail::forEachHashIndexImpl | ( | Fn && | fn, |
| std::index_sequence< HashIndices... > | |||
| ) |
Unrolled invocation of fn for each Bloom hash index in Config.
Definition at line 105 of file filter_common.cuh.
Reads env_name via getenv, or an empty view when unset.
Definition at line 32 of file host_parse.hpp.
|
constexpr |
Fast 64-bit integer hash (non-cryptographic).
One multiplicative step followed by an xorshift. Used to hash s-mer packed representations for Bloom bit-position selection.
| key | Input value. |
Definition at line 192 of file hashutil.cuh.
| __global__ void cusbf::detail::insert_dense_packed_kmers_kernel | ( | DensePackedKmerInput< Config > | input, |
| device_span< filter_block< Config > > | shards | ||
| ) |
Insert kernel for a dense packed symbol buffer (DensePackedKmerInput).
Definition at line 283 of file kernels.cuh.
| __device__ __forceinline__ void cusbf::detail::insert_kmers_from_symbol_tile | ( | const uint8_t * | sequence_tile, |
| uint64_t | block_start_kmer, | ||
| uint64_t | block_kmers, | ||
| bool | block_all_valid, | ||
| device_span< filter_block< Config > > | shards, | ||
| cub::WarpReduce< uint64_t >::TempStorage | reduce_storage[warps_per_block][4] | ||
| ) |
Shared insert path after a block symbol tile has been prepared.
Used by both byte-sequence and dense-packed symbol kernels.
Definition at line 107 of file kernels.cuh.
| __global__ void cusbf::detail::insert_sequence_kmers_kernel | ( | SequenceKmerInput< Config > | input, |
| device_span< filter_block< Config > > | shards | ||
| ) |
Insert kernel: sectorized Bloom updates grouped by minimizer shard.
Warp-local segmented reduction merges consecutive k-mers targeting the same shard.
Definition at line 215 of file kernels.cuh.
True when path begins with the gzip magic bytes (0x1F, 0x8B).
Definition at line 101 of file gzstreambuf.hpp.
| __device__ __forceinline__ bool cusbf::detail::kmer_is_valid | ( | const uint8_t * | tile, |
| uint64_t | start | ||
| ) |
True when no symbol in the k-mer window is the alphabet invalid sentinel.
Definition at line 93 of file sequence_kmer.cuh.
| __device__ __forceinline__ void cusbf::detail::load128BitGlobalNC | ( | const uint64_t * | ptr, |
| uint64_t & | out0, | ||
| uint64_t & | out1 | ||
| ) |
Loads 128 bits from global memory using the non-coherent cache path.
Uses the ld.global.nc.v2.u64 instruction for uint64_t
Definition at line 74 of file helpers.cuh.
| __device__ __forceinline__ void cusbf::detail::load256BitGlobalNC | ( | const T * | ptr, |
| T * | out | ||
| ) |
Loads 256 bits from global memory using the non-coherent cache path.
This function uses inline PTX for 256-bit vectorized loads. For uint64_t: loads 4 values (v4.u64) For uint32_t: loads 8 values (v8.u32)
__CUDA_ARCH__ >= 1000 guard at call sites.| T | Element type (uint32_t or uint64_t) |
| ptr | Source pointer (must be 32-byte aligned) |
| out | Output array (4 elements for uint64_t, 8 for uint32_t) |
Definition at line 32 of file helpers.cuh.
| __device__ __forceinline__ void cusbf::detail::load256BitGlobalNC | ( | const uint64_t * | ptr, |
| uint64_t & | out0, | ||
| uint64_t & | out1, | ||
| uint64_t & | out2, | ||
| uint64_t & | out3 | ||
| ) |
Loads four uint64_t words via ld.global.nc.v4.u64 (sm_100+ only).
Definition at line 54 of file helpers.cuh.
| __device__ __forceinline__ void cusbf::detail::load_shard_words4 | ( | const filter_block< Config > * | shards, |
| uint64_t | shard_index, | ||
| uint64_t * | w | ||
| ) |
Loads four 64-bit shard words with 256-bit (sm_100+) or 128-bit vector loads.
Definition at line 64 of file sequence_kmer.cuh.
| uint64_t cusbf::detail::maxOccupancyGridSize | ( | int32_t | blockSize, |
| Kernel | kernel, | ||
| uint64_t | dynamicSMemSize | ||
| ) |
Calculates the maximum occupancy grid size for a kernel.
| Kernel | Type of the kernel function. |
| blockSize | Block size (threads per block). |
| kernel | The kernel function. |
| dynamicSMemSize | Dynamic shared memory size per block. |
Definition at line 115 of file helpers.cuh.
|
constexpr |
Fast 64-bit hash sufficient for uniform minimizer selection.
A single Knuth multiplicative step — provides enough uniformity for shard selection without the full avalanche quality of hash64.
| key | Packed m-mer input. |
Definition at line 207 of file hashutil.cuh.
|
constexpr |
Compile-time multiplicative salt for Bloom hash index Index.
Definition at line 97 of file filter_common.cuh.
|
inline |
Opens a FASTA/FASTQ file for reading.
| path | File path. |
Definition at line 470 of file Fastx.hpp.
| __global__ void cusbf::detail::pack_dense_sequence_kernel | ( | const char * | sequence, |
| uint64_t | num_symbols, | ||
| uint64_t * | words | ||
| ) |
Packs an encoded byte sequence into dense symbolBits-wide uint64_t words.
One thread per output word; reads Config::symbolWidth bytes per symbol via Config::Alphabet::encode.
Definition at line 128 of file dense_packed.cuh.
| __device__ __forceinline__ uint64_t cusbf::detail::pack_kmer_from_tile | ( | const uint8_t * | tile, |
| uint64_t | start | ||
| ) |
Packs K encoded symbols from a shared-memory tile starting at start.
Definition at line 75 of file sequence_kmer.cuh.
| __device__ __forceinline__ uint64_t cusbf::detail::packed_kmer_minimizer_hash | ( | uint64_t | packed_kmer | ) |
Minimum minimizer hash over all m-mers in a packed k-mer.
Definition at line 41 of file sequence_kmer.cuh.
| __device__ __forceinline__ uint64_t cusbf::detail::packed_kmer_smer_hash | ( | uint64_t | packed_kmer, |
| uint64_t | start | ||
| ) |
Bloom hash for the s-mer at start within a packed k-mer.
Definition at line 55 of file sequence_kmer.cuh.
|
constexpr |
Bit mask retaining the low Length symbols of a packed k-mer.
Definition at line 119 of file filter_common.cuh.
|
inline |
Parses a decimal mebibyte count from value.
Accepts a leading decimal prefix (same spirit as strtoull). Returns 0 when value is empty or does not start with digits.
Definition at line 16 of file host_parse.hpp.
Definition at line 14 of file fastx_host_limits.cuh.
| __device__ __forceinline__ bool cusbf::detail::prepare_dense_packed_tiles | ( | const uint64_t * | words, |
| uint64_t | block_start_kmer, | ||
| uint64_t | block_kmers, | ||
| uint64_t * | word_tile, | ||
| uint8_t * | sequence_tile | ||
| ) |
Fills sequence_tile with encoded symbols for k-mers starting at block_start_kmer.
Cooperatively loads the covering uint64_t words into word_tile, then decodes symbols from shared memory to avoid repeated global loads across overlapping k-mers.
true when every symbol in the tile is valid. Definition at line 90 of file dense_packed.cuh.
| __device__ __forceinline__ bool cusbf::detail::prepare_sequence_hash_tiles | ( | const char * | sequence, |
| uint64_t | block_start_kmer, | ||
| uint64_t | block_kmers, | ||
| uint8_t * | sequence_tile | ||
| ) |
Encodes a block's sequence slice into sequence_tile and reports global validity.
true when every encoded base in the tile is valid. Definition at line 109 of file sequence_kmer.cuh.
|
inline |
Available physical RAM (bytes) for mmap budgeting.
Definition at line 36 of file fastx_host_memory.cuh.
|
inline |
Queries current device free memory via cudaMemGetInfo.
Definition at line 33 of file fastx_chunk.cuh.
|
constexprnoexcept |
Definition at line 13 of file record_math.cuh.
|
constexprnoexcept |
Definition at line 8 of file record_math.cuh.
| Result< typename Adapter::report_type > cusbf::detail::run_fastx_pipeline | ( | FastxReaderType & | reader, |
| std::string_view | source_name, | ||
| double | fill_fraction, | ||
| cuda::stream_ref | stream, | ||
| fastx_dispatch_path | dispatch_path, | ||
| FastxPipelineState & | state, | ||
| Adapter && | adapter | ||
| ) |
Definition at line 33 of file fastx_pipeline_core.cuh.
|
inline |
Selects mmap vs stream and single- vs multi-chunk processing for a path.
Definition at line 114 of file fastx_dispatch.hpp.
|
inline |
Selects mmap vs stream and single- vs multi-chunk processing from file size.
Definition at line 89 of file fastx_dispatch.hpp.
Tests that for every position in the input, placing the separator byte at that position always results in an invalid encoding.
This is a necessary condition for the separator to function correctly when concatenating sequences, as it prevents the creation of valid symbols that span across sequence boundaries.
| T | Alphabet type to test. |
Definition at line 67 of file Alphabet.cuh.
| consteval bool cusbf::detail::separatorPositionAlwaysEncodesInvalid | ( | char * | input, |
| uint64_t | separatorPosition, | ||
| uint64_t | index | ||
| ) |
Recursively tests whether placing the separator byte at any position in an input of valid bytes always results in an invalid encoding.
This ensures that the separator cannot be confused with valid symbols when concatenating sequences.
| T | Alphabet type to test. |
| input | Buffer to construct input strings for encoding. Must have length at least T::symbolWidth. |
| separatorPosition | Position at which to place the separator byte in the input. |
| index | Current index being set in the input. Should be called with 0 initially. |
Definition at line 37 of file Alphabet.cuh.
|
inline |
|
inline |
raw_bytes / record_count exceed the GPU staging budget. Definition at line 179 of file fastx_chunk.cuh.
Definition at line 14 of file Alphabet.cuh.
| __device__ __forceinline__ uint64_t cusbf::detail::warpReduceOr | ( | uint32_t | peers, |
| uint64_t | value | ||
| ) |
OR-reduce a uint64_t across the lanes in a peer mask.
On sm_80+ uses __reduce_or_sync, on older architectures falls back to a shuffle-based reduction.
Definition at line 84 of file helpers.cuh.
K-mers processed per query thread per inner loop iteration.
Definition at line 22 of file filter_common.cuh.
Default headroom left for the OS and other processes when sizing mmap.
Definition at line 20 of file fastx_host_memory.cuh.