Supporting Linear Algebraic Primitives
まだ誰も着手していません。
評価
調査の方向性
まず、既存のスカラー DiffRules インターフェースと、関連する DiffLinearAlgebra の議論を確認します。そこには、提案されているテンソルとスカラーの区別、in-place メソッド、随伴変数が含まれます。この issue ではファイルやテストは指定されていません。完了には、線形代数プリミティブとその forward-mode および reverse-mode のルールについて、インターフェースと実装計画が確定していることが必要です。
索引モデルが issue の本文から書いたものです。
説明
(continued from https://github.com/invenia/Nabla.jl/issues/81, cc @willtebbutt)
This means that we would need a slightly more general interface for linear algebra, and would certainly require different forward- and reverse- mode expressions, than is currently provided by DiffRules.
Agreed, DiffRules only properly handles scalar kernels now. To support linear algebra, we need to add a notion of tensor/scalar, allowing in-place methods, marking adjoint variables, etc. to DiffRules.
Regarding the where possible statement above, there are certainly operations (such as the Cholesky factorisation) for which symbolic expressions might be a bit unweildy (see here). Now that I think about this a bit more, I'm not sure whether these larger implementations are going to be problematic or not.
Anyway, my point is that given symbolic expressions for the linear algebra operations I agree that it's reasonable to hope that compiler optimisations can eliminate redundant code when compiling custom kernel implementations, and that this is a significantly better idea than hand-coding lots of optimisations. (The issue I linked in my previous comment is a good example of this. I would definitely prefer to be able to just forget about this). However, I would contend that you simply can't handle linear algebra properly without a number of hand-coded symbolic expressions for the forward- and reverse-mode sensitivities because they aren't written in Julia. If at some point in the future we have native Julia implementation of (for example) LAPACK, then it would be a really good idea to try and produce an AD tool which is able to produce reasonably-well optimised kernels for each operation. To the best of my knowledge, we shouldn't expect this to happen any time soon (and almost certainly never for BLAS), so a symbolic version of the current implementation of DiffLinearAlgebra will be necessary for Capstan to be able to differentiate arbitrary Julia code even reasonably efficiently.
I think there might've been a misunderstanding with my previous post 😛I definitely am not arguing that we should express e.g. complex LAPACK kernels symbolically, and I didn't mean to imply that DiffRules/DiffLinearAlgebra were directly competing approaches. On the contrary, I think they're quite complementary - if DiffLinearAlgebra didn't exist, I eventually would need to make a "DiffKernels.jl" anyway. DiffRules is useful for mapping primal functions to derivative functions, and is thus useful when generating e.g. instruction primitives/computation graphs within downstream tools (i.e. it solves the problem "what kernels should I call and how should I call them?"). DiffLinearAlgebra (as it stands) is useful for providing implementations of these kernels (i.e. solves the problem "how do I execute the kernels that I'm calling?"). They're both necessary components of the AD ecosystem.
As for deciding what computations should be primitives, I think we're already on the same page; a computation should be defined as a primitive if either/both of the following applies:
- it is difficult to express the computation as a composition of existing primitives
- a hand-optimized kernel for the computation is sufficiently more performant than the equivalent composition of existing primitives, even after taking into account potential compiler-level optimizations.
- 主要言語
- Julia
- スター
- 74
- フォーク
- 36
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
JuliaDiff/DiffRules.jl のほかの issue
-
Package extensions対応中かも @devmotion が 30 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
JuliaDiff/DiffRules.jl#106 · コメント 2 件 · リアクション 2 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
JuliaDiff/DiffRules.jl#104 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
JuliaDiff/DiffRules.jl#102 · コメント 2 件 ·
-
Problems with the `DEFINED_DIFFRULES` implementation対応中かも @devmotion が 30 日前に担当しました。 オープン
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
JuliaDiff/DiffRules.jl#90 · リアクション 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
JuliaDiff/DiffRules.jl#68 · コメント 2 件 ·
JuliaDiff/DiffRules.jl の issue をすべて見る
似ている issue
-
OptimizationCUTEst jobs fail: gfortran not installed on the runner対応中かも @ChrisRackauckas-Claude が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
SciML/SciMLBenchmarks.jl#1946 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
JuliaSmoothOptimizers/NCL.jl#101 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
WaterLily-jl/WaterLily.jl#367 ·
メンテナーはふだん 1 日以内に返信