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

Change/Fix to use a symmetric barrier to synchronize domains #509

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

polytypic
Copy link

@polytypic polytypic commented Jan 12, 2025

Unless I've misunderstood something, the idea is to synchronize the two domains before the two sequences of operations are run in parallel. The previous implementation used an asymmetric approach where one domain only spins on a flag and the other only sets the flag. That is not really guaranteed to synchronize the domains — the domain setting the flag might start running the operations before the domain spinning on the flag gets a chance to run. This PR changes the code to use a symmetric barrier: a counter is initialized with 2, both domains decrement the counter, and then spin until the counter becomes zero. This should improve the synchronization between the two domains.

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.

1 participant