mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-06-09 10:06:34 +02:00
Import tensors and add methods to sbox (#6450)
* Import tensors and add methods to sbox * might be a good idea to expose pseudo-ctors also nuke spans as tey're too much to review rn * nuke buffers * nuke unconsumable types * hilarious --------- Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
This commit is contained in:
@@ -74,6 +74,7 @@
|
|||||||
<PackageVersion Include="prometheus-net.DotNetRuntime" Version="4.4.1" />
|
<PackageVersion Include="prometheus-net.DotNetRuntime" Version="4.4.1" />
|
||||||
<PackageVersion Include="PolySharp" Version="1.15.0" />
|
<PackageVersion Include="PolySharp" Version="1.15.0" />
|
||||||
<PackageVersion Include="System.CommandLine" Version="2.0.1" />
|
<PackageVersion Include="System.CommandLine" Version="2.0.1" />
|
||||||
|
<PackageVersion Include="System.Numerics.Tensors" Version="10.0.4" />
|
||||||
<!-- Transitive deps that we need to pin versions for to avoid NuGet warnings. -->
|
<!-- Transitive deps that we need to pin versions for to avoid NuGet warnings. -->
|
||||||
<PackageVersion Include="System.Formats.Asn1" Version="10.0.0" />
|
<PackageVersion Include="System.Formats.Asn1" Version="10.0.0" />
|
||||||
<PackageVersion Include="System.Reflection.Metadata" Version="10.0.0" />
|
<PackageVersion Include="System.Reflection.Metadata" Version="10.0.0" />
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
using BenchmarkDotNet.Attributes;
|
using System.Numerics.Tensors;
|
||||||
|
using BenchmarkDotNet.Attributes;
|
||||||
|
using BenchmarkDotNet.Configs;
|
||||||
using Robust.Shared.Analyzers;
|
using Robust.Shared.Analyzers;
|
||||||
|
|
||||||
namespace Robust.Benchmarks.NumericsHelpers;
|
namespace Robust.Benchmarks.NumericsHelpers;
|
||||||
|
|
||||||
[Virtual]
|
[Virtual]
|
||||||
|
[GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByMethod)]
|
||||||
|
[MemoryDiagnoser]
|
||||||
|
[DisassemblyDiagnoser]
|
||||||
public class AddBenchmark
|
public class AddBenchmark
|
||||||
{
|
{
|
||||||
[Params(32, 128)]
|
[Params(32, 128, 256, 512, 1024, 2048, 4096, 8192, 16384)]
|
||||||
public int N { get; set; }
|
public int N { get; set; }
|
||||||
|
|
||||||
[Params(1,2)]
|
|
||||||
public int T { get; set; }
|
|
||||||
|
|
||||||
private float[] _inputA = default!;
|
private float[] _inputA = default!;
|
||||||
private float[] _inputB = default!;
|
private float[] _inputB = default!;
|
||||||
private float[] _output = default!;
|
private float[] _output = default!;
|
||||||
@@ -25,8 +27,14 @@ public class AddBenchmark
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Benchmark]
|
[Benchmark]
|
||||||
public void Bench()
|
public void BenchNumericsHelpers()
|
||||||
{
|
{
|
||||||
Shared.Maths.NumericsHelpers.Add(_inputA, _inputB, _output);
|
Shared.Maths.NumericsHelpers.Add(_inputA, _inputB, _output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Benchmark]
|
||||||
|
public void BenchTensor()
|
||||||
|
{
|
||||||
|
TensorPrimitives.Add(_inputA, _inputB, _output);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,8 @@
|
|||||||
<PackageReference Include="BenchmarkDotNet" PrivateAssets="none" />
|
<PackageReference Include="BenchmarkDotNet" PrivateAssets="none" />
|
||||||
|
|
||||||
<PackageReference Include="JetBrains.Annotations" />
|
<PackageReference Include="JetBrains.Annotations" />
|
||||||
|
|
||||||
|
<PackageReference Include="System.Numerics.Tensors" />
|
||||||
<PackageReference Include="YamlDotNet" />
|
<PackageReference Include="YamlDotNet" />
|
||||||
<PackageReference Include="prometheus-net" />
|
<PackageReference Include="prometheus-net" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design">
|
||||||
|
|||||||
@@ -687,6 +687,8 @@ Types:
|
|||||||
IUnaryNegationOperators`2: { All: True }
|
IUnaryNegationOperators`2: { All: True }
|
||||||
IUnaryPlusOperators`2: { All: True }
|
IUnaryPlusOperators`2: { All: True }
|
||||||
IUnsignedNumber`1: { All: True }
|
IUnsignedNumber`1: { All: True }
|
||||||
|
System.Numerics.Tensors:
|
||||||
|
TensorPrimitives: { All: True }
|
||||||
System.Reflection:
|
System.Reflection:
|
||||||
Assembly:
|
Assembly:
|
||||||
Methods:
|
Methods:
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" />
|
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" />
|
||||||
<PackageReference Include="Nett" PrivateAssets="compile" />
|
<PackageReference Include="Nett" PrivateAssets="compile" />
|
||||||
<PackageReference Include="System.Management" />
|
<PackageReference Include="System.Management" />
|
||||||
|
<PackageReference Include="System.Numerics.Tensors" />
|
||||||
<PackageReference Include="VorbisPizza" PrivateAssets="compile" />
|
<PackageReference Include="VorbisPizza" PrivateAssets="compile" />
|
||||||
<PackageReference Include="Pidgin" />
|
<PackageReference Include="Pidgin" />
|
||||||
<PackageReference Include="prometheus-net" />
|
<PackageReference Include="prometheus-net" />
|
||||||
|
|||||||
Reference in New Issue
Block a user