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

Make sure Matrix::waitLocalTiles actually consumes the tile wrappers immediately #1257

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

Conversation

msimberg
Copy link
Collaborator

Together with pika-org/pika#1373, this should be at least another step towards avoiding yielding after calling waitLocalTiles. pika-org/pika#1373 made sure that the continuation that gets access to a wrapper, actually contains the last reference to the internal shared state and thus is able to release the next access as soon as that wrapper is released.

This PR ensures that the wrapper is actually used by the continuation in waitLocalTiles. I had implemented waitLocalTiles wrongly in the sense that drop_value does indeed ignore the value sent from the predecessor, but it takes the value by forwarding reference and thus doesn't actually consume the wrapper. Before this PR, when sync_wait returns the last access is semantically "done", but the wrapper has not necessarily been released by that time. Most of the time this is good enough to guarantee that the next access is inline, but sometimes the wrapper will be released too late. By actually waiting for the wrapper(s) and taking them into the local function scope where sync_wait is called, we guarantee that the wrapper is released in the function scope.

An alternative way to implement this would be to replace drop_value by then([](auto){}). drop_value is effectively then([](auto&&){}). The former consumes the wrapper in the continuation while the latter only takes a reference and releases the wrapper much later.

Since CI is still using pika 0.30.1 and pika-org/pika#1373 is in 0.31.0 this PR alone won't get rid of issues in e.g. test_bt_reduction_to_band, but it's a necessary step.

@msimberg msimberg requested review from rasolca and albestro January 14, 2025 14:47
@msimberg msimberg self-assigned this Jan 14, 2025
@msimberg msimberg mentioned this pull request Jan 14, 2025
@msimberg
Copy link
Collaborator Author

cscs-ci run

Copy link
Collaborator

@aurianer aurianer left a comment

Choose a reason for hiding this comment

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

LGTM thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Review
Development

Successfully merging this pull request may close these issues.

2 participants