Skip to content

Commit

Permalink
Overhaul region map implementation
Browse files Browse the repository at this point in the history
This replaces the existing region_map class with a new implementation
based on an R-Tree, which greatly improves update and query performance.
  • Loading branch information
psalz committed Jul 13, 2023
1 parent d5f1b56 commit adff79e
Show file tree
Hide file tree
Showing 18 changed files with 2,192 additions and 185 deletions.
6 changes: 5 additions & 1 deletion include/buffer_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ namespace detail {

template <typename DataT, int Dims>
buffer_id register_buffer(range<3> range, const DataT* host_init_ptr = nullptr) {
assert(Dims > 0 || range[0] == 1);
assert(Dims > 1 || range[1] == 1);
assert(Dims > 2 || range[2] == 1);

buffer_id bid;
const bool is_host_initialized = host_init_ptr != nullptr;
{
Expand All @@ -142,7 +146,7 @@ namespace detail {
auto host_factory = [](const celerity::range<3>& r) { return std::make_unique<host_buffer_storage<DataT, Dims>>(range_cast<Dims>(r)); };
m_buffer_infos.emplace(
bid, buffer_info{Dims, range, sizeof(DataT), is_host_initialized, {}, std::move(device_factory), std::move(host_factory)});
m_newest_data_location.emplace(bid, region_map<data_location>(range, data_location::nowhere));
m_newest_data_location.emplace(bid, region_map<data_location>(range, Dims, data_location::nowhere));

#if defined(CELERITY_DETAIL_ENABLE_DEBUG)
m_buffer_types.emplace(bid, new buffer_type_guard<DataT, Dims>());
Expand Down
2 changes: 1 addition & 1 deletion include/graph_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ namespace detail {
*/
graph_generator(size_t num_nodes, command_graph& cdag);

void add_buffer(buffer_id bid, const range<3>& range);
void add_buffer(const buffer_id bid, const int dims, const range<3>& range);

// Build the commands for a single task
void build_task(const task& tsk, const std::vector<graph_transformer*>& transformers);
Expand Down
Loading

0 comments on commit adff79e

Please sign in to comment.