EgorBot / runtime-utils

MIT License
0 stars 1 forks source link

EgorBot for EgorBo in #109570 #156

Closed EgorBot closed 5 days ago

EgorBot commented 1 week ago

Processing https://github.com/dotnet/runtime/pull/109570#issuecomment-2466467004 command:

Command -aws_sapphirelake -aws_genoa -gcp_axion -gcp_emeraldrapids -hetzner_dedicated_milano -hetzner_amd ```cs using System.Runtime.InteropServices; using BenchmarkDotNet.Attributes; using System.Runtime.CompilerServices; using BenchmarkDotNet.Running; BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args); public unsafe class Bench { static byte* _srcAlign64; static byte* _srcAlign8; [GlobalSetup] public void Setup() { _srcAlign64 = (byte*)NativeMemory.AlignedAlloc(1024 * 1024, 64); _srcAlign8 = _srcAlign64 + 8; } [GlobalCleanup] public void Cleanup() => NativeMemory.AlignedFree(_srcAlign64); [Benchmark] public void Zero256_Align64() => Unsafe.InitBlockUnaligned(_srcAlign64, 0, 256); } ```

(EgorBot will reply in this issue)

EgorBo commented 1 week ago

@EgorBot -azure_cobalt100

using System.Runtime.InteropServices;
using BenchmarkDotNet.Attributes;
using System.Runtime.CompilerServices;
using BenchmarkDotNet.Running;

BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args);

public unsafe class Bench
{
    static byte* _srcAlign64;
    static byte* _srcAlign8;

    [GlobalSetup]
    public void Setup()
    {
        _srcAlign64 = (byte*)NativeMemory.AlignedAlloc(1024 * 1024, 64);
        _srcAlign8 = _srcAlign64 + 8;
    }

    [GlobalCleanup]
    public void Cleanup() => NativeMemory.AlignedFree(_srcAlign64);

    [Benchmark] public void Zero256_Align64() => Unsafe.InitBlockUnaligned(_srcAlign64, 0, 256);
}
EgorBo commented 1 week ago

@EgorBot -azure_cobalt100

using System.Runtime.InteropServices;
using BenchmarkDotNet.Attributes;
using System.Runtime.CompilerServices;
using BenchmarkDotNet.Running;

BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args);

public unsafe class Bench
{
    static byte* _srcAlign64;
    static byte* _srcAlign8;

    [GlobalSetup]
    public void Setup()
    {
        _srcAlign64 = (byte*)NativeMemory.AlignedAlloc(1024 * 1024, 64);
        _srcAlign8 = _srcAlign64 + 8;
    }

    [GlobalCleanup]
    public void Cleanup() => NativeMemory.AlignedFree(_srcAlign64);

    [Benchmark] public void Zero256_Align64() => Unsafe.InitBlockUnaligned(_srcAlign64, 0, 256);
}
EgorBot commented 1 week ago

Benchmark results on linux-cobalt100

BenchmarkDotNet v0.14.0, Ubuntu 22.04.5 LTS (Jammy Jellyfish)
AzureCobalt100
DefaultJob : .NET 9.0.0 (9.0.24.47305), Arm64 RyuJIT AdvSIMD
StdDev=0.0094 ns
Method Mean Error
Zero256_Align64 1.605 ns 0.0100 ns

BDN_Artifacts.zip
cc @EgorBo (agent_logs.txt)

EgorBo commented 1 week ago

@EgorBot -intel -amd -arm

using System.Runtime.InteropServices;
using BenchmarkDotNet.Attributes;
using System.Runtime.CompilerServices;
using BenchmarkDotNet.Running;

BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args);

public unsafe class Bench
{
    static byte* _srcAlign64;
    static byte* _srcAlign8;

    [GlobalSetup]
    public void Setup()
    {
        _srcAlign64 = (byte*)NativeMemory.AlignedAlloc(1024 * 1024, 64);
        _srcAlign8 = _srcAlign64 + 8;
    }

    [GlobalCleanup]
    public void Cleanup() => NativeMemory.AlignedFree(_srcAlign64);

    [Benchmark] public void Zero256_Align64() => Unsafe.InitBlockUnaligned(_srcAlign64, 0, 256);
}
EgorBot commented 1 week ago

Benchmark results on linux-icelake

BenchmarkDotNet v0.14.0, Ubuntu 22.04.5 LTS (Jammy Jellyfish)
Intel Xeon Platinum 8370C CPU 2.80GHz, 1 CPU, 4 logical and 2 physical cores
DefaultJob : .NET 9.0.0 (9.0.24.47305), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
StdDev=0.0035 ns
Method Mean Error
Zero256_Align64 0.3011 ns 0.0045 ns

BDN_Artifacts.zip
cc @EgorBo (agent_logs.txt)

EgorBot commented 1 week ago

Benchmark results on linux-cobalt100

