Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change split functions to work on box instead of chunk #323

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

psalz
Copy link
Member

@psalz psalz commented Dec 20, 2024

chunk is a purely user-facing type (and of questionable usefulness at that), and since all of our internal tracking is built around box, splitting should follow suit.

Copy link

Check-perf-impact results: (000e2892abb21ddd1ae413a5c86d7d95)

❓ No new benchmark data submitted. ❓
Please re-run the microbenchmarks and include the results if your commit could potentially affect performance.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (1/1)

@@ -8,7 +9,7 @@

namespace celerity::detail {

std::vector<chunk<3>> split_1d(const chunk<3>& full_chunk, const range<3>& granularity, const size_t num_chunks);
std::vector<chunk<3>> split_2d(const chunk<3>& full_chunk, const range<3>& granularity, const size_t num_chunks);
std::vector<box<3>> split_1d(const box<3>& full_box, const range<3>& granularity, const size_t num_boxs);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-inconsistent-declaration-parameter-name ⚠️
function celerity::detail::split_1d has a definition with different parameter names

std::vector<chunk<3>> split_1d(const chunk<3>& full_chunk, const range<3>& granularity, const size_t num_chunks);
std::vector<chunk<3>> split_2d(const chunk<3>& full_chunk, const range<3>& granularity, const size_t num_chunks);
std::vector<box<3>> split_1d(const box<3>& full_box, const range<3>& granularity, const size_t num_boxs);
std::vector<box<3>> split_2d(const box<3>& full_box, const range<3>& granularity, const size_t num_boxs);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ readability-inconsistent-declaration-parameter-name ⚠️
function celerity::detail::split_2d has a definition with different parameter names

@coveralls
Copy link

Pull Request Test Coverage Report for Build 12434960318

Details

  • 47 of 47 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.005%) to 95.055%

Totals Coverage Status
Change from base Build 12390656669: 0.005%
Covered Lines: 7098
Relevant Lines: 7203

💛 - Coveralls

Copy link
Contributor

@GagaLP GagaLP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

Copy link
Contributor

@fknorr fknorr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it!

If I'm not mistaken you could also define command_graph_generator::assigned_chunk in terms of boxes and get rid of even more casts without much hassle - buffer_access_map already operates on boxes.

Also, a drive-by suggestion:

diff --git a/src/command_graph_generator.cc b/src/command_graph_generator.cc
index da56682e..3cfb6d22 100644
--- a/src/command_graph_generator.cc
+++ b/src/command_graph_generator.cc
@@ -117,11 +117,9 @@ std::vector<const command*> command_graph_generator::build_task(const task& tsk)
 }

 void command_graph_generator::report_overlapping_writes(const task& tsk, const box_vector<3>& local_chunks) const {
-       const chunk<3> full_chunk{tsk.get_global_offset(), tsk.get_global_size(), tsk.get_global_size()};
-
        // Since this check is run distributed on every node, we avoid quadratic behavior by only checking for conflicts between all local chunks and the
        // region-union of remote chunks. This way, every conflict will be reported by at least one node.
-       const box<3> global_chunk(subrange(full_chunk.offset, full_chunk.range));
+       const box<3> global_chunk(subrange(tsk.get_global_offset(), tsk.get_global_size()));
        auto remote_chunks = region_difference(global_chunk, region(box_vector<3>(local_chunks))).into_boxes();

        // detect_overlapping_writes takes a single box_vector, so we concatenate local and global chunks (the order does not matter)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants