Skip to content

Minor optimization in ExpandHalfToFull - #1264

Open
aprokop wants to merge 2 commits into
arborx:masterfrom
aprokop:minor_optimization
Open

Minor optimization in ExpandHalfToFull#1264
aprokop wants to merge 2 commits into
arborx:masterfrom
aprokop:minor_optimization

Conversation

@aprokop

@aprokop aprokop commented Jun 11, 2025

Copy link
Copy Markdown
Contributor

No need to hammer local counts with atomics, use local variable instead.

@aprokop
aprokop requested a review from dalg24 June 11, 2025 21:28
@aprokop aprokop added the performance Something is slower than it should be label Jun 11, 2025
dalg24
dalg24 previously approved these changes Jun 11, 2025

@dalg24 dalg24 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please share perf test results

Comment thread src/spatial/detail/ArborX_ExpandHalfToFull.hpp Outdated
@aprokop
aprokop force-pushed the minor_optimization branch from 3fc5cdc to c15dbd2 Compare June 12, 2025 21:36
Comment thread src/spatial/detail/ArborX_ExpandHalfToFull.hpp
@aprokop
aprokop force-pushed the minor_optimization branch from c15dbd2 to aeeec84 Compare June 13, 2025 14:41
@aprokop

aprokop commented Jun 13, 2025

Copy link
Copy Markdown
Contributor Author

Rebased on #1265 and squashed.

@aprokop

aprokop commented Jun 13, 2025

Copy link
Copy Markdown
Contributor Author

Please share perf test results

Don't have any. This is just an observation not related to any particular problem I've run.

Comment thread src/spatial/detail/ArborX_ExpandHalfToFull.hpp Outdated
@dalg24
dalg24 dismissed their stale review June 15, 2025 08:29

I don't think we should merge until we have confirmed it is beneficial

No need to hammer local counts with atomics, use local variable instead.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to reduce atomic contention in the half-to-full neighbor list expansion path (expandHalfToFull) by using precomputed local offsets and fewer atomics during counting and rewriting.

Changes:

  • Optimize expandHalfToFull() counting by batching per-row increments and skipping empty rows.
  • Optimize expandHalfToFull() rewriting by writing the “forward” neighbors without atomics and placing reverse edges from the end of each row.
  • Refactor/adjust neighbor list fill/copy loops in ArborX_NeighborList.hpp (but the current HalfNeighborList fill callback no longer matches its count phase).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/spatial/detail/ArborX_NeighborList.hpp Adjusts how half/full neighbor list entries are filled/copied; currently introduces an inconsistency in HalfNeighborList fill vs count.
src/spatial/detail/ArborX_ExpandHalfToFull.hpp Reduces atomic operations in counting and rewrite phases when expanding a half neighbor list to a full neighbor list.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/spatial/detail/ArborX_NeighborList.hpp
@aprokop
aprokop force-pushed the minor_optimization branch from 37beb63 to f27f4a2 Compare August 27, 2026 16:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Something is slower than it should be

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants