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

datadeps: Optimize using task results via deferrals #567

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jpsamaroo
Copy link
Member

This PR improves Datadeps to be capable of properly "deferring" a task for later scheduling when that task depends on the result of another task that was spawned within the same Datadeps region. For example, this PR should provide a nice optimization for the following style of code:

fetch(Dagger.spawn_datadeps() do
    A = Dagger.@spawn zeros(4096, 2)
    Dagger.@spawn rand!(Out(@view A[:, 1]))
    Dagger.@spawn rand!(Out(@view A[:, 2]))

    B = Dagger.@spawn rand(128)

    s = Dagger.@spawn sum(A)
    t  = Dagger.@spawn sum(B)
    Dagger.@spawn s + t
end)

Previously, the above code would stall the Datadeps scheduler in the rand! calls until A finished executing, and then stall again when computing s and t, reducing the effective parallelism significantly. With this PR, the above code will no longer stall the scheduler, and will ensure that any task that uses a DTask as input is either ready to run (all such inputs are ready), or will be deferred for later handling.

@jpsamaroo jpsamaroo marked this pull request as draft August 23, 2024 13:50
@jpsamaroo
Copy link
Member Author

Converting to draft as this will require more work to retain sequential consistency.

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

Successfully merging this pull request may close these issues.

1 participant