-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
CI test #99871
Closed
Closed
CI test #99871
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dotnet-issue-labeler
bot
added
the
area-CodeGen-coreclr
CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
label
Mar 16, 2024
@EgorBot -arm64 -amd -intel using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.Runtime.InteropServices;
BenchmarkRunner.Run<Utf8Bench>(args: args);
public unsafe class Utf8Bench
{
byte* _ptr1 = null;
byte* _ptr2 = null;
[GlobalSetup]
public void GlobalSetup()
{
_ptr1 = (byte*)NativeMemory.AlignedAlloc(300 * 1024 * 1024, 64) + 8;
_ptr2 = (byte*)NativeMemory.AlignedAlloc(300 * 1024 * 1024, 64) + 8;
}
[GlobalCleanup]
public void GlobalCleanup()
{
NativeMemory.Free(_ptr1);
NativeMemory.Free(_ptr2);
}
public static IEnumerable<long> Sizes()
{
yield return 1_000;
yield return 10_000;
yield return 100_000;
yield return 1_000_000;
yield return 10_000_000;
yield return 100_000_000;
}
[Benchmark]
[ArgumentsSource(nameof(Sizes))]
public void Managed(long size) => Buffer.MemoryCopy(_ptr1, _ptr2, size, size);
[Benchmark]
[ArgumentsSource(nameof(Sizes))]
public void Native(long size) => memcpy(_ptr1, _ptr2, (nuint)size);
[DllImport("libc")]
static extern nuint memcpy(byte* dest, byte* src, nuint size);
} |
@EgorBot -intel using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.Runtime.InteropServices;
BenchmarkRunner.Run<Utf8Bench>(args: args);
public unsafe class Utf8Bench
{
byte* _ptr1 = null;
byte* _ptr2 = null;
[GlobalSetup]
public void GlobalSetup()
{
_ptr1 = (byte*)NativeMemory.AlignedAlloc(300 * 1024 * 1024, 64);
_ptr2 = (byte*)NativeMemory.AlignedAlloc(300 * 1024 * 1024, 64);
}
[GlobalCleanup]
public void GlobalCleanup()
{
NativeMemory.Free(_ptr1);
NativeMemory.Free(_ptr2);
}
public static IEnumerable<long> Sizes()
{
yield return 100_000;
}
[Benchmark]
[ArgumentsSource(nameof(Sizes))]
public void Managed(long size) => Buffer.MemoryCopy(_ptr1, _ptr2, size, size);
} |
4 similar comments
@EgorBot -intel using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.Runtime.InteropServices;
BenchmarkRunner.Run<Utf8Bench>(args: args);
public unsafe class Utf8Bench
{
byte* _ptr1 = null;
byte* _ptr2 = null;
[GlobalSetup]
public void GlobalSetup()
{
_ptr1 = (byte*)NativeMemory.AlignedAlloc(300 * 1024 * 1024, 64);
_ptr2 = (byte*)NativeMemory.AlignedAlloc(300 * 1024 * 1024, 64);
}
[GlobalCleanup]
public void GlobalCleanup()
{
NativeMemory.Free(_ptr1);
NativeMemory.Free(_ptr2);
}
public static IEnumerable<long> Sizes()
{
yield return 100_000;
}
[Benchmark]
[ArgumentsSource(nameof(Sizes))]
public void Managed(long size) => Buffer.MemoryCopy(_ptr1, _ptr2, size, size);
} |
@EgorBot -intel using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.Runtime.InteropServices;
BenchmarkRunner.Run<Utf8Bench>(args: args);
public unsafe class Utf8Bench
{
byte* _ptr1 = null;
byte* _ptr2 = null;
[GlobalSetup]
public void GlobalSetup()
{
_ptr1 = (byte*)NativeMemory.AlignedAlloc(300 * 1024 * 1024, 64);
_ptr2 = (byte*)NativeMemory.AlignedAlloc(300 * 1024 * 1024, 64);
}
[GlobalCleanup]
public void GlobalCleanup()
{
NativeMemory.Free(_ptr1);
NativeMemory.Free(_ptr2);
}
public static IEnumerable<long> Sizes()
{
yield return 100_000;
}
[Benchmark]
[ArgumentsSource(nameof(Sizes))]
public void Managed(long size) => Buffer.MemoryCopy(_ptr1, _ptr2, size, size);
} |
@EgorBot -intel using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.Runtime.InteropServices;
BenchmarkRunner.Run<Utf8Bench>(args: args);
public unsafe class Utf8Bench
{
byte* _ptr1 = null;
byte* _ptr2 = null;
[GlobalSetup]
public void GlobalSetup()
{
_ptr1 = (byte*)NativeMemory.AlignedAlloc(300 * 1024 * 1024, 64);
_ptr2 = (byte*)NativeMemory.AlignedAlloc(300 * 1024 * 1024, 64);
}
[GlobalCleanup]
public void GlobalCleanup()
{
NativeMemory.Free(_ptr1);
NativeMemory.Free(_ptr2);
}
public static IEnumerable<long> Sizes()
{
yield return 100_000;
}
[Benchmark]
[ArgumentsSource(nameof(Sizes))]
public void Managed(long size) => Buffer.MemoryCopy(_ptr1, _ptr2, size, size);
} |
@EgorBot -intel using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.Runtime.InteropServices;
BenchmarkRunner.Run<Utf8Bench>(args: args);
public unsafe class Utf8Bench
{
byte* _ptr1 = null;
byte* _ptr2 = null;
[GlobalSetup]
public void GlobalSetup()
{
_ptr1 = (byte*)NativeMemory.AlignedAlloc(300 * 1024 * 1024, 64);
_ptr2 = (byte*)NativeMemory.AlignedAlloc(300 * 1024 * 1024, 64);
}
[GlobalCleanup]
public void GlobalCleanup()
{
NativeMemory.Free(_ptr1);
NativeMemory.Free(_ptr2);
}
public static IEnumerable<long> Sizes()
{
yield return 100_000;
}
[Benchmark]
[ArgumentsSource(nameof(Sizes))]
public void Managed(long size) => Buffer.MemoryCopy(_ptr1, _ptr2, size, size);
} |
❌ Benchmark failed on Intel
|
@EgorBot -intel using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.Runtime.InteropServices;
BenchmarkRunner.Run<Utf8Bench>(args: args);
public unsafe class Utf8Bench
{
byte* _ptr1 = null;
byte* _ptr2 = null;
[GlobalSetup]
public void GlobalSetup()
{
_ptr1 = (byte*)NativeMemory.AlignedAlloc(300 * 1024 * 1024, 64);
_ptr2 = (byte*)NativeMemory.AlignedAlloc(300 * 1024 * 1024, 64);
}
[GlobalCleanup]
public void GlobalCleanup()
{
NativeMemory.Free(_ptr1);
NativeMemory.Free(_ptr2);
}
public static IEnumerable<long> Sizes()
{
yield return 100_000;
}
[Benchmark]
[ArgumentsSource(nameof(Sizes))]
public void Managed(long size) => Buffer.MemoryCopy(_ptr1, _ptr2, size, size);
} |
This was referenced Jun 28, 2024
❌ Benchmark failed on Intel
|
@EgorBot -intel using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.Runtime.InteropServices;
BenchmarkRunner.Run<Utf8Bench>(args: args);
public unsafe class Utf8Bench
{
byte* _ptr1 = null;
byte* _ptr2 = null;
[GlobalSetup]
public void GlobalSetup()
{
_ptr1 = (byte*)NativeMemory.AlignedAlloc(300 * 1024 * 1024, 64);
_ptr2 = (byte*)NativeMemory.AlignedAlloc(300 * 1024 * 1024, 64);
}
[GlobalCleanup]
public void GlobalCleanup()
{
NativeMemory.Free(_ptr1);
NativeMemory.Free(_ptr2);
}
public static IEnumerable<long> Sizes()
{
yield return 100_000;
}
[Benchmark]
[ArgumentsSource(nameof(Sizes))]
public void Managed(long size) => Buffer.MemoryCopy(_ptr1, _ptr2, size, size);
} |
Benchmark results on Intel
|
@EgorBot -intel using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
BenchmarkRunner.Run<MyBench>(args: args); // args must be forwarded to BDN!
public class MyBench
{
string _str = "dotnet/RUNTIME";
[Benchmark]
public bool Test() =>
// JIT is expected to unroll this with SIMD:
_str.Equals("dotnet/runtime", StringComparison.OrdinalIgnoreCase);
} |
@EgorBot -intel using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
BenchmarkRunner.Run<MyBench>(args: args); // args must be forwarded to BDN!
public class MyBench
{
string _str = "dotnet/RUNTIME";
[Benchmark]
public bool Test() =>
// JIT is expected to unroll this with SIMD:
_str.Equals("dotnet/runtime", StringComparison.OrdinalIgnoreCase);
} |
Benchmark results on Intel
|
@EgorBot -arm64 -profile using System.Runtime.CompilerServices;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
BenchmarkRunner.Run<Bench>(args: args);
public class Bench
{
// struct in heap
MyStruct MS = new();
[Benchmark]
public void CheckedWB_InHeap()
{
string str = new string('x', 1);
for (long i = 0; i < 200000000; i++)
CheckedWriteBarrier(ref MS, str);
}
[MethodImpl(MethodImplOptions.NoInlining)]
void CheckedWriteBarrier(ref MyStruct ms, string str) => ms.Str = str;
}
public record struct MyStruct(string Str);
internal class Foo
{
public volatile Foo x;
} |
Benchmark results on Arm64
Flame graphs: Main vs PR 🔥 For clean |
This was referenced Sep 1, 2024
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.