-
Notifications
You must be signed in to change notification settings - Fork 29
Forward-mode AD #389
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
Merged
Merged
Forward-mode AD #389
Changes from all commits
Commits
Show all changes
226 commits
Select commit
Hold shift + click to select a range
be316ff
Start forward mode prototype
gdalle deac913
First working autodiff
gdalle 9c96c8d
Docstring
gdalle 136aff6
Apply suggestions from code review
gdalle f65cc53
Moving files around
gdalle 053a8bb
Primitives already known
gdalle 6d8ec04
Merge branch 'main' into gd/forward
gdalle a3107a8
Keep pushing forward (pun intended)
gdalle 2836ac8
Still buggy, don't touch
gdalle 09d63bd
Keep instruction mapping one to one
gdalle fa679eb
Use replace_call
gdalle a68257c
Ignore code cov
gdalle 7a096ba
No Aqua piracies test
gdalle 46c3e5a
Start control flow
gdalle ad3f98a
Fix intrinsic
gdalle 9071574
Import
gdalle dcfe282
Typos
gdalle e44380d
Co-authored-by: Will Tebbutt <willtebbutt@users.noreply.github.com>
gdalle dd89e57
Figure out incremental additions
gdalle 9bdb57f
Initial test case additions
willtebbutt 4bb9911
Formatting
willtebbutt 9b037e7
Add verify_dual_type
willtebbutt 6dea624
test_frule_interface runs
willtebbutt a614846
Fix ReturnNode
willtebbutt eadae95
Correctness testing runs
willtebbutt 345b3fd
Add randn_dual
willtebbutt f58c394
Improve sin and cos frules
willtebbutt c8d8895
Performance tests run
willtebbutt 578e41b
Tidy up implementation
willtebbutt b5d34b2
Standard testing infrastructure
willtebbutt 205e716
Fix typos
willtebbutt d328db0
Fix return node to return dual
gdalle 66a48c8
Handle PiNode
gdalle e455cf6
Deleted line
gdalle 8d120b2
Case 7 solved
gdalle cd7167f
Resolve merge conflict
willtebbutt c5ffae7
Fix precompile issue
willtebbutt 94aa904
Fix isa rule
willtebbutt cc7a3fa
Fix is_primitive
willtebbutt 70d7183
More test cases
gdalle aec412e
progress
gdalle 0ea1084
fixes
gdalle d8a949f
Bump patch vesion
willtebbutt 79844d2
Fix terminators
willtebbutt 49aa4ca
Merge remote-tracking branch 'upstream/wct/fix-terminator-issue' into…
gdalle 9ce99ec
More cases
gdalle 6ce2488
More cases
gdalle 8954361
Merge remote-tracking branch 'upstream/main' into gd/forward
gdalle 941a2de
Merge remote-tracking branch 'upstream/main' into gd/forward
gdalle af49eac
Tuple rule
gdalle 0b4e5fa
Merge in main
willtebbutt 8204665
Formatting
willtebbutt 70fec10
Code to view forwards-mode IR from a signature
willtebbutt 6cde147
Use widenconst to get actual argtype from ircode argtypes
willtebbutt 0eabff0
MyInstruction -> new_instruction
willtebbutt 8b391c6
Formatting
willtebbutt 5d6b826
Merge branch 'main' into gd/forward
willtebbutt a919a28
Various improvements
willtebbutt 2808a12
Rules for foreigncalls
willtebbutt cb28759
Fix pointer tests with forwards mode
willtebbutt f9d1697
Enable more tests
willtebbutt 9bc53cc
All derivation tests pass
willtebbutt d6fc35d
Initial pass over legacy array functionality
willtebbutt 6b2409c
Fix tangent usage in tests
willtebbutt d6974c1
Rules for nice BLAS functions
willtebbutt fbcc6ce
Tweak test inputs slightly
willtebbutt 732762b
Enable CI for BLAS and foreigncalls
willtebbutt fd48f02
Enable linear_algebra rules
willtebbutt f6bc752
More stuff works
willtebbutt a96611e
Make IdDict work
willtebbutt 44e78b4
Code to identify SSA uses
willtebbutt a504413
Fix failing test via special case
willtebbutt f68c79b
Remove outdated TODO note
willtebbutt 05cbb83
Merge branch 'main' into gd/forward
willtebbutt 30c5294
Fix typo
willtebbutt fe4ec4a
BLAS support nearly finished
willtebbutt f771f70
All BLAS rules passing
willtebbutt 86fa1b6
Initial work on getrf
willtebbutt 04ea669
Merge branch 'main' into gd/forward
willtebbutt e1a1260
getrf frule sketch
willtebbutt fda2ab9
Merge branch 'gd/forward' of https://github.com/gdalle/Mooncake.jl in…
willtebbutt 37baaf0
Improve getrf performance
willtebbutt c0c4167
trtrs implementation + type stability checks
willtebbutt 9a12b23
Type stability checks for BLAS rules
willtebbutt bb8feba
Note Seth's blog
willtebbutt 64d6176
getrs frule implementation
willtebbutt be57d7f
getri frule implementation
willtebbutt 2934409
potrs
willtebbutt fe289a0
Enable lapack CI
willtebbutt 39354bc
Fix pivoting
willtebbutt 8bcde33
Enable diff tests integration tests
willtebbutt 497c907
Only run extra CI on 1
willtebbutt e1dce38
More lapack fixes
willtebbutt 8739c6c
widenconst
willtebbutt 899d4c4
Replace field access with method call
willtebbutt 594ba13
Catch __vec_to_tuple edge case
willtebbutt 0510235
Display more stuff when correctness test fails
willtebbutt 4af2276
Enable more integration tests
willtebbutt 83cd097
Make output on test error sensible
willtebbutt da3d7ee
Tidy up blas implementations
willtebbutt eee18dd
Fix pointerset error
willtebbutt 9bd274d
Merge branch 'main' into gd/forward
willtebbutt 3a4f70a
Fix ^ rule
willtebbutt 5aed9b2
Implement from_chain_rule macro
willtebbutt f4f62c9
Get SpecialFunctions extension working
willtebbutt 9c11e6a
Enable SpecialFunctions in CI
willtebbutt e19cb63
logexpfunctions
willtebbutt be93bfd
Run gpu jobs on 1.11 only
willtebbutt 1d1e7e9
Restrict FD step for forward mode
willtebbutt f21b575
Enable GP tests
willtebbutt c691a92
More integration testing
willtebbutt b28961a
bijectors
willtebbutt b67f2c3
Enable battery of tests
willtebbutt 2bdb0ad
Distributions integration testing
willtebbutt d4fa5c8
Enable DI CI
willtebbutt 4902ce2
Enable reverse-mode integration tests for Lux etc
willtebbutt 7f57a06
Enable 1.10
willtebbutt 60e4d89
Fix LAPACK on 1.10
willtebbutt 41bb3c3
Implement copytrito for 1.10
willtebbutt 2140edd
formatting
willtebbutt 05bac94
Merge branch 'main' into gd/forward
willtebbutt df0cf38
Tidying up
willtebbutt dac008f
Remove type piracy
willtebbutt 48b61ec
Initial forwards-mode timings
willtebbutt 3d9f9bf
Merge in main
willtebbutt 05d3c65
Constrain JuliaInterpreter
willtebbutt df0d2d7
Basic MistyClosure support
willtebbutt ed912eb
Merge in main
willtebbutt b9c5f7e
Do not use MistyClosure internals inside reverse-mode
willtebbutt 6990348
Forwards-over-reverse mwe
willtebbutt 941e171
Remove overly strict performance check
willtebbutt 180b43e
Docstring and improved field naming
willtebbutt 2bbf98d
Separate forward-mode and reverse-mode primitives
willtebbutt f9151ed
Fix docs and rrule creation
willtebbutt 2d52a2c
Fix low_level_maths
willtebbutt dd023e7
Fix SpecialFunctions tests cases
willtebbutt 31b1733
Fix more testing
willtebbutt bfa2476
Fix formatting
willtebbutt 27cd7c1
Make symbols available in tests
willtebbutt 8079137
Fix GP test suite
willtebbutt f37626f
Fix SpecialFunctions test suite
willtebbutt 2df8d36
Merge branch 'main' into gd/forward
willtebbutt 2275845
Fix performance
willtebbutt 720e410
Fix array tests
willtebbutt 0d16652
Fix formatting
willtebbutt 3aaac95
Fix forward-mode benchmarking
willtebbutt 75f8a76
Fix benchmarking
willtebbutt ca2e32c
forward mode interface
willtebbutt 9180940
Merge in main
willtebbutt f5b1e0e
Add frule for eps
willtebbutt c918f4c
Merge in main
willtebbutt bb4d4f6
Merge in main
willtebbutt ae7d8e7
Remove redundant ignore
willtebbutt 0413507
Rename from_chain_rule macro to from_chainrules
willtebbutt f7ea48d
Finish renaming chainrules macro
willtebbutt aff7f22
Improve docstring for value_and_derivative
willtebbutt ef1d4f7
DRY out global interpreter cache
willtebbutt 92370d2
Fix typo in docstring
willtebbutt 274b804
Doctests for is_primitive macro
willtebbutt b1263cf
Tidying up
willtebbutt fecea5f
Fix typo in bijectors
willtebbutt 33ab403
Fix test_rule call
willtebbutt ef9dd72
Fix formatting
willtebbutt e580bbf
Fix dispatch doctor in forward mode
willtebbutt a0bab14
Fix import
willtebbutt c6c376b
Fix doctests
willtebbutt a46cae5
Fix BLAS tests
willtebbutt 254eeae
Fix DispatchDoctor tests
willtebbutt 45e322d
Fix broken tests
willtebbutt c602978
Include the mode in testset string
willtebbutt d95e389
Support try-catch statements
willtebbutt 9c904be
Fix on LTS
willtebbutt 042ff36
Support enter expression
willtebbutt 7b1adbe
Formatting
willtebbutt a0ca9bf
Enable FunctionWrappers
willtebbutt e4f816a
Enable GPU CI on LTS
willtebbutt c804438
Enable function wrappers in CI
willtebbutt f45068a
Bump patch version and create HISTORY
willtebbutt e9f8599
Fix typo in prepare_derivative_cache docstring
willtebbutt 136984b
Note new components of public interface
willtebbutt ab7dc2b
Add docstring to Dual
willtebbutt 60fb2af
Add value_and_derivative and preparation function to exports / public…
willtebbutt e407c2f
Merge in main
willtebbutt 9a5fc0f
Improve interface docstring
willtebbutt c76c21c
Remove comment about which we have an open issue
willtebbutt d9001ed
Typo
willtebbutt f4dc6f9
Improve documentation
willtebbutt a26661b
Rename const_dual to make clear that it mutates
willtebbutt 1af8093
Clarify use of insert_node
willtebbutt 24a088b
Improve docstring
willtebbutt 2bd3e9c
Tie todo note to github issue
willtebbutt 50d4a30
Apply suggestions from code review
willtebbutt b706703
Merge branch 'gd/forward' of https://github.com/gdalle/Mooncake.jl in…
willtebbutt b7d1116
Make use of inc_args for PiNode in reverse mode
willtebbutt acc4b9e
Nospecialise on rules and remove redundant comment
willtebbutt 3cb238d
More avoidance of specialisation
willtebbutt fc6e668
Remove errant nospecialize and directly test rule caching
willtebbutt fa37327
Add not deepcopying behaviour in test
willtebbutt d57c184
Improve zero_derivative implementation
willtebbutt 61c9c54
Tidy up zero_adjoint and add deprecated file
willtebbutt 709ce39
Merge in main
willtebbutt 4e00aef
Rename some files
willtebbutt 8c0569d
Fix caching test bug
willtebbutt 6226bb8
Fix avoiding non diff code
willtebbutt d125324
Tidy up from_chainrules
willtebbutt d2d4fad
Merge branch 'main' into gd/forward
willtebbutt ca08ecd
Update HISTORY
willtebbutt 0512f17
Update history
willtebbutt 4c3f54d
Test interface kwargs
willtebbutt 5ec27db
Refine forward-over-reverse test
willtebbutt 36fb2a3
Include MistyClosures in CI
willtebbutt b8f4798
Remove incorrect test
willtebbutt ec8c7eb
Ensure that rrule for MistyClosure errors loudly
willtebbutt ba81ae6
Formatting
willtebbutt 3259e83
Fix flux integration tests
willtebbutt 1e1c227
Formatting
willtebbutt fe5a1c7
Fix mode access
willtebbutt 3548c25
Remove unnecessary ReverseMode import
willtebbutt 0d6b388
Fix macro bug
willtebbutt fa1fe13
Formatting
willtebbutt 96f0397
Merge branch 'main' into gd/forward
willtebbutt f1b4c25
Update misty closure set_to_zero implementation
willtebbutt 7623d1d
Update Project.toml
yebai aa55284
Merge branch 'main' into gd/forward
yebai 43a3fe7
Merge branch 'main' into gd/forward
yebai be0e9dd
typofix
yebai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # 0.4.143 | ||
|
|
||
| ## Public Interface | ||
| - Mooncake offers forward mode AD. | ||
| - Two new functions added to the public interface: `prepare_derivative_cache` and `value_and_derivative!!`. | ||
| - One new type added to the public interface: `Dual`. | ||
|
|
||
| ## Internals | ||
| - `get_interpreter` was previously a zero-arg function. Is now a unary function, called with a "mode" argument: `get_interpreter(ForwardMode)`, `get_interpreter(ReverseMode)`. | ||
| - `@zero_derivative` should now be preferred to `@zero_adjoint`. `@zero_adjoint` will be removed in 0.5. | ||
| - `@from_chainrules` should now be preferred to `@from_rrule`. `@from_rrule` will be removed in 0.5. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's amazing work, though it's not clear how one can use it? I assume that ADTypes / DifferentiationInterface support will take a bit of time to arrive, but in the meantime do I just replace
value_and_gradient!!withvalue_and_derivative!!?And congratulations to all involved! 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DI support landing today
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JuliaDiff/DifferentiationInterface.jl#813