Reorganize #ifdef guards and private members in BoundedSPSCQueueImpl#917
Open
xuetianhao98 wants to merge 2 commits into
Open
Reorganize #ifdef guards and private members in BoundedSPSCQueueImpl#917xuetianhao98 wants to merge 2 commits into
xuetianhao98 wants to merge 2 commits into
Conversation
Owner
|
Hey, thanks for the PR! Two issues:
e.g. alignas(QUILL_CACHE_LINE_ALIGNED) std::atomic<integer_type> _atomic_writer_pos{0};
alignas(QUILL_CACHE_LINE_ALIGNED) integer_type _writer_pos{0};
integer_type _reader_pos_cache{0};
#ifdef QUILL_X86ARCH
integer_type _last_flushed_writer_pos{0};
#endif
alignas(QUILL_CACHE_LINE_ALIGNED) std::atomic<integer_type> _atomic_reader_pos{0};
alignas(QUILL_CACHE_LINE_ALIGNED) integer_type _reader_pos{0};
mutable integer_type _writer_pos_cache{0};
#ifdef QUILL_X86ARCH
integer_type _last_flushed_reader_pos{0};
#endif
|
Author
Wow!Thanks for the detailed review and for pointing this out. Your review helped me understand this data structure at a deeper level. I didn’t consider the cache line layout deeply enough when making those changes, especially the implications around locality and false sharing. I’ve now addressed both issues following your suggestions:
A new commit has been pushed with these fixes. Please let me know if anything still looks off. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves
QUILL_CACHE_LINE_MASK,_last_flushed_writer_pos, and_last_flushed_reader_posinside#ifdef QUILL_X86ARCHguards, since they are only referenced within x86-specific cache-line flushing logic. Also regroups the remaining position-tracking members for better locality.These members serve no purpose on non-x86 targets. Guarding them properly reduces object size on other architectures, prevents accidental misuse outside x86 code paths, and makes the platform-specific intent explicit at a glance.