Skip to content

[Perf] Linux/x64: Benchstone.BenchF.SqMtx Regression on 2/9/2025 2:06:49 AM +00:00 #112429

Closed

Description

@performanceautofiler

Run Information

Name Value
Architecture x64
OS ubuntu 22.04
Queue ViperUbuntu
Baseline 497236a2359f9de4b70b1dbd00e55449823e6f63
Compare 34ec4f5f0bf2b67764db8a6413ba9975c41bc35a
Diff Diff
Configs CompilationMode:tiered, RunKind:micro

Regressions in Benchstone.BenchF.SqMtx

Benchmark Baseline Test Test/Base Test Quality Edge Detector Baseline IR Compare IR IR Ratio
701.80 ms 746.02 ms 1.06 0.00 False

graph
Test Report

Repro

General Docs link: https://github.com/dotnet/performance/blob/main/docs/benchmarking-workflow-dotnet-runtime.md

git clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'Benchstone.BenchF.SqMtx*'
Details

Benchstone.BenchF.SqMtx.Test

ETL Files

Histogram

JIT Disasms

Docs

Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository

Activity

  1. added
    os-linux
    runtime-coreclr
    untriaged
    on Feb 11, 2025
  2. LoopedBard3 commented on Feb 11, 2025

    @LoopedBard3
    Member
  3. ghost added
    needs-area-label
    on Feb 11, 2025
  4. added
    tenet-performance
    tenet-performance-benchmarks
    and removed
    os-linux
    untriaged
    runtime-coreclr
    needs-area-label
    on Feb 11, 2025
  5. added
    untriaged
    on Feb 11, 2025
  6. 2 remaining items

  7. self-assigned this
    on Feb 12, 2025
  8. removed
    untriaged
    on Feb 12, 2025
  9. added this to the 10.0.0 milestone on Feb 12, 2025
  10. AndyAyersMS commented on Feb 12, 2025

    @AndyAyersMS
    Member

    Dug in a little... I don't have a strong local repro

    Method Job Toolchain Mean Error StdDev Median Min Max Ratio RatioSD Allocated Alloc Ratio
    SqMtx Job-KYPGTL base 452.9 ms 8.82 ms 8.25 ms 451.2 ms 439.8 ms 472.1 ms 1.00 0.02 29.27 KB 1.00
    SqMtx Job-UXQRRM diff 468.5 ms 18.44 ms 21.24 ms 460.1 ms 441.9 ms 515.0 ms 1.03 0.05 29.27 KB 1.00

    ADX however shows an across the board jump up

    Image

    Profiling shows this is almost entirely measuring OSR methods:

    64.70%   6.471E+07   OSR      [MicroBenchmarks]SqMtx.Test()
    30.37%   3.037E+07   OSR      [MicroBenchmarks]SqMtx.Test()
    03.94%   3.94E+06    Tier-1   [MicroBenchmarks]SqMtx.Inner(float64[][],float64[][],int32)
    
  11. AndyAyersMS commented on Feb 12, 2025

    @AndyAyersMS
    Member

    From the disasm summary:

     102: JIT compiled Benchstone.BenchF.SqMtx:.ctor():this [Tier0, IL size=7, code size=31, hash=0x785c3d60]
     827: JIT compiled Benchstone.BenchF.SqMtx:Test():ubyte:this [Instrumented Tier0, IL size=100, code size=491, hash=0x8629e617]
     828: JIT compiled Benchstone.BenchF.SqMtx:AllocArray[double](int,int):double[][] [Instrumented Tier0, IL size=30, code size=212, hash=0x825045bc]
     829: JIT compiled Benchstone.BenchF.SqMtx:Inner(double[][],double[][],int) [Instrumented Tier0, IL size=73, code size=574, hash=0x6cacb5f5]
     830: JIT compiled Benchstone.BenchF.SqMtx:Inner(double[][],double[][],int) [Tier1-OSR @0x34 with Dynamic PGO, IL size=73, code size=331, hash=0x6cacb5f5]
     831: JIT compiled Benchstone.BenchF.SqMtx:Inner(double[][],double[][],int) [Instrumented Tier0, IL size=73, code size=574, hash=0x6cacb5f5]
     832: JIT compiled Benchstone.BenchF.SqMtx:Inner(double[][],double[][],int) [Tier1-OSR @0x34 with Dynamic PGO, IL size=73, code size=331, hash=0x6cacb5f5]
     833: JIT compiled Benchstone.BenchF.SqMtx:Inner(double[][],double[][],int) [Tier1 with Dynamic PGO, IL size=73, code size=720, hash=0x6cacb5f5]
     890: JIT compiled Benchstone.BenchF.SqMtx:Test():ubyte:this [Tier1-OSR @0x48 with Dynamic PGO, IL size=100, code size=888, hash=0x8629e617]
    1020: JIT compiled Benchstone.BenchF.SqMtx:Test():ubyte:this [Tier1-OSR @0x29 with Dynamic PGO, IL size=100, code size=936, hash=0x8629e617]
    1121: JIT compiled Benchstone.BenchF.SqMtx:AllocArray[double](int,int):double[][] [Instrumented Tier0, IL size=30, code size=211, hash=0x825045bc]
    

    Interesting that we get two different OSR methods for Inner at the same IL offset. Suspect this may be that one comes from the Tier0 method and another from the Tier0+instr method. Current OSR identification uses the call site return address so these are considered different and so we get two possibly identical OSR variants. While this may seem wasteful the two inspiring methods may have different frame layouts and different callee-saves so even though they both hit the same patchpoint, it's not clear in general we could have them both invoke the same OSR method.

    At any rate we then get two different OSR variants for Test, and those are the two prominent methods in the profile, and they have diffs.

  12. added
    area-CodeGen-coreclr
    on Feb 12, 2025
  13. dotnet-policy-service commented on Feb 12, 2025

    @dotnet-policy-service
    Contributor

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

  14. AndyAyersMS commented on Feb 12, 2025

    @AndyAyersMS
    Member

    I thought this was going to be about using checked write barriers in OSR methods that promote gc ref containing types to the stack (since we are not sure if the code will reference the OSR stack version or the Tier-0 heap version of that allocation), but that's not the case (at least in my repros).

    Code layout differs quite a bit between my base and diff, so I am going to build a closer matching set of compilers and retry.

  15. AndyAyersMS commented on Feb 12, 2025

    @AndyAyersMS
    Member

    Looks like one (perhaps the only) issue is that the change to ParseArrayAddressWorker in #104906 in doesn't always work for OSR because we may never see the newarr.

    Hence VN doesn't understand array accesses with TYP_BYREF bases and we get slightly worse code:

    Image

  16. added a commit that references this issue on Feb 13, 2025
    ed24412
  17. added
    in-pr
    on Feb 13, 2025
  18. added a commit that references this issue on Feb 13, 2025
    abe6b9e
  19. locked and limited conversation to collaborators on Mar 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclrin-prtenet-performancetenet-performance-benchmarks

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions