Remove GraphicsDevice.Default property and APIs

このコミットが含まれているのは:
Sergio Pedri committed 2022-07-31 23:26:11 +02:00
1 親 ea0f792ae6
コミット 4e5acba69c
19ファイル変更
+67 -115

検索条件に一致するファイルはありません

+10 -10
ファイルの表示
@@ -100,10 +100,10 @@ public class BlasBenchmark : IDisposable
B = CreateRandomArray(P);
Y = CreateRandomArray(C * N * P);
BufferX = GraphicsDevice.Default.AllocateReadOnlyBuffer(X);
BufferW = GraphicsDevice.Default.AllocateReadOnlyBuffer(W);
BufferB = GraphicsDevice.Default.AllocateReadOnlyBuffer(B);
BufferY = GraphicsDevice.Default.AllocateReadWriteBuffer(Y);
BufferX = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(X);
BufferW = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(W);
BufferB = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(B);
BufferY = GraphicsDevice.GetDefault().AllocateReadWriteBuffer(Y);
Cpu();
GpuWithNoTemporaryBuffers();
@@ -140,7 +140,7 @@ public class BlasBenchmark : IDisposable
[Benchmark]
public void GpuWithNoTemporaryBuffers()
{
BlasHelpers.FullyConnectedForwardGpu(GraphicsDevice.Default, C, N, M, P, BufferX!, BufferW!, BufferB!, BufferY!);
BlasHelpers.FullyConnectedForwardGpu(GraphicsDevice.GetDefault(), C, N, M, P, BufferX!, BufferW!, BufferB!, BufferY!);
}
/// <summary>
@@ -149,12 +149,12 @@ public class BlasBenchmark : IDisposable
[Benchmark]
public void GpuWithTemporaryBuffers()
{
using ReadOnlyBuffer<float> x = GraphicsDevice.Default.AllocateReadOnlyBuffer(X!);
using ReadOnlyBuffer<float> w = GraphicsDevice.Default.AllocateReadOnlyBuffer(W!);
using ReadOnlyBuffer<float> b = GraphicsDevice.Default.AllocateReadOnlyBuffer(B!);
using ReadWriteBuffer<float> y = GraphicsDevice.Default.AllocateReadWriteBuffer<float>(Y!.Length);
using ReadOnlyBuffer<float> x = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(X!);
using ReadOnlyBuffer<float> w = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(W!);
using ReadOnlyBuffer<float> b = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(B!);
using ReadWriteBuffer<float> y = GraphicsDevice.GetDefault().AllocateReadWriteBuffer<float>(Y!.Length);
BlasHelpers.FullyConnectedForwardGpu(GraphicsDevice.Default, C, N, M, P, x, w, b, y);
BlasHelpers.FullyConnectedForwardGpu(GraphicsDevice.GetDefault(), C, N, M, P, x, w, b, y);
y.CopyTo(Y);
}
+8 -8
ファイルの表示
@@ -23,7 +23,7 @@ public partial class DispatchingBenchmark : IDisposable
[GlobalSetup]
public void Setup()
{
Buffer = GraphicsDevice.Default.AllocateReadWriteBuffer<float>(128);
Buffer = GraphicsDevice.GetDefault().AllocateReadWriteBuffer<float>(128);
}
/// <inheritdoc/>
@@ -40,7 +40,7 @@ public partial class DispatchingBenchmark : IDisposable
[BenchmarkCategory("SINGLE")]
public void Compute_Single()
{
GraphicsDevice.Default.For(64, new TestShader(Buffer!));
GraphicsDevice.GetDefault().For(64, new TestShader(Buffer!));
}
/// <summary>
@@ -50,7 +50,7 @@ public partial class DispatchingBenchmark : IDisposable
[BenchmarkCategory("SINGLE")]
public void Compute_Single_WithContext()
{
using var context = GraphicsDevice.Default.CreateComputeContext();
using var context = GraphicsDevice.GetDefault().CreateComputeContext();
context.For(64, new TestShader(Buffer!));
}
@@ -62,7 +62,7 @@ public partial class DispatchingBenchmark : IDisposable
[BenchmarkCategory("SINGLE")]
public async Task Compute_Single_WithContext_Async()
{
await using var context = GraphicsDevice.Default.CreateComputeContext();
await using var context = GraphicsDevice.GetDefault().CreateComputeContext();
context.For(64, new TestShader(Buffer!));
}
@@ -74,8 +74,8 @@ public partial class DispatchingBenchmark : IDisposable
[BenchmarkCategory("MULTIPLE")]
public void Compute_Multiple()
{
GraphicsDevice.Default.For(64, new TestShader(Buffer!));
GraphicsDevice.Default.For(64, new TestShader(Buffer!));
GraphicsDevice.GetDefault().For(64, new TestShader(Buffer!));
GraphicsDevice.GetDefault().For(64, new TestShader(Buffer!));
}
/// <summary>
@@ -85,7 +85,7 @@ public partial class DispatchingBenchmark : IDisposable
[BenchmarkCategory("MULTIPLE")]
public void Compute_Multiple_WithContext()
{
using var context = GraphicsDevice.Default.CreateComputeContext();
using var context = GraphicsDevice.GetDefault().CreateComputeContext();
context.For(64, new TestShader(Buffer!));
context.Barrier(Buffer!);
@@ -99,7 +99,7 @@ public partial class DispatchingBenchmark : IDisposable
[BenchmarkCategory("MULTIPLE")]
public async Task Compute_Multiple_WithContext_Async()
{
await using var context = GraphicsDevice.Default.CreateComputeContext();
await using var context = GraphicsDevice.GetDefault().CreateComputeContext();
context.For(64, new TestShader(Buffer!));
context.Barrier(Buffer!);