BenchmarkDotNet v0.14.0, Ubuntu 22.04.5 LTS (Jammy Jellyfish)
AzureCobalt100
DefaultJob : .NET 9.0.0 (9.0.24.47305), Arm64 RyuJIT AdvSIMD
StdDev=0.0106 ns
Method Mean Error
Zero256_Align64 6.219 ns 0.0113 ns

BDN_Artifacts.zip
cc @EgorBo (agent_logs.txt)

EgorBot commented 1 week ago

Benchmark results on linux-milano

BenchmarkDotNet v0.14.0, Ubuntu 22.04.5 LTS (Jammy Jellyfish)
AMD EPYC 7763, 1 CPU, 4 logical and 2 physical cores
DefaultJob : .NET 9.0.0 (9.0.24.47305), X64 RyuJIT AVX2
StdDev=0.0006 ns
Method Mean Error
Zero256_Align64 1.162 ns 0.0008 ns

BDN_Artifacts.zip
cc @EgorBo (agent_logs.txt)

EgorBo commented 1 week ago

@EgorBot -arm -commit main -profiler

using System.Runtime.InteropServices;
using BenchmarkDotNet.Attributes;
using System.Runtime.CompilerServices;
using BenchmarkDotNet.Running;

BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args);

public unsafe class Bench
{
    static byte* _srcAlign64;
    static byte* _srcAlign8;

    [GlobalSetup]
    public void Setup()
    {
        _srcAlign64 = (byte*)NativeMemory.AlignedAlloc(1024 * 1024, 64);
        _srcAlign8 = _srcAlign64 + 8;
    }

    [GlobalCleanup]
    public void Cleanup() => NativeMemory.AlignedFree(_srcAlign64);

    [Benchmark] public void Zero256_Align64() => Unsafe.InitBlockUnaligned(_srcAlign64, 0, 256);
}
EgorBot commented 1 week ago

Benchmark results on linux-cobalt100

BenchmarkDotNet v0.14.0, Ubuntu 22.04.5 LTS (Jammy Jellyfish)
AzureCobalt100
  Job-VAKNHW : .NET 10.0.0 (42.42.42.42424), Arm64 RyuJIT AdvSIMD
Job=Job-VAKNHW  Toolchain=CoreRun  StdDev=0.0040 ns
Method Mean Error
Zero256_Align64 6.164 ns 0.0043 ns

BDN_Artifacts.zip
cc @EgorBo (agent_logs.txt)

EgorBo commented 1 week ago

@EgorBot -arm -commit main -profiler -keep

using System.Runtime.InteropServices;
using BenchmarkDotNet.Attributes;
using System.Runtime.CompilerServices;
using BenchmarkDotNet.Running;

BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args);

public unsafe class Bench
{
    static byte* _srcAlign64;
    static byte* _srcAlign8;

    [GlobalSetup]
    public void Setup()
    {
        _srcAlign64 = (byte*)NativeMemory.AlignedAlloc(1024 * 1024, 64);
        _srcAlign8 = _srcAlign64 + 8;
    }

    [GlobalCleanup]
    public void Cleanup() => NativeMemory.AlignedFree(_srcAlign64);

    [Benchmark] public void Zero256_Align64() => Unsafe.InitBlockUnaligned(_srcAlign64, 0, 256);
}
EgorBo commented 1 week ago

@EgorBot -arm -commit main -profiler

using System.Runtime.InteropServices;
using BenchmarkDotNet.Attributes;
using System.Runtime.CompilerServices;
using BenchmarkDotNet.Running;

BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args);

public unsafe class Bench
{
    static byte* _srcAlign64;
    static byte* _srcAlign8;

    [GlobalSetup]
    public void Setup()
    {
        _srcAlign64 = (byte*)NativeMemory.AlignedAlloc(1024 * 1024, 64);
        _srcAlign8 = _srcAlign64 + 8;
    }

    [GlobalCleanup]
    public void Cleanup() => NativeMemory.AlignedFree(_srcAlign64);

    [Benchmark] public void Zero256_Align64() => Unsafe.InitBlockUnaligned(_srcAlign64, 0, 256);
}
EgorBo commented 1 week ago

@EgorBot -aws_arm -commit main -profiler

using System.Runtime.InteropServices;
using BenchmarkDotNet.Attributes;
using System.Runtime.CompilerServices;
using BenchmarkDotNet.Running;

BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args);

public unsafe class Bench
{
    static byte* _srcAlign64;
    static byte* _srcAlign8;

    [GlobalSetup]
    public void Setup()
    {
        _srcAlign64 = (byte*)NativeMemory.AlignedAlloc(1024 * 1024, 64);
        _srcAlign8 = _srcAlign64 + 8;
    }

    [GlobalCleanup]
    public void Cleanup() => NativeMemory.AlignedFree(_srcAlign64);

    [Benchmark] public void Zero256_Align64() => Unsafe.InitBlockUnaligned(_srcAlign64, 0, 256);
}
EgorBot commented 1 week ago

Benchmark results on linux-cobalt100

