Mutation Support

未关闭
#466 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
20/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
停滞
技术栈
julia

调研方向

从现有的 spawn_datadeps 入口点和 #454 中描述的工作开始,然后研究 frontend、scheduler、缓存管理以及与 processor 关联的内存空间需要如何变更。完成标准是确定一套涵盖 mutation ownership、同步、复制和版本控制、非 Chunk 参数以及依赖关系规范的设计。

由索引模型根据 Issue 内容生成。

描述

data movement eager api enhancement scheduler

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:

  • In/Out unwrapping and propagation in the frontend
  • Data ownership tracking (exclusive (write) vs. shared (read)) in the scheduler
  • Careful cache management in the face of mutating values (i.e. proper alternative to https://github.com/JuliaParallel/Dagger.jl/pull/465)
  • Awareness of processor-associated memory spaces and their aliasing properties
  • copyto! alternative which integrates with Dagger's synchronization (required for GPU support)
  • Relaxed semantics w.r.t writing data into the original user-provided data containers (lazy writing allows for reduced data transfers and better parallelism), similar to Tapir's sync regions
  • (Speculative) Data copying and versioning system in the scheduler, to make copies of data for reading and track which copies are up-to-date w.r.t last write
  • A plan on how to deal with non-Chunk arguments, w.r.t what we'll need to do to ensure we can still track them appropriately and enable distributed parallelism
  • A system for utilizing Julia's compiler to determine dependencies automatically, when unspecified
  • A system for specifying dependencies ahead-of-time for a given dispatch signature
主要语言
Julia
星标
734
派生
94
平均合并
4 天 18 小时
30 天内合并 PR
2

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

JuliaParallel/Dagger.jl 的其他 Issue

查看 JuliaParallel/Dagger.jl 的全部 Issue

相似的 Issue

更多 Julia Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。