- Introduce IVectorAPIContext abstraction and supporting types for vectorized code generation - Add Avx2APIContext and UtilityTemplate for AVX2-specific code emission - Dynamically generate AVX2 sine methods in AVX2Rewriter - Refactor WideLane<TNumber> to use Unsafe.BitCast for all Vector conversions - Update all WideLane operators and math methods to use Unsafe.BitCast - Change MultiplyAdd parameter names for clarity - Remove static indices field in favor of Vector<TNumber>.Indices - Add implicit conversion from Vector<TNumber> to WideLane<TNumber> - Update tests and program files for compatibility
60 lines
1.4 KiB
C#
60 lines
1.4 KiB
C#
using Misaki.HighPerformance.HPC;
|
|
using Misaki.HighPerformance.LowLevel.Buffer;
|
|
using Misaki.HighPerformance.LowLevel.Collections;
|
|
using Misaki.HighPerformance.Test.Benchmark;
|
|
using Misaki.HighPerformance.Test.UnitTest;
|
|
using Misaki.HighPerformance.Test.UnitTest.Jobs;
|
|
using System.Buffers;
|
|
using System.Runtime.Intrinsics;
|
|
using System.Runtime.Intrinsics.X86;
|
|
|
|
//BenchmarkRunner.Run<GGXMipGenerationBenchmark>();
|
|
|
|
const int count = 16;
|
|
|
|
var bench = new GGXMipGenerationBenchmark();
|
|
bench.Setup();
|
|
|
|
for (var i = 0; i < count; i++)
|
|
{
|
|
bench.JobGGX();
|
|
}
|
|
|
|
var sw = System.Diagnostics.Stopwatch.StartNew();
|
|
|
|
for (var i = 0; i < count; i++)
|
|
{
|
|
bench.JobGGX();
|
|
}
|
|
|
|
sw.Stop();
|
|
var avgTime = sw.Elapsed.TotalMilliseconds / count;
|
|
Console.WriteLine($"GGX Mip Generation (Inline): {avgTime} ms");
|
|
bench.Cleanup();
|
|
|
|
//GlobalSetup.GlobalInitialize(null!);
|
|
//TestJobSystem.Initialize(null!);
|
|
|
|
//AllocationManager.Initialize();
|
|
|
|
//Console.WriteLine(0);
|
|
//for (var i = 0; i < 64; i++)
|
|
//{
|
|
// var size = Random.Shared.Next(2048, 8192 * 2);
|
|
// var arr = new UnsafeArray<Guid>(size, AllocationHandle.TLSF); // AllocationHandle.FreeList
|
|
// arr.Dispose();
|
|
//}
|
|
|
|
//Thread.Sleep(1000);
|
|
|
|
//Console.WriteLine(1);
|
|
//for (var i = 0; i < 64; i++)
|
|
//{
|
|
// var size = Random.Shared.Next(2048, 8192 * 2);
|
|
// var arr = new UnsafeArray<Guid>(size, AllocationHandle.TLSF); // AllocationHandle.FreeList
|
|
// arr.Dispose();
|
|
//}
|
|
|
|
//AllocationManager.Dispose();
|
|
//Console.Read();
|