Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic PGO startup improvements in NET 8 #76969

Closed
18 of 23 tasks
EgorBo opened this issue Oct 12, 2022 · 4 comments
Closed
18 of 23 tasks

Dynamic PGO startup improvements in NET 8 #76969

EgorBo opened this issue Oct 12, 2022 · 4 comments
Assignees
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI User Story A single user-facing feature. Can be grouped under an epic.
Milestone

Comments

@EgorBo
Copy link
Member

EgorBo commented Oct 12, 2022

Meta issue to track improvements around startup for Dynamic PGO (Non-PGO might also benefit from some of these), I assume it makes sense to track them separately from the general "Dynamic PGO Improvements" issue to leave that for general/CQ improvements.

Planned for .NET 8

Planned for Jan-Mar'23

Under consideration

@EgorBo EgorBo added this to the 8.0.0 milestone Oct 12, 2022
@EgorBo EgorBo self-assigned this Oct 12, 2022
@dotnet-issue-labeler

This comment was marked as off-topic.

@EgorBo EgorBo added area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI User Story A single user-facing feature. Can be grouped under an epic. labels Oct 12, 2022
@ghost
Copy link

ghost commented Oct 12, 2022

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Issue Details

Meta issue to track improvements around startup for Dynamic PGO (Non-PGO might also benefit from some of these), I assume it makes sense to track them separately from the general "Dynamic PGO Improvements" issue to leave that for general/CQ improvements.

Planned for .NET 8

  • Allow some optimizations in Tier0 which result in TP improvements: enable simple intrinsic expansion in Tier0, enable optimizations which might help to reduce number of class probes we emit during instrumentation

  • Fix issues in optimized + instrumented code, enable edge profiling

  • Instrument only hot Tier0 and R2R code PGO: Add new tiers #70941
    Pros:

    • We don't waste time/memory on instrumentation for methods which will never be promoted (a general rule that 75% of methods never make it to Tier1)
    • We no longer give up on R2R code and it also benefits from Dynamic PGO - this resulted in nice wins for TE benchmarks

    Cons:

    • Increased working set: as it turns out it's not really an issue. Even for a huge BingSNR service Tier1 contributes 10Mb (+stubs) to the working set which is ~8Gb
    • Increased number of methods waiting in the promotion queue (see below)
  • Prioritize methods in the promotion queue. We recently found out that Dynamic PGO suffers a lot if hot methods with loops aren't placed on top of the queue for quicker promotion so such methods stuck in tier0 with slow class probes inside loops for too long - here is a good example: Optimize CheckSample #76520 (comment)

    • Give methods with loops higher priority
    • Give super small methods and R2R lower priority
    • Keep counting calls after they reach 30 to rely on that for priority - Optimize CheckSample #76520 (comment)
  • Inline tiny methods in Tier0 too to avoid redundant compilations for simple/auto properties and don't occupy a seat in the promotion queue. A fairly simple prototype for this reduced number of jitted functions from 250k to 200k for BingSNR. We can start from allowing inlining for empty or return CNS kinds of methods.

Under consideration

Author: EgorBo
Assignees: EgorBo
Labels:

area-CodeGen-coreclr, User Story

Milestone: 8.0.0

@EgorBo
Copy link
Member Author

EgorBo commented Feb 12, 2023

Current state:

image

Json benchmark seems pretty good while Platform-plaintext suffers a lot from instrumentation (10x slower)

@EgorBo
Copy link
Member Author

EgorBo commented Jun 9, 2023

We've finished the work we planned to do for .NET 8.0 here, the rest is the "best effort"

@EgorBo EgorBo closed this as completed Jun 9, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Jul 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI User Story A single user-facing feature. Can be grouped under an epic.
Projects
Archived in project
Development

No branches or pull requests

1 participant