Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for LoongArch64. #1971

Merged
merged 2 commits into from
Mar 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ The measured data can be exported to different formats (md, html, csv, xml, json
*Supported runtimes:* .NET 5+, .NET Framework 4.6.1+, .NET Core 2.0+, Mono, NativeAOT
*Supported languages:* C#, F#, Visual Basic
*Supported OS:* Windows, Linux, macOS
*Supported architectures:* x86, x64, ARM, ARM64 and Wasm
*Supported architectures:* x86, x64, ARM, ARM64, Wasm and LoongArch64

## Features

Expand Down
2 changes: 1 addition & 1 deletion docs/articles/guides/console-args.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ dotnet run -c Release -- --filter * --runtimes netcoreapp2.0 netcoreapp2.1 --sta
* `--maxWidth` max parameter column width, the default is 20.
* `--envVars` colon separated environment variables (key:value).
* `--strategy` the RunStrategy that should be used. Throughput/ColdStart/Monitoring.
* `--platform` the Platform that should be used. If not specified, the host process platform is used (default). AnyCpu/X86/X64/Arm/Arm64.
* `--platform` the Platform that should be used. If not specified, the host process platform is used (default). AnyCpu/X86/X64/Arm/Arm64/LoongArch64.
* `--runOncePerIteration` run the benchmark exactly once per iteration.
* `--buildTimeout` build timeout in seconds.
* `--wasmEngine` full path to a java script engine used to run the benchmarks, used by Wasm toolchain.
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ The measured data can be exported to different formats (md, html, csv, xml, json
*Supported runtimes:* .NET 5+, .NET Framework 4.6.1+, .NET Core 2.0+, Mono, NativeAOT
*Supported languages:* C#, F#, Visual Basic
*Supported OS:* Windows, Linux, macOS
*Supported architectures:* x86, x64, ARM, ARM64 and Wasm
*Supported architectures:* x86, x64, ARM, ARM64, Wasm and LoongArch64

## Features

Expand Down
2 changes: 1 addition & 1 deletion src/BenchmarkDotNet/ConsoleArguments/CommandLineOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public class CommandLineOptions
[Option("strategy", Required = false, HelpText = "The RunStrategy that should be used. Throughput/ColdStart/Monitoring.")]
public RunStrategy? RunStrategy { get; set; }

[Option("platform", Required = false, HelpText = "The Platform that should be used. If not specified, the host process platform is used (default). AnyCpu/X86/X64/Arm/Arm64.")]
[Option("platform", Required = false, HelpText = "The Platform that should be used. If not specified, the host process platform is used (default). AnyCpu/X86/X64/Arm/Arm64/LoongArch64.")]
public Platform? Platform { get; set; }

[Option("runOncePerIteration", Required = false, Default = false, HelpText = "Run the benchmark exactly once per iteration.")]
Expand Down
9 changes: 7 additions & 2 deletions src/BenchmarkDotNet/Environments/Platform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public enum Platform
/// <summary>
/// S390x
/// </summary>
S390x
S390x,

/// <summary>
/// LOONGARCH64
/// </summary>
LoongArch64
}
}
}
2 changes: 1 addition & 1 deletion src/BenchmarkDotNet/Extensions/ConfigurationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ public static string ToConfig(this Platform platform)

public static string ToConfig(this Jit jit) => jit == Jit.LegacyJit ? "1" : "0";
}
}
}
3 changes: 3 additions & 0 deletions src/BenchmarkDotNet/Portability/RuntimeInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ public static Platform GetCurrentPlatform()
// https://github.com/dotnet/runtime/blob/d81ad044fa6830f5f31f6b6e8224ebf66a3c298c/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/System/Runtime/InteropServices/RuntimeInformation/Architecture.cs#L12-L13
const Architecture Wasm = (Architecture)4;
const Architecture S390x = (Architecture)5;
const Architecture LoongArch64 = (Architecture)6;

switch (ProcessArchitecture)
{
Expand All @@ -249,6 +250,8 @@ public static Platform GetCurrentPlatform()
return Platform.Wasm;
case S390x:
return Platform.S390x;
case LoongArch64:
return Platform.LoongArch64;
default:
throw new ArgumentOutOfRangeException();
}
Expand Down
1 change: 1 addition & 0 deletions tests/BenchmarkDotNet.Tests/ConfigParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ public void UserCanSpecifyEnvironmentVariables()
[InlineData(Platform.X64)]
[InlineData(Platform.Arm)]
[InlineData(Platform.Arm64)]
[InlineData(Platform.LoongArch64)]
public void UserCanSpecifyProcessPlatform(Platform platform)
{
var parsedConfig = ConfigParser.Parse(new[] { "--platform", platform.ToString() }, new OutputLogger(Output)).config;
Expand Down