cuSBF
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
cusbf::filter_ref< Config > Class Template Reference

Non-owning device reference to sectorized filter storage. More...

Public Types

using block_type = filter_block< Config >
 

Public Member Functions

__host__ __device__ constexpr filter_ref () noexcept
 Default-constructed empty reference (no shard storage).
 
__host__ __device__ constexpr filter_ref (block_type *blocks, uint64_t num_blocks) noexcept
 Constructs a reference over blocks spanning num_blocks shards.
 
__host__ __device__ block_typeblocks () const noexcept
 Raw pointer to the first 256-bit filter block (shard array base).
 
__host__ __device__ uint64_t num_blocks () const noexcept
 Number of power-of-two shards in this filter.
 
__device__ uint64_t shard_index (uint64_t minimizer_hash) const noexcept
 Shard index for minimizer_hash within this filter.
 
__device__ void apply_word_masks (block_type &block, uint64_t m0, uint64_t m1, uint64_t m2, uint64_t m3) const
 Atomically ORs non-zero per-word Bloom masks into block.
 

Static Public Member Functions

__host__ static __device__ uint64_t shard_index (uint64_t minimizer_hash, uint64_t num_blocks) noexcept
 Maps a minimizer hash to a shard index via low bits.
 
static __device__ bool sectorized_contains_packed_kmer (uint64_t packed_kmer, const uint64_t *shard_words)
 Tests sectorized membership for a packed k-mer against shard words.
 

Detailed Description

template<typename Config>
class cusbf::filter_ref< Config >

Non-owning device reference to sectorized filter storage.

Trivially copyable, intended to be passed by value into device code.

Definition at line 21 of file filter_ref.cuh.

Member Typedef Documentation

◆ block_type

template<typename Config >
using cusbf::filter_ref< Config >::block_type = filter_block<Config>

Definition at line 23 of file filter_ref.cuh.

Constructor & Destructor Documentation

◆ filter_ref() [1/2]

template<typename Config >
__host__ __device__ constexpr cusbf::filter_ref< Config >::filter_ref ( )
inlineconstexprnoexcept

Default-constructed empty reference (no shard storage).

Definition at line 26 of file filter_ref.cuh.

26: blocks_{}, num_blocks_{} {}

◆ filter_ref() [2/2]

template<typename Config >
__host__ __device__ constexpr cusbf::filter_ref< Config >::filter_ref ( block_type blocks,
uint64_t  num_blocks 
)
inlineconstexprnoexcept

Constructs a reference over blocks spanning num_blocks shards.

num_blocks must be a power of two, shard selection uses low bits of the minimizer hash.

Definition at line 33 of file filter_ref.cuh.

34 : blocks_(blocks), num_blocks_(num_blocks) {}
__host__ __device__ uint64_t num_blocks() const noexcept
Number of power-of-two shards in this filter.
__host__ __device__ block_type * blocks() const noexcept
Raw pointer to the first 256-bit filter block (shard array base).

Member Function Documentation

◆ apply_word_masks()

template<typename Config >
__device__ void cusbf::filter_ref< Config >::apply_word_masks ( block_type block,
uint64_t  m0,
uint64_t  m1,
uint64_t  m2,
uint64_t  m3 
) const
inline

Atomically ORs non-zero per-word Bloom masks into block.

Used by the insert kernel after warp-local reduction of hash masks.

Definition at line 95 of file filter_ref.cuh.

95 {
96 if (m0 != 0) {
97 detail::atomicOrWord(&block.words[0], m0);
98 }
99 if (m1 != 0) {
100 detail::atomicOrWord(&block.words[1], m1);
101 }
102 if (m2 != 0) {
103 detail::atomicOrWord(&block.words[2], m2);
104 }
105 if (m3 != 0) {
106 detail::atomicOrWord(&block.words[3], m3);
107 }
108 }
__device__ __forceinline__ void atomicOrWord(uint64_t *ptr, uint64_t value)
64-bit atomic OR used for sectorized Bloom inserts.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ blocks()

template<typename Config >
__host__ __device__ block_type * cusbf::filter_ref< Config >::blocks ( ) const
inlinenoexcept

Raw pointer to the first 256-bit filter block (shard array base).

Definition at line 37 of file filter_ref.cuh.

37 {
38 return blocks_;
39 }

◆ num_blocks()

template<typename Config >
__host__ __device__ uint64_t cusbf::filter_ref< Config >::num_blocks ( ) const
inlinenoexcept

Number of power-of-two shards in this filter.

Definition at line 42 of file filter_ref.cuh.

42 {
43 return num_blocks_;
44 }
Here is the caller graph for this function:

◆ sectorized_contains_packed_kmer()

template<typename Config >
static __device__ bool cusbf::filter_ref< Config >::sectorized_contains_packed_kmer ( uint64_t  packed_kmer,
const uint64_t *  shard_words 
)
inlinestatic

Tests sectorized membership for a packed k-mer against shard words.

All findere s-mers must hit set bits in the shard, returns false if any s-mer misses.

Parameters
packed_kmerK-mer packed with Config::symbolBits per symbol.
shard_wordsFour 64-bit words of the target shard (unaligned load path).

Definition at line 71 of file filter_ref.cuh.

71 {
72 bool present = true;
73 _Pragma("unroll")
74 for (uint64_t smer_offset = 0; smer_offset < Config::findereSpan; ++smer_offset) {
75 const uint64_t smer_hash =
76 detail::packed_kmer_smer_hash<Config>(packed_kmer, smer_offset);
78 [&]<uint64_t HashIndex>(std::integral_constant<uint64_t, HashIndex>) {
79 constexpr uint64_t s = HashIndex % Config::blockWordCount;
80 const uint64_t bit_pos =
81 block_type::template sectorizedBitAddress<HashIndex>(smer_hash);
82 present &= ((shard_words[s] >> bit_pos) & 1) != 0;
83 }
84 );
85 }
86 return present;
87 }
consteval bool 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 alway...
Definition Alphabet.cuh:37
static constexpr uint64_t blockWordCount
64-bit words per 256-bit shard.
Definition config.cuh:62
Here is the call graph for this function:
Here is the caller graph for this function:

◆ shard_index() [1/2]

template<typename Config >
__device__ uint64_t cusbf::filter_ref< Config >::shard_index ( uint64_t  minimizer_hash) const
inlinenoexcept

Shard index for minimizer_hash within this filter.

Definition at line 58 of file filter_ref.cuh.

58 {
59 return shard_index(minimizer_hash, num_blocks_);
60 }
__host__ static __device__ uint64_t shard_index(uint64_t minimizer_hash, uint64_t num_blocks) noexcept
Maps a minimizer hash to a shard index via low bits.
Here is the call graph for this function:

◆ shard_index() [2/2]

template<typename Config >
__host__ static __device__ uint64_t cusbf::filter_ref< Config >::shard_index ( uint64_t  minimizer_hash,
uint64_t  num_blocks 
)
inlinestaticnoexcept

Maps a minimizer hash to a shard index via low bits.

Parameters
minimizer_hashMinimizer hash for the k-mer window.
num_blocksPower-of-two shard count.

Definition at line 53 of file filter_ref.cuh.

53 {
54 return minimizer_hash & (num_blocks - 1);
55 }
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: