Skip to content

Extend fork_async_producers to support functions scheduled with compute_with#5195

Open
vksnk wants to merge 9 commits intomainfrom
vksnk/compute_with_async
Open

Extend fork_async_producers to support functions scheduled with compute_with#5195
vksnk wants to merge 9 commits intomainfrom
vksnk/compute_with_async

Conversation

@vksnk
Copy link
Member

@vksnk vksnk commented Aug 19, 2020

As described in #5179 compute_with() and async() have issues when used together and this PR extends ForkAsyncProducers to support fused function groups to address these issues.

The important limitation is that all functions from the same group have to be marked as async and will share fork block/task/thread. I think this is the only reasonable combination, because functions scheduled with compute_with share the loop(s) and launching them in different task would break this assumption.

(interesting side-effect of this is that now it's possible to schedule two completely independent functions to be executed in the same fork block with something like:

producer1.async();
producer2.compute_with(producer1, Var::outermost()).async();

).

I've added a number of tests which cover some of the possible combinations, but for something like async which depends on things like timing and such, it's quite difficult to be 100% convinced about correctness. For the existing functionality, I've tried to minimize changes to make sure that stuff that worked before still works. Also, I've eyeballed generated IR to make sure that forks and semaphores are generated in proper places and it looked alright.

@steven-johnson steven-johnson requested a review from zvookin August 19, 2020 17:34
@vksnk
Copy link
Member Author

vksnk commented Aug 31, 2020

Monday review ping.

@steven-johnson
Copy link
Contributor

Is this just awaiting review?

@alexreinking alexreinking modified the milestones: v11.0.0, v12.0.0 Oct 17, 2020
@steven-johnson
Copy link
Contributor

Where does this PR stand?

@vksnk
Copy link
Member Author

vksnk commented Oct 22, 2020

Yes, waiting for review.

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