Skip to content

[Perf] Windows/x64: 1 Regression on 8/26/2025 4:33:14 PM +00:00 #119277

Closed

Description

@performanceautofiler

Run Information

Name Value
Architecture x64
OS Windows 10.0.22631
Queue ViperWindows
Baseline 093a246396e28cb5e908ebe11aa3f6ea1170a0d7
Compare 3633dace5e4d7a30ede323fc60a45ced4e1c4270
Diff Diff
Configs CompilationMode:tiered, RunKind:micro

Regressions in SeekUnroll

Benchmark Baseline Test Test/Base Test Quality Edge Detector Baseline IR Compare IR IR Ratio
1.36 secs 1.50 secs 1.11 0.01 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
py .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'SeekUnroll*'
Details

SeekUnroll.Test(boxedIndex: 11)

ETL Files

Histogram

JIT Disasms

Docs

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

Activity

  1. added
    runtime-coreclr
    untriaged
    on Sep 2, 2025
  2. added
    tenet-performance
    tenet-performance-benchmarks
    on Sep 2, 2025
  3. added
    needs-area-label
    on Sep 2, 2025
  4. DrewScoggins commented on Sep 2, 2025

    @DrewScoggins
    Member

    Related to #118990

  5. DrewScoggins commented on Sep 2, 2025

    @DrewScoggins
    Member

    This change was backported, so if we make a fix we need to make sure that it is also backported.

  6. added
    area-CodeGen-coreclr
    on Sep 3, 2025
  7. dotnet-policy-service commented on Sep 3, 2025

    @dotnet-policy-service
    Contributor

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

  8. removed
    untriaged
    needs-area-label
    on Sep 4, 2025
  9. added this to the 10.0.0 milestone on Sep 4, 2025
  10. jakobbotsch commented on Sep 9, 2025

    @jakobbotsch
    Member

    My results when comparing 5efdfd0 to 61b5219:

    BenchmarkDotNet v0.14.1-nightly.20240924.187, Windows 10 (10.0.19045.6216/22H2/2022Update)
    AMD Ryzen 9 5950X 3.40GHz, 1 CPU, 32 logical and 16 physical cores
    .NET SDK 9.0.109
    [Host] : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2
    Job-VNNUQH : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX2
    Job-QIOBHF : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX2

    OutlierMode=DontRemove PowerPlanMode=00000000-0000-0000-0000-000000000000 IterationTime=250ms
    MaxIterationCount=20 MemoryRandomization=True MinIterationCount=15
    WarmupCount=1

    Method Job Toolchain boxedIndex Mean Error StdDev Median Min Max Ratio RatioSD Allocated Alloc Ratio
    SeekUnroll Job-VNNUQH \Core_Root\corerun.exe 11 1.117 s 0.0226 s 0.0261 s 1.113 s 1.085 s 1.172 s 0.95 0.07 456 B 1.00
    SeekUnroll Job-QIOBHF \Core_Root_base\corerun.exe 11 1.187 s 0.0868 s 0.0999 s 1.173 s 1.083 s 1.399 s 1.01 0.11 456 B 1.00
  11. jakobbotsch commented on Sep 9, 2025

    @jakobbotsch
    Member

    There is an extra zero extension in the diff: https://www.diffchecker.com/ITu3PwJu/

    That's expected from the bugfix in #118990.

    More importantly is that 1) we measure OSR code in this benchmark, and 2) we would expect this loop to be unrolled.

    2 is the most important, as we would not expect to even require any indexing with unknown index here (which would make the bugfix zero diff). From looking at the graph, I suspect it regressed earlier this year and that the regression is already being tracked by #116754.

  12. jakobbotsch commented on Sep 9, 2025

    @jakobbotsch
    Member

    The loop shape of the linked loop above is ambiguous. Instead of the loop being detected as

            var i = 0;
            for (; i < Vector<long>.Count; i++)
            {
                longValue = vector64[i];
                if (longValue == 0) continue;
                break;
            }

    we end up with a loop shape that is recognized as

            var i = 0;
            while (true)
            {
                longValue = vector64[i];
                if (longValue != 0) break;
                i++;
                if (i >= Vector<long>.Count)
                    break;
            }

    Here the header ends up being the block that has the longValue store and compare, and graph based loop inversion duplicates that condition outside the loop. In the end we are left with a shape that is not detected as a candidate for loop unrolling.

    My guess is that old lexical loop inversion did not invert here and thus loop unrolling was able to recognize an unrollable loop.

    It might be the case that graph inversion should be enhanced to realize in the above case that inversion may not benefit us since the loop is already amenable to be bottom-tested. The loop inversion here just results in a different condition being able to be bottom tested. But I would be weary to make a change like that at this point.

    Any thoughts @AndyAyersMS?

  13. jakobbotsch commented on Sep 9, 2025

    @jakobbotsch
    Member

    It might also be possible to teach loop unrolling to recognize it as an unrollable loop, even after the inversion happens based on the longValue IR. I think the problem is that loop unrolling just does not find the i = 0 initialization after we duplicate the longValue IR in front of the loop.

  14. AndyAyersMS commented on Sep 9, 2025

    @AndyAyersMS
    Member

    I know Aman was looking at ways for inversion / cloning / unrolling to be more synergistic, but I don't know if we have any great ideas on exactly how to pull this off.

    Any change here is likely too risky for .NET 10.

    For some multi-exit loops perhaps there's some notion of a preferred "last" exit? I think we would prefer an IV related update/exit over something else, so that we're not left with loop-live code that runs after the primary IV gets updated.

    Abstractly it would be nice if the loop opts relied on SSA instead of their current heuristic-based searches for induction variable detection (and maybe invariance information). Not sure how much work that would be. Maybe even something like loop closed SSA?

  15. jakobbotsch commented on Sep 11, 2025

    @jakobbotsch
    Member

    I do not think we will fix this in .NET 10.

  16. modified the milestones: 10.0.0, 11.0.0 on Sep 11, 2025
  17. locked and limited conversation to collaborators on Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

arch-x64area-CodeGen-coreclros-windowsruntime-coreclrtenet-performancetenet-performance-benchmarks

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions