Unified fallback device initialization
このコミットが含まれているのは:
1 親
f0e1a6ded7
コミット
606faa70c9
3ファイル変更
+4
-88
検索条件に一致するファイルはありません
@@ -72,26 +72,6 @@ namespace ComputeSharp.Benchmark
|
||||
/// </summary>
|
||||
private ReadWriteBuffer<float> BufferY;
|
||||
|
||||
/// <summary>
|
||||
/// The input tensor (CPU).
|
||||
/// </summary>
|
||||
private ReadOnlyBuffer<float> FallbackBufferX;
|
||||
|
||||
/// <summary>
|
||||
/// The weights tensor (CPU).
|
||||
/// </summary>
|
||||
private ReadOnlyBuffer<float> FallbackBufferW;
|
||||
|
||||
/// <summary>
|
||||
/// The bias tensor (CPU).
|
||||
/// </summary>
|
||||
private ReadOnlyBuffer<float> FallbackBufferB;
|
||||
|
||||
/// <summary>
|
||||
/// The result tensor (CPU).
|
||||
/// </summary>
|
||||
private ReadWriteBuffer<float> FallbackBufferY;
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="System.Random"/> instance to initialize the tensors.
|
||||
/// </summary>
|
||||
@@ -125,11 +105,6 @@ namespace ComputeSharp.Benchmark
|
||||
BufferW = Gpu.Default.AllocateReadOnlyBuffer(W);
|
||||
BufferB = Gpu.Default.AllocateReadOnlyBuffer(B);
|
||||
BufferY = Gpu.Default.AllocateReadWriteBuffer(Y);
|
||||
|
||||
FallbackBufferX = Gpu.Fallback.AllocateReadOnlyBuffer(X);
|
||||
FallbackBufferW = Gpu.Fallback.AllocateReadOnlyBuffer(W);
|
||||
FallbackBufferB = Gpu.Fallback.AllocateReadOnlyBuffer(B);
|
||||
FallbackBufferY = Gpu.Fallback.AllocateReadWriteBuffer(Y);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -147,11 +122,6 @@ namespace ComputeSharp.Benchmark
|
||||
BufferW.Dispose();
|
||||
BufferB.Dispose();
|
||||
BufferY.Dispose();
|
||||
|
||||
FallbackBufferX.Dispose();
|
||||
FallbackBufferW.Dispose();
|
||||
FallbackBufferB.Dispose();
|
||||
FallbackBufferY.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -181,27 +151,5 @@ namespace ComputeSharp.Benchmark
|
||||
|
||||
y.GetData(Y);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs a fully connected forward operation on the fallback device.
|
||||
/// </summary>
|
||||
[Benchmark]
|
||||
public void FallbackWithNoTemporaryBuffers() => Dnn.FullyConnectedForwardGpu(Gpu.Fallback, C, N, M, P, FallbackBufferX, FallbackBufferW, FallbackBufferB, FallbackBufferY);
|
||||
|
||||
/// <summary>
|
||||
/// Runs a fully connected forward operation on the fallback device, creating temporary buffers to perform the operations.
|
||||
/// </summary>
|
||||
[Benchmark]
|
||||
public void FallbackWithTemporaryBuffers()
|
||||
{
|
||||
using ReadOnlyBuffer<float> x = Gpu.Fallback.AllocateReadOnlyBuffer(X);
|
||||
using ReadOnlyBuffer<float> w = Gpu.Fallback.AllocateReadOnlyBuffer(W);
|
||||
using ReadOnlyBuffer<float> b = Gpu.Fallback.AllocateReadOnlyBuffer(B);
|
||||
using ReadWriteBuffer<float> y = Gpu.Fallback.AllocateReadWriteBuffer(Y);
|
||||
|
||||
Dnn.FullyConnectedForwardGpu(Gpu.Fallback, C, N, M, P, x, w, b, y);
|
||||
|
||||
y.GetData(Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする