Skip to content
Snippets Groups Projects
Commit 5e2ed82c authored by Felix Weiglhofer's avatar Felix Weiglhofer
Browse files

Ensure sort / merge types have trivial constructor.

parent f2ff66a1
No related branches found
Tags v0.7.0
No related merge requests found
...@@ -10,11 +10,14 @@ ...@@ -10,11 +10,14 @@
#if XPU_IS_CUDA #if XPU_IS_CUDA
#include <cub/cub.cuh> #include <cub/cub.cuh>
#else // XPU_IS_HIP #elif XPU_IS_HIP
#include <hipcub/hipcub.hpp> #include <hipcub/hipcub.hpp>
#else
#error "Internal XPU error: This should never happen."
#endif #endif
#include <iostream> #include <iostream>
#include <type_traits>
#if 0 #if 0
#define PRINT_B(message, ...) if (xpu::thread_idx::x() == 0) printf("t 0: " message "\n", ##__VA_ARGS__) #define PRINT_B(message, ...) if (xpu::thread_idx::x() == 0) printf("t 0: " message "\n", ##__VA_ARGS__)
...@@ -345,7 +348,10 @@ public: ...@@ -345,7 +348,10 @@ public:
using block_merge_t = block_merge<data_t, BlockSize, ItemsPerThread>; using block_merge_t = block_merge<data_t, BlockSize, ItemsPerThread>;
//using storage_t = typename block_radix_sort::TempStorage; //using storage_t = typename block_radix_sort::TempStorage;
static_assert(std::is_trivially_constructible_v<data_t>, "Sorted type needs trivial constructor.");
union storage_t { union storage_t {
storage_t() = default;
tempStorage sharedSortMem; tempStorage sharedSortMem;
#ifndef SEQ_MERGE #ifndef SEQ_MERGE
typename block_merge_t::storage_t sharedMergeMem; typename block_merge_t::storage_t sharedMergeMem;
...@@ -486,6 +492,8 @@ class block_merge<Key, BlockSize, ItemsPerThread, XPU_COMPILATION_TARGET> { ...@@ -486,6 +492,8 @@ class block_merge<Key, BlockSize, ItemsPerThread, XPU_COMPILATION_TARGET> {
public: public:
using data_t = Key; using data_t = Key;
static_assert(std::is_trivially_constructible_v<data_t>, "Merged type needs trivial constructor.");
struct storage_t { struct storage_t {
data_t sharedMergeMem[ItemsPerThread * BlockSize + 1]; data_t sharedMergeMem[ItemsPerThread * BlockSize + 1];
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment