-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Processing dotnet/runtime#123610 (comment) command:
Command
-x64 -arm
using System;
using System.Numerics.Tensors;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args);
[MemoryDiagnoser]
public class Bench
{
private float[] _floatData = default!;
private double[] _doubleData = default!;
private Half[] _halfData = default!;
[Params(512)]
public int Count { get; set; }
[GlobalSetup]
public void Setup()
{
var random = new Random(42);
_floatData = new float[Count];
_doubleData = new double[Count];
_halfData = new Half[Count];
for (int i = 0; i < Count; i++)
{
_floatData[i] = (float)(random.NextDouble() * 1000 - 500);
_doubleData[i] = random.NextDouble() * 1000 - 500;
_halfData[i] = (Half)_floatData[i];
}
}
[Benchmark]
public void BitIncrement_Single()
{
TensorPrimitives.BitIncrement(_floatData, _floatData);
}
[Benchmark]
public void BitIncrement_Double()
{
TensorPrimitives.BitIncrement(_doubleData, _doubleData);
}
[Benchmark]
public void BitIncrement_Half()
{
TensorPrimitives.BitIncrement(_halfData, _halfData);
}
[Benchmark]
public void BitDecrement_Single()
{
TensorPrimitives.BitDecrement(_floatData, _floatData);
}
[Benchmark]
public void BitDecrement_Double()
{
TensorPrimitives.BitDecrement(_doubleData, _doubleData);
}
[Benchmark]
public void BitDecrement_Half()
{
TensorPrimitives.BitDecrement(_halfData, _halfData);
}
}This will benchmark all three types (float, double, Half) for both BitIncrement and BitDecrement operations on x64 and ARM architectures, comparing the PR changes against the base branch.
(EgorBot will reply in this issue)
Metadata
Metadata
Assignees
Labels
No labels