Skip to content
Merged
10 changes: 6 additions & 4 deletions cpp/src/io/parquet/bloom_filter_reader.cu
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,12 @@ size_t aggregate_reader_metadata::get_bloom_filter_alignment() const
// Required alignment:
// https://github.com/NVIDIA/cuCollections/blob/deab5799f3e4226cb8a49acf2199c03b14941ee4/include/cuco/detail/bloom_filter/bloom_filter_impl.cuh#L55-L67
using policy_type = cuco::arrow_filter_policy<cuda::std::byte, cudf::hashing::detail::XXHash_64>;
return alignof(cuco::bloom_filter_ref<cuda::std::byte,
cuco::extent<std::size_t>,
cuco::thread_scope_thread,
policy_type>::filter_block_type);
auto constexpr alignment = alignof(cuco::bloom_filter_ref<cuda::std::byte,
cuco::extent<std::size_t>,
cuco::thread_scope_thread,
policy_type>::filter_block_type);
static_assert((alignment & (alignment - 1)) == 0, "Alignment must be a power of 2");
return std::max<size_t>(alignment, rmm::CUDA_ALLOCATION_ALIGNMENT);
Comment thread
PointKernel marked this conversation as resolved.
}

std::vector<rmm::device_buffer> aggregate_reader_metadata::read_bloom_filters(
Expand Down
3 changes: 2 additions & 1 deletion cpp/tests/io/experimental/hybrid_scan_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@
#include <cudf/utilities/memory_resource.hpp>
#include <cudf/utilities/span.hpp>

#include <rmm/aligned.hpp>
#include <rmm/mr/device/aligned_resource_adaptor.hpp>

auto constexpr bloom_filter_alignment = 32;
auto constexpr bloom_filter_alignment = rmm::CUDA_ALLOCATION_ALIGNMENT;

namespace {

Expand Down
Binary file not shown.
41 changes: 41 additions & 0 deletions python/cudf/cudf/tests/test_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -4523,6 +4523,47 @@ def test_parquet_bloom_filters(
)


@pytest.fixture(params=["cuda", "pool", "cuda_async"])
def memory_resource(request):
import rmm

current_mr = rmm.mr.get_current_device_resource()

kind = request.param
if kind == "cuda":
mr = rmm.mr.CudaMemoryResource()
elif kind == "pool":
base = rmm.mr.CudaMemoryResource()
free, _ = rmm.mr.available_device_memory()
size = int(round(free * 0.5 / 256) * 256)
mr = rmm.mr.PoolMemoryResource(base, size, size)
elif kind == "cuda_async":
mr = rmm.mr.CudaAsyncMemoryResource()

rmm.mr.set_current_device_resource(mr)

try:
yield mr
finally:
rmm.mr.set_current_device_resource(current_mr)


@pytest.mark.parametrize("columns", [["r_reason_desc"], None])
def test_parquet_bloom_filters_alignment(datadir, columns, memory_resource):
fname = datadir / "bloom_filter_alignment.parquet"
Comment thread
mhaseeb123 marked this conversation as resolved.
filters = [("r_reason_desc", "==", "Did not like the color")]

# Read expected table using pyarrow
expected = pq.read_table(fname, columns=columns, filters=filters)

# Read with cudf using the memory resource from fixture
read = cudf.read_parquet(
fname, columns=columns, filters=filters
).to_arrow()

assert_eq(expected, read)


def test_parquet_reader_unsupported_compression(datadir):
fname = datadir / "hadoop_lz4_compressed.parquet"

Expand Down