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

Prefer atomic_inc to atomic_increment #1183

Merged
merged 2 commits into from
Oct 15, 2024
Merged

Conversation

aprokop
Copy link
Contributor

@aprokop aprokop commented Oct 15, 2024

No description provided.

Copy link
Contributor

@dalg24 dalg24 left a comment

Choose a reason for hiding this comment

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

Per kokkos/kokkos#7449 (comment) atomic_increment might get deprecated in favor of atomic_inc

@aprokop
Copy link
Contributor Author

aprokop commented Oct 15, 2024

Per kokkos/kokkos#7449 (comment) atomic_increment might get deprecated in favor of atomic_inc

Oh, sorry, I misunderstood, and thought it was the other way around.

@aprokop aprokop changed the title Prefer atomic_increment to atomic_inc Prefer atomic_incr to atomic_increment Oct 15, 2024
@aprokop aprokop changed the title Prefer atomic_incr to atomic_increment Prefer atomic_inc to atomic_increment Oct 15, 2024
Comment on lines 37 to 39
Kokkos::atomic_inc(&_counts(i));

if (_counts(i) < _n)
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks super sketchy

Suggested change
Kokkos::atomic_inc(&_counts(i));
if (_counts(i) < _n)
auto const counts_i = Kokkos::atomic_inc_fetch(&_counts(i));
if (counts_i < _n)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not really sketchy, but you are right, it is could be suboptimal in the case of threads sharing a query (which they currently don't when running BVH). I'll fix it.

Co-authored-by: Damien L-G <dalg24+github@gmail.com>
@aprokop aprokop merged commit 116aabd into arborx:master Oct 15, 2024
2 checks passed
@aprokop aprokop deleted the atomic_increment branch October 15, 2024 22:51
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.

2 participants