26template<
class morton_t,
class pos_t, u32 dim>
29 std::tuple<pos_t, pos_t> bounding_box,
30 sycl::buffer<pos_t> &pos_buf,
32 std::unique_ptr<sycl::buffer<morton_t>> &out_buf_morton,
33 std::unique_ptr<sycl::buffer<u32>> &out_buf_particle_index_map) {
36 using namespace shamrock::sfc;
40 "number of element in patch above i32_max-1");
43 debug_sycl_ln(
"RadixTree",
"box dim :", bounding_box);
47 debug_sycl_ln(
"RadixTree",
"morton buffer length :", morton_len);
48 out_buf_morton = std::make_unique<sycl::buffer<morton_t>>(morton_len);
54 std::get<0>(bounding_box),
55 std::get<1>(bounding_box),
59 queue, cnt_obj, morton_len, out_buf_morton);
61 out_buf_particle_index_map = std::make_unique<sycl::buffer<u32>>(
67template<
class morton_t,
class pos_t, u32 dim>
69 sham::DeviceScheduler_ptr dev_sched,
70 std::tuple<pos_t, pos_t> bounding_box,
73 std::unique_ptr<sycl::buffer<morton_t>> &out_buf_morton,
74 std::unique_ptr<sycl::buffer<u32>> &out_buf_particle_index_map) {
75 sycl::queue &queue = dev_sched->get_queue().q;
78 using namespace shamrock::sfc;
82 "number of element in patch above i32_max-1");
89 debug_sycl_ln(
"RadixTree",
"morton buffer length :", morton_len);
90 out_buf_morton = std::make_unique<sycl::buffer<morton_t>>(morton_len);
96 std::get<0>(bounding_box),
97 std::get<1>(bounding_box),
101 queue, cnt_obj, morton_len, out_buf_morton);
103 out_buf_particle_index_map = std::make_unique<sycl::buffer<u32>>(
109template<
class morton_t,
class pos_t, u32 dim>
112 std::tuple<pos_t, pos_t> bounding_box,
113 sycl::buffer<pos_t> &pos_buf,
115 std::unique_ptr<sycl::buffer<morton_t>> &out_buf_morton) {
118 using namespace shamrock::sfc;
122 "number of element in patch above i32_max-1");
125 debug_sycl_ln(
"RadixTree",
"box dim :", bounding_box);
127 debug_sycl_ln(
"RadixTree",
"morton buffer length :", cnt_obj);
128 out_buf_morton = std::make_unique<sycl::buffer<morton_t>>(cnt_obj);
134 std::get<0>(bounding_box),
135 std::get<1>(bounding_box),
Utility to build morton codes for the radix tree.
std::uint32_t u32
32 bit unsigned integer
Helper class to build morton codes.
static void build_raw(sycl::queue &queue, std::tuple< pos_t, pos_t > bounding_box, sycl::buffer< pos_t > &pos_buf, u32 cnt_obj, std::unique_ptr< sycl::buffer< morton_t > > &out_buf_morton)
build a raw mrton table from a position buffer (no sorting & index map)
static void build(sycl::queue &queue, std::tuple< pos_t, pos_t > bounding_box, sycl::buffer< pos_t > &pos_buf, u32 cnt_obj, std::unique_ptr< sycl::buffer< morton_t > > &out_buf_morton, std::unique_ptr< sycl::buffer< u32 > > &out_buf_particle_index_map)
build morton code table for the tree
A buffer allocated in USM (Unified Shared Memory)
This header file contains utility functions related to exception handling in the code.
Define the fmt formatters for sycl::vec.
void sycl_sort_morton_key_pair(sycl::queue &queue, u32 morton_count_rounded_pow, std::unique_ptr< sycl::buffer< u32 > > &buf_index, std::unique_ptr< sycl::buffer< u_morton > > &buf_morton)
sort morton code and generate remap table
Morton curve implementation.
alias namespace to simplify the use of log functions
constexpr T roundup_pow2_clz(T v) noexcept
round up to the next power of two 0 is rounded up to 1 as it is not a pow of 2 every input above the ...
sycl::buffer< u32 > gen_buffer_index(sycl::queue &q, u32 len)
generate a buffer such that for i in [0,len[, buf[i] = i
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.
constexpr i32 i32_max
i32 max value
void debug_sycl_ln(std::string module_name, Types... var2)
Prints a log message with multiple arguments followed by a newline.