Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add XXHash_32 hasher #17533

Merged
merged 36 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
bff159d
Add xxhash_32
PointKernel Dec 5, 2024
8d5c2dd
Change default hash to xxhash_32
PointKernel Dec 5, 2024
24c5a76
Add missing headers
PointKernel Dec 5, 2024
1597e1f
Merge branch 'branch-25.02' into add-xxhash32
PointKernel Dec 6, 2024
d2635a9
Apply suggestions from code review
PointKernel Dec 6, 2024
e25e0e1
Merge branch 'branch-25.02' into add-xxhash32
PointKernel Dec 6, 2024
e6f204c
Merge remote-tracking branch 'upstream/branch-25.02' into add-xxhash32
PointKernel Dec 9, 2024
200d557
Add xxhash_32 column hash API
PointKernel Dec 9, 2024
50ac47f
Merge remote-tracking branch 'upstream/branch-25.02' into add-xxhash32
PointKernel Dec 10, 2024
4d69dc9
Add xxhash32 tests
PointKernel Dec 10, 2024
03c3c81
Add xxhash in cmake
PointKernel Dec 10, 2024
c660740
Update reference values
PointKernel Dec 10, 2024
4277feb
Minor
PointKernel Dec 10, 2024
8070750
Update expected hash results
PointKernel Dec 11, 2024
7ca8b2b
Merge remote-tracking branch 'upstream/branch-25.02' into add-xxhash32
PointKernel Dec 11, 2024
fe88247
Merge remote-tracking branch 'origin/add-xxhash32' into add-xxhash32
PointKernel Dec 11, 2024
1b486ba
Merge branch 'branch-25.02' into add-xxhash32
bdice Dec 11, 2024
f93bde9
Merge remote-tracking branch 'upstream/branch-25.02' into add-xxhash32
PointKernel Dec 16, 2024
71df59e
Merge remote-tracking branch 'origin/add-xxhash32' into add-xxhash32
PointKernel Dec 16, 2024
93e6af0
Revert default hash changes
PointKernel Dec 16, 2024
b26f0c7
Add Python bindings for xxhash32.
bdice Dec 16, 2024
67d9157
Remove unused helper function.
bdice Dec 16, 2024
71bf77b
Update tests.
bdice Dec 17, 2024
1508aad
Make tests pass.
bdice Dec 17, 2024
1010775
Fix xxhash32 implementation to avoid hash_combine steps.
bdice Dec 17, 2024
6fbd870
Fix typo in result value.
bdice Dec 17, 2024
fc35cc5
Merge branch 'branch-25.02' into add-xxhash32
bdice Dec 17, 2024
538a416
Merge branch 'branch-25.02' into add-xxhash32
PointKernel Dec 20, 2024
1f79ad0
Merge branch 'branch-25.02' into add-xxhash32
PointKernel Dec 30, 2024
aa4bf60
Merge remote-tracking branch 'upstream/branch-25.02' into add-xxhash32
PointKernel Jan 6, 2025
6440b54
Update copyright years
PointKernel Jan 6, 2025
5c068bd
Merge remote-tracking branch 'upstream/branch-25.02' into add-xxhash32
PointKernel Jan 6, 2025
a33a319
Remove redundant hash_value_type
PointKernel Jan 6, 2025
83f0b54
Fix copyright years
PointKernel Jan 6, 2025
bc102bf
Fix copy-paste leftovers
PointKernel Jan 6, 2025
1c06eaa
Merge remote-tracking branch 'upstream/branch-25.02' into add-xxhash32
PointKernel Jan 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add xxhash32 tests
  • Loading branch information
PointKernel committed Dec 10, 2024
commit 4d69dc9c732fcb4d85263203a3b2204a0e182b24
1 change: 1 addition & 0 deletions cpp/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ ConfigureTest(
hashing/sha256_test.cpp
hashing/sha384_test.cpp
hashing/sha512_test.cpp
hashing/xxhash_32_test.cpp
hashing/xxhash_64_test.cpp
)

Expand Down
67 changes: 67 additions & 0 deletions cpp/tests/hashing/xxhash_32_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Copyright (c) 2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include <cudf_test/base_fixture.hpp>
#include <cudf_test/column_utilities.hpp>
#include <cudf_test/column_wrapper.hpp>
#include <cudf_test/type_lists.hpp>

#include <cudf/hashing.hpp>

class XXHash_32_Test : public cudf::test::BaseFixture {};

TEST_F(XXHash_32_Test, TestInteger)
{
auto col1 = cudf::test::fixed_width_column_wrapper<int32_t>{{0, 42, 825}};
auto constexpr seed = 0u;
auto const output = cudf::hashing::xxhash_32(cudf::table_view({col1}), seed);

// Checking against the reference implementation:
// https://github.com/Cyan4973/xxHash/blob/dev/xxhash.h
auto expected =
cudf::test::fixed_width_column_wrapper<uint32_t>({148298089u, 1161967057u, 1066694813u});
CUDF_TEST_EXPECT_COLUMNS_EQUAL(output->view(), expected);
}

TEST_F(XXHash_32_Test, TestDouble)
{
auto col1 = cudf::test::fixed_width_column_wrapper<double>{{-8., 25., 90.}};
auto constexpr seed = 42u;

auto const output = cudf::hashing::xxhash_32(cudf::table_view({col1}), seed);

// Checking against the reference implementation:
// https://github.com/Cyan4973/xxHash/blob/dev/xxhash.h
auto expected =
cudf::test::fixed_width_column_wrapper<uint32_t>({2276435783u, 3120212431u, 3454197470u});

CUDF_TEST_EXPECT_COLUMNS_EQUAL(output->view(), expected);
}

TEST_F(XXHash_32_Test, StringType)
{
auto col1 = cudf::test::strings_column_wrapper({"I", "am", "AI"});
auto constexpr seed = 825u;

auto output = cudf::hashing::xxhash_32(cudf::table_view({col1}), seed);

// Checking against the reference implementation:
// https://github.com/Cyan4973/xxHash/blob/dev/xxhash.h
auto expected =
cudf::test::fixed_width_column_wrapper<uint32_t>({320624298u, 1612654309u, 1409499009u});

CUDF_TEST_EXPECT_COLUMNS_EQUAL(output->view(), expected);
}