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 a static single-producer single-consumer queue #5659

Merged
merged 1 commit into from
Dec 8, 2023

Conversation

nilsdeppe
Copy link
Member

Proposed changes

This is needed for efficient intra-node data transfers when using a nodegroup DG element setup.

Upgrade instructions

Code review checklist

  • The code is documented and the documentation renders correctly. Run
    make doc to generate the documentation locally into BUILD_DIR/docs/html.
    Then open index.html.
  • The code follows the stylistic and code quality guidelines listed in the
    code review guide.
  • The PR lists upgrade instructions and is labeled bugfix or
    new feature if appropriate.

Further comments

@nilsdeppe nilsdeppe requested a review from kidder December 8, 2023 15:59
Copy link
Member

@wthrowe wthrowe left a comment

Choose a reason for hiding this comment

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

The internal caching logic all looks right.

return try_emplace(std::forward<P>(v));
}

/// Removes the first element from the queue and returns it.
Copy link
Member

Choose a reason for hiding this comment

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

This just returns it, doesn't remove.

std::array<T, capacity_ + 2 * padding_> data_{};

// Align to cache line size in order to avoid false sharing
// readIndexCache_ and writeIndexCache_ is used to reduce the amount of cache
Copy link
Member

Choose a reason for hiding this comment

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

update these to correct names

alignas(cache_line_size_) size_t write_index_cache_{0};

// Padding to avoid adjacent allocations from sharing a cache line with
// writeIndexCache_
Copy link
Member

Choose a reason for hiding this comment

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

update name

@nilsdeppe
Copy link
Member Author

Thanks for the reviews! I rebased and just squashed the minor documentation changes.

@kidder kidder merged commit c16e7aa into sxs-collaboration:develop Dec 8, 2023
22 checks passed
@nilsdeppe nilsdeppe deleted the add_threading_2 branch April 11, 2024 03:19
@nilsdeppe nilsdeppe restored the add_threading_2 branch April 11, 2024 03:19
@nilsdeppe nilsdeppe deleted the add_threading_2 branch April 11, 2024 03:22
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.

3 participants