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

Add helper method for efficiently combining logical operations #582

Open
publixsubfan opened this issue Jun 4, 2021 · 3 comments
Open
Assignees
Labels
Core Issues related to Axom's 'core' component design Issues related to design and software engineering GPU Issues related to GPU development Primal Issues related to Axom's 'primal component question Further information is requested Reviewed

Comments

@publixsubfan
Copy link
Contributor

In #577, it was discovered that using bitwise AND to combine the results of single-dimension checks was considerably faster than using logical AND on the GPU:

bool status = true;
for (int idim  = 0; idim < NDIMS; idim++)
{
    // generates predicated branches: slower on GPU, faster on CPU
    status = status && detail::intersect(...);
    // faster on GPU
    status = status & detail::intersect(...);
}

Conversely, the logical AND seems to be faster than the bitwise AND on the CPU.

We should create a helper macro/method that can pick between bitwise and logical AND depending on whether the code is being compiled for the CPU or the GPU.

@publixsubfan publixsubfan added Core Issues related to Axom's 'core' component Primal Issues related to Axom's 'primal component GPU Issues related to GPU development labels Jun 4, 2021
@rhornung67 rhornung67 added this to the FY22 Development milestone Oct 12, 2021
@kennyweiss kennyweiss added design Issues related to design and software engineering question Further information is requested labels Nov 15, 2021
@kennyweiss
Copy link
Member

There are open questions about how to best deal with this.

  • Macros are likely the most performant way to deal with this, but not the most readable.
  • Inline functions might not generate optimal assembly code

@kennyweiss
Copy link
Member

Perhaps add this to a "benchmarks" suite to track performance across platforms?

@rhornung67 rhornung67 removed this from the FY22 Development milestone Feb 6, 2023
@kennyweiss kennyweiss mentioned this issue Aug 7, 2024
3 tasks
@kennyweiss
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core Issues related to Axom's 'core' component design Issues related to design and software engineering GPU Issues related to GPU development Primal Issues related to Axom's 'primal component question Further information is requested Reviewed
Projects
None yet
Development

No branches or pull requests

3 participants