Skip to content

Conversation

@tkf
Copy link
Member

@tkf tkf commented Mar 18, 2022

Since arbitrary functions can use @async as an implementation detail, there's currently almost no way to protect against accidentally disabling migratability of a task. Unless we implement something like #41393 to mitigate this, I suggest recommending @spawn over @async always. I think this might be what we want to do eventually anyway to push the ecosystem to improve parallelism and concurrency support.

@tkf tkf requested review from vchuravy and vtjnash March 18, 2022 06:52
@Seelengrab
Copy link
Contributor

Seelengrab commented Mar 18, 2022

Would it be possible to allow @async tasks to migrate as well instead? The combination of @async with @sync seems very useful to me - having to reimplement that manually with @spawn sounds cumbersome..

@jpsamaroo
Copy link
Member

Would it be possible to allow @async tasks to migrate as well instead?

As I understand it, the current semantics of @async are strict such that we can't do this. There is code that uses @async under the expectation that the thread will not change during the task's lifetime.

@vtjnash
Copy link
Member

vtjnash commented Mar 21, 2022

We may get migration in the future at some point, but we haven't worked out the design details. They are permitted to change the underlying thread, but must arrange to ensure that no other disallowed @async block is run in parallel.

Copy link
Member

@vtjnash vtjnash left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me

Co-authored-by: Jameson Nash <[email protected]>
@tkf tkf added the merge me PR is reviewed. Merge when all tests are passing label Mar 21, 2022
@tkf
Copy link
Member Author

tkf commented Mar 21, 2022

We can wait for more feedbacks but it's also very easy to just revert this. So, I think it's OK to merge this for now so that there's a larger chance that more people look at it before the actual release.

@vtjnash vtjnash merged commit 28f58e7 into JuliaLang:master Mar 21, 2022
@giordano giordano removed the merge me PR is reviewed. Merge when all tests are passing label Mar 21, 2022
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.

5 participants