https://github.com/JuliaLang/julia
Revision cf82c19fb4351d6d0848fd2dba05edc39503e35c authored by Keno Fischer on 11 August 2020, 01:42:48 UTC, committed by GitHub on 11 August 2020, 01:42:48 UTC
In #36508 we decided after some consideration not to add the `stmtinfo`
to the `CodeInfo` object, since this info would never be used for
codegen. However, this also means that external AbstractInterpreters
that would like to cache pre-optimization results cannot simply cache
the unoptimized `CodeInfo` and then later feed it into the optimizer.
Instead they would need to cache the whole OptimizationState object,
or maybe convert to IRCode before caching. However, at the moment
we eagerly drop the `OptimizationState` wrapper as soon was we
decide not to run the optimizer. This refactors things to keep
the OptimizationState around for unoptimized methods, only dropping
it right before caching, in a way that can be overriden by
an external AbstractInterpreter.

We run into the inverse problem during costant propagation where
inference would like to peek at the results of optimization in
order to decide whether constant propagation is likely to be
profitable. Of course, if optimization hasn't actually run yet
for this AbstractInterpreter, this doesn't work. Factor out
this logic such that an external interpreter can override this
heuristic. E.g. for my AD interpreter, I'm thinking just looking
at the vanilla function and checking its complexity would be
a good heuristic (since the AD'd version is supposed to give
the same result as the vanilla function, modulo capturing
some additional state for the reverse pass).
1 parent b2cee8a
History
Tip revision: cf82c19fb4351d6d0848fd2dba05edc39503e35c authored by Keno Fischer on 11 August 2020, 01:42:48 UTC
Refactor OptimizationState lifetime (#36700)
Tip revision: cf82c19
File Mode Size
.devcontainer
base
contrib
deps
doc
etc
src
stdlib
test
ui
.appveyor.yml -rw-r--r-- 2.1 KB
.clang-format -rw-r--r-- 3.3 KB
.gitattributes -rw-r--r-- 65 bytes
.gitignore -rw-r--r-- 273 bytes
.mailmap -rw-r--r-- 11.0 KB
.travis.yml -rw-r--r-- 6.1 KB
CITATION.bib -rw-r--r-- 2.6 KB
CONTRIBUTING.md -rw-r--r-- 19.9 KB
HISTORY.md -rw-r--r-- 292.0 KB
LICENSE.md -rw-r--r-- 5.0 KB
Make.inc -rw-r--r-- 44.6 KB
Makefile -rw-r--r-- 26.5 KB
NEWS.md -rw-r--r-- 7.0 KB
README.md -rw-r--r-- 6.5 KB
VERSION -rw-r--r-- 10 bytes
sysimage.mk -rw-r--r-- 3.9 KB

README.md

back to top