BenchmarkDotNet v0.14.0, Ubuntu 22.04.5 LTS (Jammy Jellyfish)
AzureCobalt100
  Job-IQBUSL : .NET 10.0.0 (42.42.42.42424), Arm64 RyuJIT AdvSIMD
Job=Job-IQBUSL  Toolchain=CoreRun  StdDev=0.0041 ns
Method Mean Error
Zero256_Align64 6.122 ns 0.0044 ns

BDN_Artifacts.zip

Profile for Bench_Zero256_Align64:

Flame graphs: Main 🔥 Speedscope: Main Hot asm: Main Hot functions: Main Counters: Main


cc @EgorBo (agent_logs.txt)

EgorBot commented 1 week ago

Benchmark results on linux-arm64

BenchmarkDotNet v0.14.0, Ubuntu 24.04 LTS (Noble Numbat)
Arm64
  Job-CAYSXE : .NET 10.0.0 (42.42.42.42424), Arm64 RyuJIT AdvSIMD
Job=Job-CAYSXE  Toolchain=CoreRun  StdDev=0.0005 ns
Method Mean Error
Zero256_Align64 2.009 ns 0.0005 ns

BDN_Artifacts.zip

Profile for Bench_Zero256_Align64:

Flame graphs: Main 🔥 Speedscope: Main Hot asm: Main Hot functions: Main Counters: Main


cc @EgorBo (agent_logs.txt)

EgorBo commented 1 week ago

@EgorBot -arm -intel -commit main -profiler

using System.Runtime.InteropServices;
using BenchmarkDotNet.Attributes;
using System.Runtime.CompilerServices;
using BenchmarkDotNet.Running;

BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args);

public unsafe class Bench
{
    static byte* _srcAlign64;
    static byte* _srcAlign8;

    [GlobalSetup]
    public void Setup()
    {
        _srcAlign64 = (byte*)NativeMemory.AlignedAlloc(1024 * 1024, 64);
        _srcAlign8 = _srcAlign64 + 8;
    }

    [GlobalCleanup]
    public void Cleanup() => NativeMemory.AlignedFree(_srcAlign64);

    [Benchmark] public void Zero256_Align64() => Unsafe.InitBlockUnaligned(_srcAlign64, 0, 256);
}
EgorBot commented 1 week ago

Benchmark results on linux_arm64

BenchmarkDotNet v0.14.0, Ubuntu 24.04 LTS (Noble Numbat)
arm64
  Job-LGPOYU : .NET 10.0.0 (42.42.42.42424), Arm64 RyuJIT AdvSIMD
Job=Job-LGPOYU  Toolchain=CoreRun  StdDev=0.0007 ns
Method Mean Error
Zero256_Align64 2.009 ns 0.0008 ns

BDN_Artifacts.zip

Profile for Bench_Zero256_Align64:

Flame graphs: Main 🔥 Speedscope: Main Hot asm: Main Hot functions: Main Counters: Main


cc @EgorBo (agent_logs.txt)

EgorBot commented 1 week ago

Benchmark results on linux_icelake

BenchmarkDotNet v0.14.0, Ubuntu 22.04.5 LTS (Jammy Jellyfish)
Intel Xeon Platinum 8370C CPU 2.80GHz, 1 CPU, 8 logical and 4 physical cores
  Job-OBZBSO : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
Job=Job-OBZBSO  Toolchain=CoreRun  StdDev=0.0004 ns
Method Mean Error
Zero256_Align64 0.7470 ns 0.0005 ns

BDN_Artifacts.zip

Profile for Bench_Zero256_Align64:

Flame graphs: Main 🔥 Speedscope: Main Hot asm: Main Hot functions: Main Counters: Main


cc @EgorBo (agent_logs.txt)

EgorBo commented 5 days ago

@EgorBot -codesafety -pr 109896

EgorBot commented 5 days ago

Code safety report

Main:

Assembly Total
methods
P/Invokes Methods with
'unsafe' context
Methods with
Unsafe API calls
System.Private.CoreLib 21718 323 2150 1004
Common 5988 2143 430 116
System.Net.HttpListener 786 0 314 0
System.Numerics.Tensors 1598 0 126 131
System.Security.Cryptography 4823 0 202 51
System.Reflection.Metadata 2612 0 180 3
System.Net.Http 2261 90 51 16
System.Net.Sockets 1032 0 142 9
Other 80058 40 1164 447
Total 120876 2596 4759 1777

PR:

Assembly Total
methods
P/Invokes Methods with
'unsafe' context
Methods with
Unsafe API calls
System.Private.CoreLib 21718 323 2150 1004
Common 5988 2143 430 116
System.Net.HttpListener 786 0 314 0
System.Numerics.Tensors 1598 0 126 131
System.Security.Cryptography 4823 0 202 51
System.Reflection.Metadata 2612 0 180 3
System.Net.Http 2261 90 51 16
System.Net.Sockets 1032 0 142 9
Other 80058 40 1164 447
Total 120876 2596 4759 1777

UnsafeCodeAnalyzer

cc @EgorBo