Added missing dots
このコミットが含まれているのは:
1 親
e45b712000
コミット
33870886b6
51ファイル変更
+5686
-5686
検索条件に一致するファイルはありません
@@ -4,21 +4,21 @@ using System.Threading.Tasks;
|
||||
namespace ComputeSharp.Benchmark
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="class"/> that contains primitives to run certain operations of a neural network
|
||||
/// A <see langword="class"/> that contains primitives to run certain operations of a neural network.
|
||||
/// </summary>
|
||||
internal static partial class Dnn
|
||||
{
|
||||
/// <summary>
|
||||
/// Executes the forward pass on a fully connected layer on the CPU
|
||||
/// Executes the forward pass on a fully connected layer on the CPU.
|
||||
/// </summary>
|
||||
/// <param name="c">The number of samples in the input tensor</param>
|
||||
/// <param name="n">The number of rows in the input matrix</param>
|
||||
/// <param name="m">The number of columns in the input matrix</param>
|
||||
/// <param name="p">The number of columns in the output matrix</param>
|
||||
/// <param name="x">The input tensor</param>
|
||||
/// <param name="w">The weights tensor</param>
|
||||
/// <param name="b">The bias tensor</param>
|
||||
/// <param name="y">The result tensor</param>
|
||||
/// <param name="c">The number of samples in the input tensor.</param>
|
||||
/// <param name="n">The number of rows in the input matrix.</param>
|
||||
/// <param name="m">The number of columns in the input matrix.</param>
|
||||
/// <param name="p">The number of columns in the output matrix.</param>
|
||||
/// <param name="x">The input tensor.</param>
|
||||
/// <param name="w">The weights tensor.</param>
|
||||
/// <param name="b">The bias tensor.</param>
|
||||
/// <param name="y">The result tensor.</param>
|
||||
public static void FullyConnectedForwardCpu(int c, int n, int m, int p, float[] x, float[] w, float[] b, float[] y)
|
||||
{
|
||||
void Kernel(int s)
|
||||
@@ -51,16 +51,16 @@ namespace ComputeSharp.Benchmark
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the forward pass on a fully connected layer on the GPU
|
||||
/// Executes the forward pass on a fully connected layer on the GPU.
|
||||
/// </summary>
|
||||
/// <param name="c">The number of samples in the input tensor</param>
|
||||
/// <param name="n">The number of rows in the input matrix</param>
|
||||
/// <param name="m">The number of columns in the input matrix</param>
|
||||
/// <param name="p">The number of columns in the output matrix</param>
|
||||
/// <param name="x">The input tensor</param>
|
||||
/// <param name="w">The weights tensor</param>
|
||||
/// <param name="b">The bias tensor</param>
|
||||
/// <param name="y">The result tensor</param>
|
||||
/// <param name="c">The number of samples in the input tensor.</param>
|
||||
/// <param name="n">The number of rows in the input matrix.</param>
|
||||
/// <param name="m">The number of columns in the input matrix.</param>
|
||||
/// <param name="p">The number of columns in the output matrix.</param>
|
||||
/// <param name="x">The input tensor.</param>
|
||||
/// <param name="w">The weights tensor.</param>
|
||||
/// <param name="b">The bias tensor.</param>
|
||||
/// <param name="y">The result tensor.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void FullyConnectedForwardGpu(
|
||||
int c, int n, int m, int p,
|
||||
@@ -70,7 +70,7 @@ namespace ComputeSharp.Benchmark
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Kernel for <see cref="FullyConnectedForwardGpu"/>
|
||||
/// Kernel for <see cref="FullyConnectedForwardGpu"/>.
|
||||
/// </summary>
|
||||
[AutoConstructor]
|
||||
private readonly partial struct FullyConnectedForwardKernel : IComputeShader
|
||||
|
||||
@@ -7,17 +7,17 @@ using BenchmarkDotNet.Attributes;
|
||||
namespace ComputeSharp.Benchmark
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="class"/> that benchmarks the APIs in the <see cref="Dnn"/> class, on both CPU and GPU
|
||||
/// A <see langword="class"/> that benchmarks the APIs in the <see cref="Dnn"/> class, on both CPU and GPU.
|
||||
/// </summary>
|
||||
public class DnnBenchmark : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// The number of samples
|
||||
/// The number of samples.
|
||||
/// </summary>
|
||||
private const int C = 128;
|
||||
|
||||
/// <summary>
|
||||
/// The nummber of rows in the <see cref="X"/> matrix
|
||||
/// The nummber of rows in the <see cref="X"/> matrix.
|
||||
/// </summary>
|
||||
private const int N = 512;
|
||||
|
||||
@@ -27,57 +27,57 @@ namespace ComputeSharp.Benchmark
|
||||
private const int M = 512;
|
||||
|
||||
/// <summary>
|
||||
/// The number of columns in the <see cref="W"/> matrix
|
||||
/// The number of columns in the <see cref="W"/> matrix.
|
||||
/// </summary>
|
||||
private const int P = 256;
|
||||
|
||||
/// <summary>
|
||||
/// The input tensor
|
||||
/// The input tensor.
|
||||
/// </summary>
|
||||
private float[] X;
|
||||
|
||||
/// <summary>
|
||||
/// The weights tensor
|
||||
/// The weights tensor.
|
||||
/// </summary>
|
||||
private float[] W;
|
||||
|
||||
/// <summary>
|
||||
/// The bias tensor
|
||||
/// The bias tensor.
|
||||
/// </summary>
|
||||
private float[] B;
|
||||
|
||||
/// <summary>
|
||||
/// The result tensor
|
||||
/// The result tensor.
|
||||
/// </summary>
|
||||
private float[] Y;
|
||||
|
||||
/// <summary>
|
||||
/// The input tensor
|
||||
/// The input tensor.
|
||||
/// </summary>
|
||||
private ReadOnlyBuffer<float> BufferX;
|
||||
|
||||
/// <summary>
|
||||
/// The weights tensor
|
||||
/// The weights tensor.
|
||||
/// </summary>
|
||||
private ReadOnlyBuffer<float> BufferW;
|
||||
|
||||
/// <summary>
|
||||
/// The bias tensor
|
||||
/// The bias tensor.
|
||||
/// </summary>
|
||||
private ReadOnlyBuffer<float> BufferB;
|
||||
|
||||
/// <summary>
|
||||
/// The result tensor
|
||||
/// The result tensor.
|
||||
/// </summary>
|
||||
private ReadWriteBuffer<float> BufferY;
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="System.Random"/> instance to initialize the tensors
|
||||
/// A <see cref="System.Random"/> instance to initialize the tensors.
|
||||
/// </summary>
|
||||
private readonly Random Random = new Random();
|
||||
|
||||
/// <summary>
|
||||
/// Initial setup for a benchmarking session
|
||||
/// Initial setup for a benchmarking session.
|
||||
/// </summary>
|
||||
[GlobalSetup]
|
||||
public void Setup()
|
||||
@@ -94,7 +94,7 @@ namespace ComputeSharp.Benchmark
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears the memory from the current session
|
||||
/// Clears the memory from the current session.
|
||||
/// </summary>
|
||||
[GlobalCleanup]
|
||||
public void Dispose()
|
||||
@@ -111,9 +111,9 @@ namespace ComputeSharp.Benchmark
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see langword="float"/> array of the specified size
|
||||
/// Creates a new <see langword="float"/> array of the specified size.
|
||||
/// </summary>
|
||||
/// <param name="size">The size of the new random array to create</param>
|
||||
/// <param name="size">The size of the new random array to create.</param>
|
||||
[Pure]
|
||||
private float[] CreateRandomArray(int size)
|
||||
{
|
||||
@@ -128,19 +128,19 @@ namespace ComputeSharp.Benchmark
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs a fully connected forward operation on the CPU
|
||||
/// Runs a fully connected forward operation on the CPU.
|
||||
/// </summary>
|
||||
[Benchmark(Baseline = true)]
|
||||
public void Cpu() => Dnn.FullyConnectedForwardCpu(C, N, M, P, X, W, B, Y);
|
||||
|
||||
/// <summary>
|
||||
/// Runs a fully connected forward operation on the GPU
|
||||
/// Runs a fully connected forward operation on the GPU.
|
||||
/// </summary>
|
||||
[Benchmark]
|
||||
public void GpuWithNoTemporaryBuffers() => Dnn.FullyConnectedForwardGpu(C, N, M, P, BufferX, BufferW, BufferB, BufferY);
|
||||
|
||||
/// <summary>
|
||||
/// Runs a fully connected forward operation on the GPU, creating temporary GPU buffers to perform the operations
|
||||
/// Runs a fully connected forward operation on the GPU, creating temporary GPU buffers to perform the operations.
|
||||
/// </summary>
|
||||
[Benchmark]
|
||||
public void GpuWithTemporaryBuffers()
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする