JuliaParallel / Dagger.jl

A framework for out-of-core and parallel execution
Other
621 stars 67 forks source link

Mutation Support #466

Open jpsamaroo opened 7 months ago

jpsamaroo commented 7 months ago

Dagger has previously been a purely-functional model, expecting that new values are calculated by applying a function to a set of existing values, without allowing for arguments to be mutated or changed in any way. This model is convenient from an optimization perspective (as we can do aggressive caching and duplication of data, memoization of results, etc.), but it's also quite limiting for users operating in an imperative language like Julia.

I've long desired to find a way to relax this model, and in the course of working on #454, I've found that the simple In/Out model of OpenMP's data dependency system (that spawn_datadeps implements) is quite powerful and allows for a very convenient programming interface, while utilizing a variety of powerful performance optimizations. It also seems to leave room for more fine-grained synchronization and mutation systems going forward.

Of course, spawn_datadeps is rather limiting if we want to optimize over a larger region of code, including nested datadeps regions, which aren't trivial to support with the current implementation. Therefore, I'd like to consider what would be required to move support for the same programming model and optimizations directly into Dagger, to see what that would look like.

Here are the basic set of high-level changes that we'll need to support this model: