Skip to content

Overloading functions to allow custom allocators#56

Open
MikaelHuppunen wants to merge 3 commits intokstppd:masterfrom
MikaelHuppunen:overload
Open

Overloading functions to allow custom allocators#56
MikaelHuppunen wants to merge 3 commits intokstppd:masterfrom
MikaelHuppunen:overload

Conversation

@MikaelHuppunen
Copy link

No description provided.

@kstppd kstppd self-requested a review January 30, 2026 14:25
@kstppd
Copy link
Owner

kstppd commented Jan 30, 2026

@MikaelHuppunen this looks good and passes the CI test locally on my machine. However would you still want to add a small unit test somewhere?

split::tools::loop_compact<<<1, BLOCKSIZE, 0, s>>>(input, output, rule);
}

template <typename T, typename U, typename Rule, typename ALLOCATOR, size_t BLOCKSIZE = 1024, size_t WARP = WARPLENGTH>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question for all these pretty much

Copy link
Author

@MikaelHuppunen MikaelHuppunen Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The functions would then break if ALLOCATOR is defined but BLOCKSIZE and WARP are not (or the other way around depending on the order of the arguments).

@MikaelHuppunen
Copy link
Author

@MikaelHuppunen this looks good and passes the CI test locally on my machine. However would you still want to add a small unit test somewhere?

Is there an existing unit test that tests extractPatternLoop and extractAllKeysLoop? I could then do that but with a custom allocator.

@kstppd
Copy link
Owner

kstppd commented Feb 2, 2026

@MikaelHuppunen this looks good and passes the CI test locally on my machine. However would you still want to add a small unit test somewhere?

Is there an existing unit test that tests extractPatternLoop and extractAllKeysLoop? I could then do that but with a custom allocator.

@MikaelHuppunen yup there are a couple of test cases here

https://github.com/kstppd/hashinator/blob/master/unit_tests/stream_compaction/unit.cu

@kstppd
Copy link
Owner

kstppd commented Feb 9, 2026

This is the diff on the meson file

diff --git a/meson.build b/meson.build
index 5c10eb6..fd37248 100644
--- a/meson.build
+++ b/meson.build
@@ -30,6 +30,7 @@ insertion_mechanism = executable('insertion', 'unit_tests/insertion_mechanism/ma
 tombstoneTest = executable('tbPerf', 'unit_tests/benchmark/tbPerf.cu', dependencies :gtest_dep)
 realisticTest = executable('realistic', 'unit_tests/benchmark/realistic.cu', dependencies :gtest_dep)
 hybridGPU = executable('hybrid_gpu', 'unit_tests/hybrid/main.cu',dependencies :gtest_dep )
+customAllocatorTest = executable('custom_allocator', 'unit_tests/custom_allocator/unit.cu',dependencies :gtest_dep )


 #Test-Runner
@@ -48,3 +49,4 @@ test('hybridCPU_Test',  hybridCPU)
 test('hybridGPU_Test',  hybridGPU)
 test('TbTest',  tombstoneTest)
 test('RealisticTest',  realisticTest)
+test('CustomAllocator',  customAllocatorTest)

in an attempt to integrate your unit test there

but fails to compile due to

../unit_tests/custom_allocator/unit.cu(198): error: no instance of overloaded function "split::tools::copy_if_loop" matches the argument list
            argument types are: (vector, vector, lambda [](test_t)->bool)
     split::tools::copy_if_loop(*v,*output1,predicate_on);
     ^
../unit_tests/custom_allocator/../../include/splitvector/split_tools.h(1015): note #3327-D: candidate function template "split::tools::copy_if_loop(split::SplitVector<T, split::split_unified_allocator<T>> &, split::SplitVector<T, split::split_unified_allocator<T>> &, Rule, cudaStream_t)" failed deduction
  void copy_if_loop(split::SplitVector<T, split::split_unified_allocator<T>>& input,
       ^
../unit_tests/custom_allocator/../

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments