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

[Perf] Linux/x64: System.Text.Tests Regressions on 11/27/2024 1:41:48 AM #110413

Open
performanceautofiler bot opened this issue Dec 3, 2024 · 13 comments
Open
Assignees
Labels
arch-x64 area-System.Runtime.Intrinsics os-linux Linux OS (any supported distro) runtime-coreclr specific to the CoreCLR runtime tenet-performance Performance related issue tenet-performance-benchmarks Issue from performance benchmark untriaged New issue has not been triaged by the area owner

Comments

@performanceautofiler
Copy link

Run Information

Name Value
Architecture x64
OS ubuntu 22.04
Queue TigerUbuntu
Baseline abee17762558f6b4435163fe192c92b9caefde40
Compare fe3d5b5f7039e9f38f022dac77aeb6f01025b19d
Diff Diff
Configs CompilationMode:tiered, RunKind:micro

Regressions in System.Text.Tests.Perf_Encoding

Benchmark Baseline Test Test/Base Test Quality Edge Detector Baseline IR Compare IR IR Ratio
65.88 ns 76.70 ns 1.16 0.12 False
17.59 ns 29.50 ns 1.68 0.53 False

graph
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 'System.Text.Tests.Perf_Encoding*'

System.Text.Tests.Perf_Encoding.GetBytes(size: 512, encName: "utf-8")

ETL Files

Histogram

JIT Disasms

System.Text.Tests.Perf_Encoding.GetByteCount(size: 512, encName: "utf-8")

ETL Files

Histogram

JIT Disasms

Docs

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


Run Information

Name Value
Architecture x64
OS ubuntu 22.04
Queue TigerUbuntu
Baseline abee17762558f6b4435163fe192c92b9caefde40
Compare fe3d5b5f7039e9f38f022dac77aeb6f01025b19d
Diff Diff
Configs CompilationMode:tiered, RunKind:micro

Regressions in System.IO.Tests.BinaryWriterExtendedTests

Benchmark Baseline Test Test/Base Test Quality Edge Detector Baseline IR Compare IR IR Ratio
149.09 μs 177.99 μs 1.19 0.50 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 'System.IO.Tests.BinaryWriterExtendedTests*'

System.IO.Tests.BinaryWriterExtendedTests.WriteAsciiString(StringLengthInChars: 2000000)

ETL Files

Histogram

JIT Disasms

Docs

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


Run Information

Name Value
Architecture x64
OS ubuntu 22.04
Queue TigerUbuntu
Baseline abee17762558f6b4435163fe192c92b9caefde40
Compare fe3d5b5f7039e9f38f022dac77aeb6f01025b19d
Diff Diff
Configs CompilationMode:tiered, RunKind:micro

Regressions in System.Text.Perf_Utf8Encoding

Benchmark Baseline Test Test/Base Test Quality Edge Detector Baseline IR Compare IR IR Ratio
5.00 μs 7.17 μs 1.44 0.46 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 'System.Text.Perf_Utf8Encoding*'

System.Text.Perf_Utf8Encoding.GetByteCount(Input: EnglishAllAscii)

ETL Files

Histogram

JIT Disasms

Docs

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

@performanceautofiler performanceautofiler bot added arch-x64 os-linux Linux OS (any supported distro) runtime-coreclr specific to the CoreCLR runtime untriaged New issue has not been triaged by the area owner labels Dec 3, 2024
@LoopedBard3 LoopedBard3 transferred this issue from dotnet/perf-autofiling-issues Dec 4, 2024
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Dec 4, 2024
@LoopedBard3 LoopedBard3 changed the title [Perf] Linux/x64: 4 Regressions on 11/27/2024 1:41:48 AM [Perf] Linux/x64: System.Text.Tests Regressions on 11/27/2024 1:41:48 AM Dec 4, 2024
@LoopedBard3 LoopedBard3 added tenet-performance Performance related issue tenet-performance-benchmarks Issue from performance benchmark labels Dec 4, 2024
@LoopedBard3
Copy link
Member

Due to #104488, FYI @tannergooding. Change seems purposeful, maybe this is acceptable?

Commit range: d58ffd1...cf7a744

Related Regressions:
Windows x64:

@vcsjones vcsjones added area-System.Runtime.Intrinsics and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Dec 5, 2024
@jeffhandley
Copy link
Member

Assigned to @PranavSenthilnathan for triage.

@PranavSenthilnathan

This comment has been minimized.

@EgorBo

This comment has been minimized.

@EgorBo
Copy link
Member

EgorBo commented Jan 24, 2025

@EgorBot -intel -commit cf7a744 vs previous --envvars DOTNET_JitDisasm:GetIndexOfFirstNonAsciiChar DOTNET_EnableAVX512F:0 --filter System.Text.Perf_Utf8Encoding*

@EgorBo
Copy link
Member

EgorBo commented Jan 24, 2025

@EgorBot -intel -commit cf7a744 vs previous --envvars DOTNET_JitDisasm:GetIndexOfFirstNonAsciiChar --filter System.Text.Perf_Utf8Encoding.GetByteCount

@PranavSenthilnathan

This comment has been minimized.

@EgorBo
Copy link
Member

EgorBo commented Jan 24, 2025

Judging by the ADX, the regression reproduces on multiple Intel CPUs, but not AMDs. Let me kick in the benchmark again on some intels

@PranavSenthilnathan
Copy link
Member

@EgorBot -intel -aws_icelake -aws_sapphirelake -gcp_emeraldrapids -commit cf7a744 vs previous --envvars DOTNET_JitDisasm:Vector DOTNET_EnableAVX512F:0 --filter System.Text.Tests.Perf_Encoding.GetByte512utf*

@EgorBo
Copy link
Member

EgorBo commented Jan 25, 2025

@PranavSenthilnathan are you actually sure the regression comes from that commit specifically?

@PranavSenthilnathan
Copy link
Member

Looks like it was, only seems to be an issue when AVX-512 is not enabled/available.

@PranavSenthilnathan
Copy link
Member

@EgorBot -intel -profiler -commit cf7a744 vs previous --envvars DOTNET_JitDisasm:Vector DOTNET_EnableAVX512F:0 --filter System.Text.Tests.Perf_Encoding.GetByteCount512utf*

@PranavSenthilnathan
Copy link
Member

@EgorBot -intel -profiler -commit cf7a744 vs previous --envvars DOTNET_JitDisasm:Vector DOTNET_EnableAVX512F:0

using System.Text;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;

// Actual runner is optional, but if it exists, it has to be like this:
BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args);

public class Bench
{
    public int size = 512;

    public string encName = "utf-8";
    private Encoding _enc;
    private string _toEncode;
    private char[] _chars;
    [GlobalSetup]
    public void SetupGetBytes()
    {
        _enc = Encoding.GetEncoding(encName);
        _toEncode = CreateString(size);
        _chars = _toEncode.ToCharArray();
    }

    [Benchmark]
    [MemoryRandomization]
    public int GetByteCount() => _enc.GetByteCount(_chars);

    public static string CreateString(int length)
    {
        char[] str = new char[length];

        for (int i = 0; i < str.Length; i++)
        {
            // Add path separator so folders aren't too long.
            if (i % 20 == 0)
            {
                str[i] = Path.DirectorySeparatorChar;
            }
            else
            {
                str[i] = 'a';
            }
        }

        return new string(str);
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-x64 area-System.Runtime.Intrinsics os-linux Linux OS (any supported distro) runtime-coreclr specific to the CoreCLR runtime tenet-performance Performance related issue tenet-performance-benchmarks Issue from performance benchmark untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

5 participants