Skip to content

Add byte-budget construction for Bloom filters - #841

Open
yuweih205 wants to merge 3 commits into
NVIDIA:devfrom
yuweih205:fix/bloom-filter-byte-sizing
Open

Add byte-budget construction for Bloom filters#841
yuweih205 wants to merge 3 commits into
NVIDIA:devfrom
yuweih205:fix/bloom-filter-byte-sizing

Conversation

@yuweih205

@yuweih205 yuweih205 commented Sep 5, 2026

Copy link
Copy Markdown

Fixes #829.

Adds cuco::bloom_filter_bytes construction for dynamic-extent Bloom filters. The value is an upper-bound storage budget: allocation is rounded down to whole filter blocks and capped at max_size(), so it never exceeds the requested bytes. Budgets smaller than one block fail before allocation.

The existing block-count constructor remains unchanged. Coverage is folded into the existing Bloom filter policy test rather than a separate test target.

Local validation: repository formatting and copyright hooks, plus git diff --check.

@copy-pr-bot

copy-pr-bot Bot commented Sep 5, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@sleeepyjack

Copy link
Copy Markdown
Collaborator

Hi @yuweih205,

Thanks for contributing to cuco!
@PointKernel and I discussed the topic offline and settled on a simpler approach:
Instead of allowing the user to go both ways aka provide a lower-bound or upper-bound size in bytes, we only really need the upper-bound case which can be handled through the new ctor overload.

In short, 'bloom_filter(bloom_filter_bytes size)' allocates a filter that is always smaller or equal to 'size'; never exceeding it.
This means we can also remove the 'aligned_size' helper and the extent factory, making the API much simpler.

One small nit: I would suggest to rename the strong type for the filter size to `bloom_filter_bytes' as it is a bit shorter.

Do you agree with these changes? Happy to discuss and thanks again for your work on this!

Treat bloom_filter_bytes as a storage budget, round down to whole blocks, and cap at max_size(). Restrict the overload to dynamic extents and fold coverage into the existing policy test.

Signed-off-by: HuangYuwei <yuweih205@gmail.com>
@yuweih205 yuweih205 changed the title Add byte-oriented sizing and validation for Bloom filters Add byte-budget construction for Bloom filters Sep 11, 2026
@yuweih205

Copy link
Copy Markdown
Author

Agreed—updated. bloom_filter_bytes is now an upper-bound budget: the constructor rounds down to whole blocks, caps at max_size(), and is available only for dynamic extents. I removed aligned_size, the extent factory, and the standalone sizing test, folding the minimal coverage into the existing policy test.

@sleeepyjack

Copy link
Copy Markdown
Collaborator

/ok to test c80884c

@sleeepyjack sleeepyjack added the topic: bloom_filter Issues related to bloom_filter label Sep 11, 2026
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add byte-oriented sizing and validation utilities for bloom_filter

2 participants