24 template<
class u_morton,
class pos_t>
25 void TreeCellRanges<u_morton, pos_t>::build1(
27 TreeReducedMortonCodes<u_morton> &tree_reduced_morton_codes,
28 TreeStructure<u_morton> &tree_struct) {
29 if (!tree_struct.one_cell_mode) {
31 shamlog_debug_sycl_ln(
"RadixTree",
"compute_cellvolume");
33 buf_pos_min_cell = std::make_unique<sycl::buffer<ipos_t>>(
34 tree_struct.internal_cell_count + tree_reduced_morton_codes.tree_leaf_count);
35 buf_pos_max_cell = std::make_unique<sycl::buffer<ipos_t>>(
36 tree_struct.internal_cell_count + tree_reduced_morton_codes.tree_leaf_count);
38 sycl_compute_cell_ranges(
40 tree_reduced_morton_codes.tree_leaf_count,
41 tree_struct.internal_cell_count,
42 tree_reduced_morton_codes.buf_tree_morton,
43 tree_struct.buf_lchild_id,
44 tree_struct.buf_rchild_id,
45 tree_struct.buf_lchild_flag,
46 tree_struct.buf_rchild_flag,
47 tree_struct.buf_endrange,
55 buf_pos_min_cell = std::make_unique<sycl::buffer<ipos_t>>(
56 tree_struct.internal_cell_count + tree_reduced_morton_codes.tree_leaf_count);
57 buf_pos_max_cell = std::make_unique<sycl::buffer<ipos_t>>(
58 tree_struct.internal_cell_count + tree_reduced_morton_codes.tree_leaf_count);
62 sycl::host_accessor pos_min_cell{
63 *buf_pos_min_cell, sycl::write_only, sycl::no_init};
64 sycl::host_accessor pos_max_cell{
65 *buf_pos_max_cell, sycl::write_only, sycl::no_init};
67 pos_min_cell[0] = {0, 0, 0};
68 pos_max_cell[0] = {Morton::max_val, Morton::max_val, Morton::max_val};
70 pos_min_cell[1] = {0, 0, 0};
71 pos_max_cell[1] = {Morton::max_val, Morton::max_val, Morton::max_val};
73 pos_min_cell[2] = {0, 0, 0};
74 pos_max_cell[2] = {0, 0, 0};
76 shamlog_debug_sycl_ln(
"RadixTree",
"compute_cellvolume one cell mode");
77 shamlog_debug_sycl_ln(
87 tree_struct.internal_cell_count + tree_reduced_morton_codes.tree_leaf_count);
92 template<
class u_morton,
class pos_t>
93 void TreeCellRanges<u_morton, pos_t>::build2(
94 sycl::queue &queue,
u32 total_count, std::tuple<pos_t, pos_t> bounding_box) {
96 buf_pos_min_cell_flt = std::make_unique<sycl::buffer<pos_t>>(total_count);
97 buf_pos_max_cell_flt = std::make_unique<sycl::buffer<pos_t>>(total_count);
99 shamlog_debug_sycl_ln(
"RadixTree",
"sycl_convert_cell_range");
104 std::get<0>(bounding_box),
105 std::get<1>(bounding_box),
108 buf_pos_min_cell_flt,
109 buf_pos_max_cell_flt);
114 template<
class u_morton,
class pos_t>
115 TreeCellRanges<u_morton, pos_t>::TreeCellRanges(
const TreeCellRanges<u_morton, pos_t> &other)
119 other.buf_pos_min_cell)),
123 other.buf_pos_max_cell)),
124 buf_pos_min_cell_flt(
127 other.buf_pos_min_cell_flt)),
128 buf_pos_max_cell_flt(
131 other.buf_pos_max_cell_flt))
134 template<
class u_morton,
class pos_t>
135 bool TreeCellRanges<u_morton, pos_t>::operator==(
136 const TreeCellRanges<u_morton, pos_t> &rhs)
const {
143 shamsys::instance::get_compute_queue(), buf_pos_min_cell, rhs.buf_pos_min_cell);
146 shamsys::instance::get_compute_queue(), buf_pos_max_cell, rhs.buf_pos_max_cell);
149 shamsys::instance::get_compute_queue(),
150 buf_pos_min_cell_flt,
151 rhs.buf_pos_min_cell_flt);
154 shamsys::instance::get_compute_queue(),
155 buf_pos_max_cell_flt,
156 rhs.buf_pos_max_cell_flt);
161 template class TreeCellRanges<u32, f64_3>;
162 template class TreeCellRanges<u64, f64_3>;
163 template class TreeCellRanges<u32, f32_3>;
164 template class TreeCellRanges<u64, f32_3>;
165 template class TreeCellRanges<u32, i64_3>;
166 template class TreeCellRanges<u64, i64_3>;
167 template class TreeCellRanges<u32, u64_3>;
168 template class TreeCellRanges<u64, u64_3>;
169 template class TreeCellRanges<u32, u32_3>;
170 template class TreeCellRanges<u64, u32_3>;
sycl::queue & get_compute_queue(u32 id=0)
std::uint32_t u32
32 bit unsigned integer
Element-wise equality comparison algorithms for buffers.
Define the fmt formatters for sycl::vec.
namespace for primitive algorithm (e.g. sort, scan, reductions, ...)
bool equals_ptr(sycl::queue &q, const std::unique_ptr< sycl::buffer< T > > &buf1, const std::unique_ptr< sycl::buffer< T > > &buf2)
Compare all elements between two unique_ptr-wrapped sycl::buffers.
namespace to contain everything implemented by shamalgs
namespace for the system handling