Description
General
By mixed mode we mean that some oracle can decide if a method should be executed by the JIT (/AOT runtime) or interpreter. The default oracle is: If a method is available as AOT'd method, execute this, otherwise fall back to the interpreter. Example: On iOS we cannot JIT, therefore we have FullAOT. It can't handle System.Reflection.Emit
(SRE) though, so those methods will be executed by the interpreter.
Oracles
AOT Oracle
The current supported mode works like this:
- AOT compile assemblies with
--aot=full,interp
- execute runtime with
--full-aot --interp
Currently, this isn't tested very well.
Hardcoded Oracle
We can force the interpreter with --interp=interp-only=SomeClassName
for a specific class, or force the JIT with --interp=jit=SomeClassName
the other way around. This is used by the mixed mode regression test:
Lines 770 to 771 in 42dd7d3
We should extend this mode so that we can for example specify namespaces.
Hash Oracle
In order to stress test the mixed mode transitions, we should have a mode that decides seemingly randomly, but in a deterministic fashion. This can be achieved by using a hash-function for a method and a seed, for example:
gboolean use_interp = (hash(method) ^ seed) / (double)INT_MAX > 0.5
Plan for testing
- JIT (BCL) + interp with extended hardcoded oracleJIT + interp with hash oracle. Not sure yet if this will be suitable for CI, but definitely useful for stress testing locally.FullAOT (BCL) + interp with with default oracleFullAOT+LLVM (BCL) + interp with default oracle
Activity
vargaz commentedon Apr 18, 2018
This is now implemented, using full-aot+interpreter fallback, i.e. full-aot everything, then run
using mono --full-aot --interp.
lewurm commentedon Apr 18, 2018
we should add a CI lane for it
luhenry commentedon Apr 18, 2018
How has it been tested locally? How should we test it? fullAOT the net_4_x BCL and run the BCL test suite with
--full-aot --interpreter
?vargaz commentedon Apr 18, 2018
Since the interpreter is only a fallback, its not very easy to test in general, since all methods are already aot-ed. I tested it by running mixed.exe with:
--full-aot --interp=interp-only=InterpClass mixed.exe
luhenry commentedon Apr 18, 2018
@vargaz if you only AOT the BCL (and not the test suite), do you think we would test enough of mixed-mode?
marek-safar commentedon Apr 18, 2018
I don't see a reason for a new CI line. This can be easily tested on interpreter lane.
@vargaz could you write an explicit test for this. For example, using cil-string or SRE?
2 remaining items