-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Implement BBCode * Add IR optimisation functionality * Only use type of ctx in TInterp * Factor out ir lookup * Remove redundant invoke-to-call functionality * Remove redundant return node creation code * Improve comment * Import more things during testing * Initial work on statement-specific transformations * Include s2s files * Add more cases in statement translation * Remove tests associated to removed code * Fix docstring * Improve comment * Improve docstrings * Improve comments * Improve comment * Improve comment * Throw informative error message for PhiCNodes * Throw error for UpsilonNode * Disable tests for interpreter during development * Initial pass over call transformation * More work * Basics working * Fix tests * Print debug info * Print debug info * Ignore code coverage statements * Restrict to 1.10 * Fix CI and comment out IR inspection * Enable all tests * Improve performance result display * Make const work * Enable more tests * Tidy up throw_if_not_def * Fix up throw_undef_if_not * Improve throw_undef_if_not test * Add additional GlobalRef test * Improve BBCode documentation * Loosen perf tolerance on handwritten sum * Clean up register transformation * Remove redundant code * Tidy up formatting * More register tests * Tidy up output check * Use new tidier register functionality * Reactivate more tests * Unhandle feature exception and globalref typeof * Improve handling of GlobalRefs * Update literals and QuoteNodes to have stacks when differentiable * Handle PiNode in BBCode * Update register types * Add helper functionality to augmented register * Import ad_stmt_info in front_matter * Reactive more tests * Refactor registers and implement PiNode * Move inc_arg_numbers to utils and unit test * Move around include order * Refactor captures handling * Enable more tests and mostly fix PhiNode * Fix up phinode problem * Fix comment * Fix typos * Fix vector elementtype in bbcode * Make varargs + splatting work * Add ReverseDiff to test deps * Move to testing s2s * Fix some lingering bugs * Fix comment and disable bad test case * Use s2s in benchmarks * Helper functiong * Fix comment * Some minor improvements to shared data and compiler * Additional test case * Do not inline stack pushes and pops * Improve compile times * Fix bug * Fix union of registers bug * Readability improvements * Cache oc compilation * Strip code coverage lines * Ignore thing with inlining problem * Do not store input ref stacks if singleton type * Formatting * NoTangent for Tuples * NamedTuple NoTangent * Improve predecessor compute times * Stop printing * Inline tuple constructor * Ignore Base check_reducedims * Make _getter constant * Move tuple_map and extend it * Refine DerivedRule construction * Fix new for NoTangent result types * Fix new * Remove redundant commented lines * Add non-differentiable function to test utils * Add comments, tidy up, rename some things * Add non-differentiable const tester * Rename my_tangent_stack to ret_tangent_stack * Remove redundant line * Support non-constant global refs * Don't verify IR after passes * Support copyast * Use full benchmarking * Tidy up some abstract type edge cases * Align registers with OpaqueClosure type inference * Tidy up types * Inline stuff again * Safer implementation of ipiv * Make memory in Stack constant * Formatting and lgetfield tests * Formatting * lsetfield tests * Move TestResources import around * NoTangent for composites with NoTangent fields * GC preserve stuff * Add NoTangent path to ifelse rule * Enable multiple lines for reverse-pass * Construct arg tangent stack refs in function * Fix basic tests * Use fixed stacks * Exclude some rrules from DiffRules * Use inbounds * Add additional test and tighten performance req * Use fixed-location tangent stacks, and 32-bit block numbering * Display which benchmark is running * Fix typo * Fix low_level_rules tests * Fix caching * Functionality to reset global ID counter * Try not inlining block pushes * Improve bbcode documentation * Remove redundant code * Formatting * Formatting * Document unhandled_feature * Use type information in BBCode and update s2s to reflect this * Fix PhiNode inference * Update PhiNode transform unit tests * Improve formatting of test_utils * Ignore local scratch file * Fix Turing hanging bug * Fix derived rule tester * Fix up testS * Use fixed tangent stack for PiNode * Tweak bounds for test utils * Fix Distributions deprecations * Revert PiNode fixed stack update * Try more stuff to fix getrf pullback * Fix test tolerances * Fix typo in comment * Revert attempted LAPACK fix * Restrict primal evals to 1 * Extend preservation to cover ccall * Make copy of ipiv after calculations are run * Improve tuple tangent_type * Inline getfield rules * Force uninit_codual to inline * Force-inline uninit_tangent * NoTangentStack for DataType * Revert change to tangent stack type * Avoid recompilation in dynamic dispatch * Tighten performance bounds * Tighten performance bounds on naive mat mul * Enable all Turing.jl tests * Remove redundant comment * Remove comment and add blank line * Formatting * Improve docstrings and comments in s2s * Remove interpreter timings from Turing integration tests * Remove redundant import in benchmarks * Move value_and_gradient to interface file * Remove redundant arg in benchmarking * Improve interface * Update README * Formatting * Improve README * Do not export increment_field
- Loading branch information
1 parent
26cc134
commit d3d32c0
Showing
41 changed files
with
2,737 additions
and
371 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -4,3 +4,4 @@ bench/Manifest.toml | |
analysis_results | ||
.vscode | ||
profile.pb.gz | ||
scratch.jl |
This file contains 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 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 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 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 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 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,60 @@ | ||
""" | ||
value_and_pullback!!(rule, ȳ, f::CoDual, x::CoDual...) | ||
In-place version of `value_and_pullback!!` in which the arguments have been wrapped in | ||
`CoDual`s. Note that any mutable data in `f` and `x` will be incremented in-place. As such, | ||
if calling this function multiple times with different values of `x`, should be careful to | ||
ensure that you zero-out the tangent fields of `x` each time. | ||
""" | ||
function value_and_pullback!!(rule::R, ȳ::T, fx::Vararg{CoDual, N}) where {R, N, T} | ||
out, pb!! = rule(fx...) | ||
@assert _typeof(tangent(out)) == T | ||
ty = increment!!(tangent(out), ȳ) | ||
return primal(out), pb!!(ty, map(tangent, fx)...) | ||
end | ||
|
||
""" | ||
value_and_gradient!!(rule, f::CoDual, x::CoDual...) | ||
Equivalent to `value_and_pullback(rule, 1.0, f, x...)` -- assumes `f` returns a `Float64`. | ||
""" | ||
function value_and_gradient!!(rule::R, fx::Vararg{CoDual, N}) where {R, N} | ||
return value_and_pullback!!(rule, 1.0, fx...) | ||
end | ||
|
||
""" | ||
value_and_pullback!!(rule, ȳ, f, x...) | ||
Compute the value and pullback of `f(x...)`. | ||
`rule` should be constructed using `build_rrule`. | ||
*Note:* If calling `value_and_pullback!!` multiple times for various values of `x`, you | ||
should use the same instance of `rule` each time. | ||
*Note:* It is your responsibility to ensure that there is no aliasing in `f` and `x`. | ||
For example, | ||
```julia | ||
X = randn(5, 5) | ||
rule = build_rrule(dot, X, X) | ||
value_and_pullback!!(rule, 1.0, dot, X, X) | ||
``` | ||
will yield the wrong result. | ||
*Note:* This method of `value_and_pullback!!` has to first call `zero_codual` on all of its | ||
arguments. This may cause some additional allocations. If this is a problem in your | ||
use-case, consider pre-allocating the `CoDual`s and calling the other method of this | ||
function. | ||
""" | ||
function value_and_pullback!!(rule::R, ȳ, fx::Vararg{Any, N}) where {R, N} | ||
return value_and_pullback!!(rule, ȳ, map(zero_codual, fx)...) | ||
end | ||
|
||
""" | ||
value_and_gradient!!(rule, f, x...) | ||
Equivalent to `value_and_pullback(rule, 1.0, f, x...)` -- assumes `f` returns a `Float64`. | ||
""" | ||
function value_and_gradient!!(rule::R, fx::Vararg{Any, N}) where {R, N} | ||
return value_and_gradient!!(rule, map(zero_codual, fx)...) | ||
end |
Oops, something went wrong.