Skip to content

Support Interpreter in mixed-mode #6915

Closed
@marek-safar

Description

@marek-safar
Member

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:

  1. AOT compile assemblies with --aot=full,interp
  2. 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:

mixedcheck: mono mixed.exe
$(MINI_RUNTIME) --interp=jit=JitClass mixed.exe

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 oracle
    JIT + 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 oracle
    FullAOT+LLVM (BCL) + interp with default oracle

Activity

vargaz

vargaz commented on Apr 18, 2018

@vargaz
Contributor

This is now implemented, using full-aot+interpreter fallback, i.e. full-aot everything, then run
using mono --full-aot --interp.

lewurm

lewurm commented on Apr 18, 2018

@lewurm
Contributor

we should add a CI lane for it

luhenry

luhenry commented on Apr 18, 2018

@luhenry
Contributor

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

vargaz commented on Apr 18, 2018

@vargaz
Contributor

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

luhenry commented on Apr 18, 2018

@luhenry
Contributor

@vargaz if you only AOT the BCL (and not the test suite), do you think we would test enough of mixed-mode?

marek-safar

marek-safar commented on Apr 18, 2018

@marek-safar
MemberAuthor

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?

assigned and unassigned on Nov 2, 2018

2 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @lewurm@vargaz@marek-safar@luhenry

      Issue actions

        Support Interpreter in mixed-mode · Issue #6915 · mono/mono