29 static constexpr u32 dim = 3;
33 std::unique_ptr<sycl::buffer<ipos_t>>
35 std::unique_ptr<sycl::buffer<ipos_t>> buf_pos_max_cell;
38 std::unique_ptr<sycl::buffer<pos_t>>
40 std::unique_ptr<sycl::buffer<pos_t>> buf_pos_max_cell_flt;
47 void build2(sycl::queue &queue,
u32 total_count, std::tuple<pos_t, pos_t> bounding_box);
49 inline bool are_range_int_built() {
50 return bool(buf_pos_min_cell) && bool(buf_pos_max_cell);
53 inline bool are_range_float_built() {
54 return bool(buf_pos_min_cell_flt) && bool(buf_pos_max_cell_flt);
62 buf_pos_min_cell = std::move(other.buf_pos_min_cell);
63 buf_pos_max_cell = std::move(other.buf_pos_max_cell);
64 buf_pos_min_cell_flt = std::move(other.buf_pos_min_cell_flt);
65 buf_pos_max_cell_flt = std::move(other.buf_pos_max_cell_flt);
70 [[nodiscard]]
inline u64 memsize()
const {
73 auto add_ptr = [&](
auto &a) {
75 sum += a->byte_size();
79 add_ptr(buf_pos_min_cell);
80 add_ptr(buf_pos_max_cell);
81 add_ptr(buf_pos_min_cell_flt);
82 add_ptr(buf_pos_max_cell_flt);
89 inline u32 get_total_tree_cell_count() {
90 if (buf_pos_min_cell) {
91 return buf_pos_min_cell->size();
92 }
else if (buf_pos_min_cell_flt) {
93 return buf_pos_min_cell_flt->size();
96 "no buffers are allocated");
102 u32 state = (bool(buf_pos_min_cell) ? 1 : 0) + (
bool(buf_pos_min_cell_flt) ? 1 : 0) * 2;
104 serializer.write(state);
107 u32 sz = buf_pos_min_cell->size();
108 serializer.write(sz);
109 serializer.write_buf(*buf_pos_min_cell, sz);
110 serializer.write_buf(*buf_pos_max_cell, sz);
111 }
else if (state == 2) {
112 u32 sz = buf_pos_min_cell_flt->size();
113 serializer.write(sz);
114 serializer.write_buf(*buf_pos_min_cell_flt, sz);
115 serializer.write_buf(*buf_pos_max_cell_flt, sz);
116 }
else if (state == 3) {
117 u32 sz = buf_pos_min_cell->size();
118 serializer.write(sz);
119 serializer.write_buf(*buf_pos_min_cell, sz);
120 serializer.write_buf(*buf_pos_max_cell, sz);
121 serializer.write_buf(*buf_pos_min_cell_flt, sz);
122 serializer.write_buf(*buf_pos_max_cell_flt, sz);
132 u32 state = (bool(buf_pos_min_cell) ? 1 : 0) + (
bool(buf_pos_min_cell_flt) ? 1 : 0) * 2;
135 u32 sz = buf_pos_min_cell->size();
136 sum += H::serialize_byte_size<u32>();
137 sum += H::serialize_byte_size<ipos_t>(sz);
138 sum += H::serialize_byte_size<ipos_t>(sz);
139 }
else if (state == 2) {
140 u32 sz = buf_pos_min_cell_flt->size();
141 sum += H::serialize_byte_size<u32>();
142 sum += H::serialize_byte_size<pos_t>(sz);
143 sum += H::serialize_byte_size<pos_t>(sz);
144 }
else if (state == 3) {
145 u32 sz = buf_pos_min_cell->size();
146 sum += H::serialize_byte_size<u32>();
147 sum += H::serialize_byte_size<ipos_t>(sz);
148 sum += H::serialize_byte_size<ipos_t>(sz);
149 sum += H::serialize_byte_size<pos_t>(sz);
150 sum += H::serialize_byte_size<pos_t>(sz);
162 serializer.load(state);
167 ret.buf_pos_min_cell = std::make_unique<sycl::buffer<ipos_t>>(sz);
168 ret.buf_pos_max_cell = std::make_unique<sycl::buffer<ipos_t>>(sz);
169 serializer.load_buf(*ret.buf_pos_min_cell, sz);
170 serializer.load_buf(*ret.buf_pos_max_cell, sz);
171 }
else if (state == 2) {
174 ret.buf_pos_min_cell_flt = std::make_unique<sycl::buffer<pos_t>>(sz);
175 ret.buf_pos_max_cell_flt = std::make_unique<sycl::buffer<pos_t>>(sz);
176 serializer.load_buf(*ret.buf_pos_min_cell_flt, sz);
177 serializer.load_buf(*ret.buf_pos_max_cell_flt, sz);
178 }
else if (state == 3) {
181 ret.buf_pos_min_cell = std::make_unique<sycl::buffer<ipos_t>>(sz);
182 ret.buf_pos_max_cell = std::make_unique<sycl::buffer<ipos_t>>(sz);
183 ret.buf_pos_min_cell_flt = std::make_unique<sycl::buffer<pos_t>>(sz);
184 ret.buf_pos_max_cell_flt = std::make_unique<sycl::buffer<pos_t>>(sz);
185 serializer.load_buf(*ret.buf_pos_min_cell, sz);
186 serializer.load_buf(*ret.buf_pos_max_cell, sz);
187 serializer.load_buf(*ret.buf_pos_min_cell_flt, sz);
188 serializer.load_buf(*ret.buf_pos_max_cell_flt, sz);