Skip to content

Add FastL2Add bloom filter policy option - #863

Merged
sleeepyjack merged 2 commits into
NVIDIA:devfrom
sleeepyjack:bloom-fast-l2-add
Oct 23, 2026
Merged

sleeepyjack merged 2 commits into
NVIDIA:devfrom
sleeepyjack:bloom-fast-l2-add

Conversation

@sleeepyjack

@sleeepyjack sleeepyjack commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Adds an opt-in FastL2Add flag (last template parameter of cuco::bloom_filter_policy, default false) that speeds up add for filters that fit in L2.

  • Each key leaves one hash-selected word of its block's first 32-byte sector untouched (no atomic for it). Partial-sector atomic updates are processed more efficiently by recent GPUs.
  • Under the flag, add_coop shuffles all keys of the tile before issuing the now-conditional atomics, avoiding a convergence check per shuffle.

Trade-offs: the bit pattern changes (filters with and without the flag are not interchangeable) and the false-positive rate rises slightly (0.1315% → 0.1374% at 16 bits/key, k = 8). With the flag off, the bloom kernels compile to SASS identical to dev.

Performance

RTX PRO 6000 Blackwell Max-Q (sm_120, 128 MB L2), CUDA 13.4, default add/contains benchmarks (int64 keys, 256-bit blocks, k = 8, 1e9 keys), with the policy's FastL2Add set locally for the comparison:

Filter size add contains
≤ 32 MB +51% (52.5 → 79.6 G keys/s at 32 MB) −1 to −2%
≥ 64 MB same same

Diffs below count changes within ±1% as SAME.

nvbench_compare: dev vs this PR with FastL2Add=0

bloom_filter_add_unique_size

FilterSizeMB Ref Time Cmp Time %Diff Status
1 18.835 ms 18.859 ms 0.12% 🔵 SAME
2 18.856 ms 18.897 ms 0.22% 🔵 SAME
4 18.912 ms 18.950 ms 0.20% 🔵 SAME
8 18.961 ms 18.987 ms 0.14% 🔵 SAME
16 18.988 ms 19.020 ms 0.17% 🔵 SAME
32 19.046 ms 19.046 ms -0.00% 🔵 SAME
64 25.067 ms 25.070 ms 0.01% 🔵 SAME
128 113.420 ms 113.402 ms -0.02% 🔵 SAME
256 185.779 ms 185.752 ms -0.01% 🔵 SAME
512 209.515 ms 209.520 ms 0.00% 🔵 SAME
1024 217.887 ms 217.876 ms -0.00% 🔵 SAME
2048 220.609 ms 220.610 ms 0.00% 🔵 SAME

bloom_filter_contains_unique_size

FilterSizeMB Ref Time Cmp Time %Diff Status
1 11.679 ms 11.633 ms -0.40% 🔵 SAME
2 11.825 ms 11.811 ms -0.11% 🔵 SAME
4 11.896 ms 11.900 ms 0.03% 🔵 SAME
8 11.990 ms 11.969 ms -0.17% 🔵 SAME
16 12.011 ms 12.007 ms -0.03% 🔵 SAME
32 12.021 ms 12.055 ms 0.28% 🔵 SAME
64 12.096 ms 12.121 ms 0.21% 🔵 SAME
128 25.799 ms 25.805 ms 0.02% 🔵 SAME
256 53.155 ms 53.157 ms 0.00% 🔵 SAME
512 60.922 ms 60.928 ms 0.01% 🔵 SAME
1024 64.044 ms 64.037 ms -0.01% 🔵 SAME
2048 65.464 ms 65.458 ms -0.01% 🔵 SAME
nvbench_compare: FastL2Add=0 vs FastL2Add=1

bloom_filter_add_unique_size

FilterSizeMB Ref Time Cmp Time %Diff Status
1 18.859 ms 12.306 ms -34.75% 🟢 FAST
2 18.897 ms 12.363 ms -34.58% 🟢 FAST
4 18.950 ms 12.398 ms -34.57% 🟢 FAST
8 18.987 ms 12.464 ms -34.36% 🟢 FAST
16 19.020 ms 12.500 ms -34.28% 🟢 FAST
32 19.046 ms 12.561 ms -34.05% 🟢 FAST
64 25.070 ms 25.028 ms -0.17% 🔵 SAME
128 113.402 ms 113.312 ms -0.08% 🔵 SAME
256 185.752 ms 185.902 ms 0.08% 🔵 SAME
512 209.520 ms 209.701 ms 0.09% 🔵 SAME
1024 217.876 ms 218.160 ms 0.13% 🔵 SAME
2048 220.610 ms 221.159 ms 0.25% 🔵 SAME

bloom_filter_contains_unique_size

FilterSizeMB Ref Time Cmp Time %Diff Status
1 11.633 ms 11.855 ms 1.91% 🔴 SLOW
2 11.811 ms 11.965 ms 1.30% 🔴 SLOW
4 11.900 ms 12.024 ms 1.04% 🔴 SLOW
8 11.969 ms 12.093 ms 1.04% 🔴 SLOW
16 12.007 ms 12.110 ms 0.86% 🔵 SAME
32 12.055 ms 12.148 ms 0.77% 🔵 SAME
64 12.121 ms 12.226 ms 0.86% 🔵 SAME
128 25.805 ms 25.800 ms -0.02% 🔵 SAME
256 53.157 ms 53.154 ms -0.01% 🔵 SAME
512 60.928 ms 60.922 ms -0.01% 🔵 SAME
1024 64.037 ms 64.040 ms 0.00% 🔵 SAME
2048 65.458 ms 65.460 ms 0.00% 🔵 SAME

@NVIDIA NVIDIA deleted a comment from copy-pr-bot Bot Oct 22, 2026
@sleeepyjack

Copy link
Copy Markdown
Collaborator Author
image

FastL2Add (last bloom_filter_policy template parameter, default false)
speeds up add for filters that fit in L2. Each key leaves one
hash-selected word of its block's first 32-byte sector untouched; add
issues no atomic for that word, so a key's atomic updates cover its first
sector only partially, which recent GPUs process more efficiently. The bit
pattern changes (slightly higher false-positive rate; filters built with
and without the option are not interchangeable); contains needs no change.

- policy: fast_l2_add flag; the skipped word is chosen branch-free from
  the lower hash with its own salt; no effect for blocks smaller than one
  sector
- add_coop: under fast_l2_add, shuffle all keys of the tile first, then
  issue the conditional atomics (avoids per-shuffle convergence checks)
- tests: one untouched word per key (32/64/128-byte blocks), layout
  invariance, no false negatives, cooperative bulk add on 3M keys, no
  effect below one sector
@sleeepyjack sleeepyjack self-assigned this Oct 22, 2026
@sleeepyjack sleeepyjack added topic: performance Performance related issue topic: bloom_filter Issues related to bloom_filter labels Oct 22, 2026
Match the other detail bloom_filter_policy parameters, which have no
defaults; the deprecated parametric_filter_policy alias passes false.
@sleeepyjack
sleeepyjack merged commit 3f7ff10 into NVIDIA:dev Oct 23, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: bloom_filter Issues related to bloom_filter topic: performance Performance related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants