diff --git a/samples/ComputeSharp.Benchmark/Dispatching/DispatchingBenchmark.cs b/samples/ComputeSharp.Benchmark/Dispatching/DispatchingBenchmark.cs index dc85822e..a757d8fe 100644 --- a/samples/ComputeSharp.Benchmark/Dispatching/DispatchingBenchmark.cs +++ b/samples/ComputeSharp.Benchmark/Dispatching/DispatchingBenchmark.cs @@ -1,11 +1,13 @@ using System; using BenchmarkDotNet.Attributes; +using BenchmarkDotNet.Configs; namespace ComputeSharp.Benchmark.Blas; /// /// A that benchmarks the shader dispatch times. /// +[GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByCategory)] public partial class DispatchingBenchmark : IDisposable { /// @@ -29,11 +31,34 @@ public partial class DispatchingBenchmark : IDisposable Buffer!.Dispose(); } + /// + /// Invokes a single shader, manually. + /// + [Benchmark(Baseline = true)] + [BenchmarkCategory("SINGLE")] + public void Compute_Single() + { + GraphicsDevice.Default.For(64, new TestShader(Buffer!)); + } + + /// + /// Invokes a single shader through a compute context. + /// + [Benchmark] + [BenchmarkCategory("SINGLE")] + public void Compute_Single_WithContext() + { + using var context = GraphicsDevice.Default.CreateComputeContext(); + + context.For(64, new TestShader(Buffer!)); + } + /// /// Invokes two empty compute shaders one by one. /// [Benchmark(Baseline = true)] - public void Compute_Single() + [BenchmarkCategory("MULTIPLE")] + public void Compute_Multiple() { GraphicsDevice.Default.For(64, new TestShader(Buffer!)); GraphicsDevice.Default.For(64, new TestShader(Buffer!)); @@ -43,7 +68,8 @@ public partial class DispatchingBenchmark : IDisposable /// Invokes two empty compute shaders in a batch. /// [Benchmark] - public void Compute_Batched() + [BenchmarkCategory("MULTIPLE")] + public void Compute_Multiple_WithContext() { using var context = GraphicsDevice.Default.CreateComputeContext();