Skip to content

JIT: consider running some optimizations in Tier0 #9120

@AndyAyersMS

Description

@AndyAyersMS

The goal of Tier0 is to jit code as quickly as possible. Currently this is done by having Tier0 enable the "minopts" mode in the jit, which disables all optimization. But there are good reasons to believe that running some optimizations in Tier0 can improve the speed of jitting.

To first order the time it takes to jit a method (especially when lightly optimizing) is proportional to the amount of code the jit produces for the method. So any cheap optimization that reduces the overall size of the generated code is a candidate for running in Tier0. Some ideas:

  • enable the importer branch folding
  • enable the early type opts that feed importer branch folding. Perhaps doubly relevant since R2R prejitting will leave generic code to the jit, so tier0 will see more generic instantations then "normal", and these are the method bodies that often can be greatly simplified by early type opts. These opts are also pretty cheap.
  • other kinds of simple expression tree simplifications -- maybe some parts of morph are cheap enough to enable?
  • avoid inline expansion of helpers. Tricky because while this helps jit time it slows down the jitted code -- but we hope not to run the Tier0 code very often, so it seems like it could pay off.
  • perhaps inline very small methods. I have some older and perhaps flawed data that indicates this should be TP win, but recent results haven't borne this out. But it is worth revisiting. Certainly, inlining small methods often reduces code size, and it should cut down on the number of jit invocations.

There are notes about this scattered about in other issues, Will track these down and link them back here.

category:throughput
theme:optimization
skill-level:expert
cost:medium

Metadata

Metadata

Assignees

No one assigned

    Labels

    JitThroughputCLR JIT issues regarding speed of JIT itselfarea-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions