custom AD transform plugin: a use case from YaoCompiler
还没有人认领这个 Issue。
评估
调研方向
未指定任何文件、测试或入口点。首先明确 Diffractor 应如何与 YaoCompiler 的 Julia SSA IR 交互,包括量子块和量子终结器,并定义插件边界以及经典组件与量子组件的预期行为,然后才能确定实现范围。
由索引模型根据 Issue 内容生成。
描述
this is just one thing I was waiting Diffractor to think about, it comes from the idea of integrating Diffractor and YaoCompiler, I'll leave a description of what we want to do on this here, I assume this could be similar for GPUs too, since the design of SSA IR can be seen as MLIR regions too.
in a quantum program, there are certain AD rules that makes use of the reversibility and (quantum specific) algebra rules, such as Pauli operators etc.
As a result there are three ways of doing AD on a quantum program
- parameter shift rule: forward mode AD, works on hardware, but on pure quantum circuits that satisfy the Pauli operator permutation rule
- reverse mode using circuit reverisbility: reverse mode, but only runs on simulator, the register (quantum state vector) will always be mutated to save memory (thus has side effect)
- transform the circuit to an integral of channel: forward mode, works on hardware, works on broader set of operators, but will create a hybrid program (may contain classical control flow)
these can be implemented on a pure quantum program without touching compiler transform, which we can do in short term, but
the problem becomes different when the program contains classical control flows (the long term goal),
which is one feature we aim to support in YaoCompiler - compile a general Julia program to quantum hardware,
in YaoCompiler, we extend Julia SSA IR to contain two new elements in the SSA IR:
- a quantum block: like basic block, but only contains quantum instructions/statements, this block is always inside a basic block
- a quantum terminator: statement that jump from a quantum block to a basic block
(I wish I could post a picture of this, but I don't have one at the moment)
so then the idea is to tell an AD compiler like Diffractor to know how to transform a piece of program like this using a plugin, or re-use Diffractor's transformation in another compiler plugin for the irrelavent part (for the quantum case, is to run Diffractor on classical statements, but run a custom pass on the quantum components above) but I'm not sure if this is the best way of doing it. And I think with the work of julia compiler plugin there would be more cases like this that someone may want to have a custom AD plugin used by Diffractor when differentiating under their compiler plugin context.
I guess some other folks might be interested in this, cc: @aviatesk @femtomc
- 主要语言
- Julia
- 星标
- 453
- 派生
- 33
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
JuliaDiff/Diffractor.jl 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 25/100
JuliaDiff/Diffractor.jl#302 · 2 条评论 ·
-
难度 3/5 1-2 天 新手友好度 52/100
JuliaDiff/Diffractor.jl#294 ·
-
bug
难度 4/5 3-5 天 新手友好度 35/100
JuliaDiff/Diffractor.jl#293 ·
-
bug
难度 4/5 3-5 天 新手友好度 35/100
JuliaDiff/Diffractor.jl#290 · 8 条评论 ·
-
难度 3/5 1-2 天 新手友好度 35/100
JuliaDiff/Diffractor.jl#280 · 1 条评论 ·
查看 JuliaDiff/Diffractor.jl 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
WaterLily-jl/WaterLily.jl#367 ·
维护者通常 1 天内回复
-
R_to_gamma and R_to_v are wrong for |Z| != 1 (e.g. heavy ions)可能已有人在做 @DavidSagan 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
bmad-sim/BeamTracking.jl#366 ·
维护者通常 1 天内回复
-
TSDAE's docstring implies a theta argument it does not take可能已有人在做 @singhharsh1708 于 1 天前认领。 未关闭documentation
难度 1/5 1 小时以内 新手友好度 74/100
SciML/PETScDiffEq.jl#282 ·
维护者通常 1 天内回复
-
enhancement good first issue help wanted
难度 2/5 半天 新手友好度 82/100
-
SavedSubsystem with an integer save_idxs maps the index the wrong way round可能已有人在做 @ChrisRackauckas 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
SciML/SciMLBase.jl#1643 ·
维护者通常 2 天内回复