Supporting Linear Algebraic Primitives
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 20/100
Piste de recherche
Commencez par examiner l’interface scalaire DiffRules existante et la discussion associée sur DiffLinearAlgebra, notamment la distinction proposée entre tenseurs et scalaires, les méthodes in-place et les variables adjointes. L’issue ne nomme ni fichiers ni tests ; sa résolution nécessiterait une interface arrêtée et un plan d’implémentation pour les primitives d’algèbre linéaire et leurs règles de forward mode et de reverse mode.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
(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.
- Langage dominant
- Julia
- Étoiles
- 74
- Forks
- 36
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de JuliaDiff/DiffRules.jl
-
Package extensionsPeut-être pris @devmotion l’a pris il y a 28 jours. Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
JuliaDiff/DiffRules.jl#106 · 2 commentaires · 2 réactions ·
-
Stable documentat is not latestOuverte
Difficulté 3/5 1-2 jours Accessibilité débutants 35/100
JuliaDiff/DiffRules.jl#104 ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
JuliaDiff/DiffRules.jl#102 · 2 commentaires ·
-
Problems with the `DEFINED_DIFFRULES` implementationPeut-être pris @devmotion l’a pris il y a 28 jours. Ouverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
JuliaDiff/DiffRules.jl#90 · 1 réaction ·
-
Derivatives of max and minOuverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
JuliaDiff/DiffRules.jl#68 · 2 commentaires ·
Toutes les issues de JuliaDiff/DiffRules.jl
Issues similaires
-
Add more snippets to R and JuliaOuverteenhancement good first issue help wanted
Difficulté 2/5 Une demi-journée Accessibilité débutants 82/100
-
authority-vechtstromen ready-for-agent
Difficulté 1/5 Moins d'une heure Accessibilité débutants 75/100
Deltares/Ribasim-NL#890 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
Les mainteneurs répondent en général sous 1 jour
-
Precompilation fails on Julia 1.14 nightly: HessenbergQ lmul! methods overwrite LinearAlgebra'sOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
JuliaLinearAlgebra/GenericLinearAlgebra.jl#183 · 1 commentaire ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
JuliaGPU/KernelAbstractions.jl#897 ·
Les mainteneurs répondent en général sous 1 jour