-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More vectorization of Shishua, .NET 8, use standard intrinsics API (#1)
- Loading branch information
1 parent
1be51d3
commit ffd97e9
Showing
42 changed files
with
298 additions
and
7,825 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"dotnet.defaultSolution": "Fast.PRNGs.sln" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
benchmark/Fast.PRNGs.Benchmarks/Internals/ToDoubleBenchmarks.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
namespace Fast.PRNGs.Benchmarks.Internals; | ||
|
||
[ConfigSource] | ||
public class ToDoublesBenchmark | ||
{ | ||
internal const ulong DoubleMask = (1L << 53) - 1; | ||
internal const double Norm53 = 1.0d / (1L << 53); | ||
|
||
[Params(31512512431231UL)] | ||
public ulong Value { get; set; } | ||
|
||
[Benchmark] | ||
public double Original() | ||
{ | ||
return (Value & DoubleMask) * Norm53; | ||
} | ||
|
||
[Benchmark] | ||
public double New() | ||
{ | ||
return (Value >> 11) * (1.0 / (1ul << 53)); | ||
} | ||
|
||
private class ConfigSourceAttribute : Attribute, IConfigSource | ||
{ | ||
public IConfig Config { get; } | ||
|
||
public ConfigSourceAttribute() => Config = new SimpleBenchConfig(8); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace Fast.PRNGs.Benchmarks; | ||
|
||
internal sealed class SimpleBenchConfig : ManualConfig | ||
{ | ||
public SimpleBenchConfig(ulong? byteSizePerIteration = null) | ||
{ | ||
this.SummaryStyle = SummaryStyle.Default.WithRatioStyle(RatioStyle.Trend); | ||
this.AddColumn(RankColumn.Arabic); | ||
this.Orderer = new DefaultOrderer(SummaryOrderPolicy.SlowestToFastest, MethodOrderPolicy.Declared); | ||
if (byteSizePerIteration != null) | ||
this.AddColumn(new ThroughputColumn(byteSizePerIteration.Value)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using BenchmarkDotNet.Running; | ||
|
||
namespace Fast.PRNGs.Benchmarks; | ||
|
||
public class ThroughputColumn : IColumn | ||
{ | ||
public string Id { get; } | ||
|
||
public string ColumnName { get; } | ||
|
||
private readonly ulong _byteSizePerIteration; | ||
|
||
public ThroughputColumn(ulong byteSizePerIteration) | ||
{ | ||
ColumnName = "Throughput"; | ||
Id = nameof(TagColumn) + "." + ColumnName; | ||
|
||
_byteSizePerIteration = byteSizePerIteration; | ||
} | ||
|
||
public bool IsDefault(Summary summary, BenchmarkCase benchmarkCase) => false; | ||
public string GetValue(Summary summary, BenchmarkCase benchmarkCase) | ||
{ | ||
var stats = summary[benchmarkCase].ResultStatistics; | ||
if (stats is null || stats.Mean == default || double.IsNaN(stats.Mean)) | ||
return "?"; | ||
|
||
var gbs = (_byteSizePerIteration / 1e9d) / (stats.Mean / 1e9d); | ||
return $"{gbs:0.00} GB/s"; | ||
} | ||
|
||
public bool IsAvailable(Summary summary) => true; | ||
public bool AlwaysShow => true; | ||
public ColumnCategory Category => ColumnCategory.Metric; | ||
public int PriorityInCategory => 0; | ||
public bool IsNumeric => true; | ||
public UnitType UnitType => UnitType.Size; | ||
public string Legend => $"Throughput in GB/s"; | ||
public string GetValue(Summary summary, BenchmarkCase benchmarkCase, SummaryStyle style) => GetValue(summary, benchmarkCase); | ||
public override string ToString() => ColumnName; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
{ | ||
"sdk": { | ||
"version": "7.0.201", | ||
"rollForward": "latestFeature" | ||
"version": "8.0.100-preview.5.23303.2", | ||
"rollForward": "latestFeature", | ||
"allowPrerelease": true | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.