diff --git a/samples/ComputeSharp.Benchmark/Dnn.cs b/samples/ComputeSharp.Benchmark/Dnn.cs
index 4e5a6c8c..bcf8a938 100644
--- a/samples/ComputeSharp.Benchmark/Dnn.cs
+++ b/samples/ComputeSharp.Benchmark/Dnn.cs
@@ -22,7 +22,7 @@ namespace ComputeSharp.Benchmark
/// The result tensor
public static void FullyConnectedForwardCpu(int c, int n, int m, int p, float[] x, float[] w, float[] b, float[] y)
{
- void Kernel(int s)
+ Parallel.For(0, c, s =>
{
ref float rx = ref x[s * n * m];
ref float rw = ref w[0];
@@ -43,9 +43,7 @@ namespace ComputeSharp.Benchmark
Unsafe.Add(ref ry, i * p + j) = result + Unsafe.Add(ref rb, j);
}
}
- }
-
- Parallel.For(0, c, Kernel);
+ });
}
///
@@ -66,7 +64,7 @@ namespace ComputeSharp.Benchmark
using ReadOnlyBuffer b_gpu = Gpu.Default.AllocateReadOnlyBuffer(b);
using ReadWriteBuffer y_gpu = Gpu.Default.AllocateReadWriteBuffer(y);
- void Kernel(ThreadIds id)
+ Gpu.Default.For(c, n, p, id =>
{
float result = 0f;
@@ -76,9 +74,7 @@ namespace ComputeSharp.Benchmark
}
y_gpu[(uint)(id.X * n * p + id.Y * p + id.Z)] = result + b_gpu[id.Z];
- }
-
- Gpu.Default.For(c, n, p, Kernel);
+ });
y_gpu.GetData(y);
}