Open Bug 1935630 Opened 2 months ago Updated 28 days ago

JIT hints can result in extra VM calls for Ion compilation

Categories

(Core :: JavaScript Engine: JIT, task, P2)

task

Tracking

()

ASSIGNED

People

(Reporter: jandem, Assigned: jandem)

References

(Blocks 1 open bug)

Details

(Whiteboard: [sp3])

The list in bug 1935626 has both IonCompileScriptForBaselineOSR and IonCompileScriptForBaselineAtEntry in the top 9 of VMFunction calls.

I looked into this a little for IonCompileScriptForBaselineAtEntry and I think what often happens is this:

  1. Baseline code bakes in an Ion compilation threshold, for example 500.
  2. JIT hints can increase the threshold for this script later, let's say to 1000.
  3. If the count is between 500 and 1000, Baseline code will still call into C++ to attempt a compilation, but there we check against the new threshold and decide to not compile yet.

The opposite case likely also happens where we could compile earlier according to the JIT hint, but we still use the higher threshold we baked in.

Potential fixes: (1) rely on the Baseline JIT check more (and don't check in C++ again) or (2) store the 'base threshold' for Ion in the ICScript next to the warm-up count and use that everywhere.

One idea I've been thinking about for a while is to have warmup counters tick down to the next state transition (tiering up, trial inlining) instead of ticking up. This would let us adjust the threshold dynamically without having to recompile anything. For example, I think the current trialInliningInitialWarmUpCount hack would be simpler in a count-down system.

I've been thinking about it more recently because it might make offthread baseline compilation play nicer with trial inlining.

Counting down is an interesting idea and it would fix this too.

It's also a question of do we want JIT hints to take effect immediately? Because another option would be to delay adding the JIT hint to the JitScript destructor or something so that it only becomes visible when we warm-up again.

Severity: -- → N/A
Priority: -- → P2
Whiteboard: [sp3]
Assignee: nobody → jdemooij
Status: NEW → ASSIGNED

I tried to fix this and it looks promising for Sp3 but it regressed a few JetStream tests a lot. I tracked that down to an issue with the JIT hints heuristics but fixing that regresses other things...

I'll try a few different schemes to see what works.

You need to log in before you can comment on or make changes to this bug.