Skip to content

Fix Mono AOT LLVM #2539

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

Merged
merged 3 commits into from
Mar 8, 2024
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
14 changes: 7 additions & 7 deletions src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -571,19 +571,19 @@ private static Job CreateJobForGivenRuntime(Job baseJob, string runtimeId, Comma
return MakeWasmJob(baseJob, options, "net9.0", runtimeMoniker);

case RuntimeMoniker.MonoAOTLLVM:
return MakeMonoAOTLLVMJob(baseJob, options, RuntimeInformation.IsNetCore ? CoreRuntime.GetCurrentVersion().MsBuildMoniker : "net6.0");
return MakeMonoAOTLLVMJob(baseJob, options, RuntimeInformation.IsNetCore ? CoreRuntime.GetCurrentVersion().MsBuildMoniker : "net6.0", runtimeMoniker);

case RuntimeMoniker.MonoAOTLLVMNet60:
return MakeMonoAOTLLVMJob(baseJob, options, "net6.0");
return MakeMonoAOTLLVMJob(baseJob, options, "net6.0", runtimeMoniker);

case RuntimeMoniker.MonoAOTLLVMNet70:
return MakeMonoAOTLLVMJob(baseJob, options, "net7.0");
return MakeMonoAOTLLVMJob(baseJob, options, "net7.0", runtimeMoniker);

case RuntimeMoniker.MonoAOTLLVMNet80:
return MakeMonoAOTLLVMJob(baseJob, options, "net8.0");
return MakeMonoAOTLLVMJob(baseJob, options, "net8.0", runtimeMoniker);

case RuntimeMoniker.MonoAOTLLVMNet90:
return MakeMonoAOTLLVMJob(baseJob, options, "net9.0");
return MakeMonoAOTLLVMJob(baseJob, options, "net9.0", runtimeMoniker);

case RuntimeMoniker.Mono60:
return MakeMonoJob(baseJob, options, MonoRuntime.Mono60);
Expand Down Expand Up @@ -637,9 +637,9 @@ private static Job MakeMonoJob(Job baseJob, CommandLineOptions options, MonoRunt
packagesPath: options.RestorePath?.FullName)));
}

private static Job MakeMonoAOTLLVMJob(Job baseJob, CommandLineOptions options, string msBuildMoniker)
private static Job MakeMonoAOTLLVMJob(Job baseJob, CommandLineOptions options, string msBuildMoniker, RuntimeMoniker moniker)
{
var monoAotLLVMRuntime = new MonoAotLLVMRuntime(aotCompilerPath: options.AOTCompilerPath, aotCompilerMode: options.AOTCompilerMode, msBuildMoniker: msBuildMoniker);
var monoAotLLVMRuntime = new MonoAotLLVMRuntime(aotCompilerPath: options.AOTCompilerPath, aotCompilerMode: options.AOTCompilerMode, msBuildMoniker: msBuildMoniker, moniker: moniker);

var toolChain = MonoAotLLVMToolChain.From(
new NetCoreAppSettings(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class MonoAotLLVMRuntime : Runtime, IEquatable<MonoAotLLVMRuntime>
/// <summary>
/// creates new instance of MonoAotLLVMRuntime
/// </summary>
public MonoAotLLVMRuntime(FileInfo aotCompilerPath, MonoAotCompilerMode aotCompilerMode, string msBuildMoniker = "net6.0", string displayName = "MonoAOTLLVM") : base(RuntimeMoniker.MonoAOTLLVM, msBuildMoniker, displayName)
public MonoAotLLVMRuntime(FileInfo aotCompilerPath, MonoAotCompilerMode aotCompilerMode, string msBuildMoniker = "net6.0", string displayName = "MonoAOTLLVM", RuntimeMoniker moniker = RuntimeMoniker.MonoAOTLLVM) : base(moniker, msBuildMoniker, displayName)
{
if (aotCompilerPath == null)
throw new ArgumentNullException(paramName: nameof(aotCompilerPath));
Expand Down
2 changes: 1 addition & 1 deletion src/BenchmarkDotNet/Toolchains/Executor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private static ProcessStartInfo CreateStartInfo(BenchmarkCase benchmarkCase, Art
case MonoAotLLVMRuntime _:
start.FileName = exePath;
start.Arguments = args;
start.WorkingDirectory = artifactsPaths.BinariesDirectoryPath;
start.WorkingDirectory = Path.Combine(artifactsPaths.BinariesDirectoryPath, "publish");
break;
case CustomRuntime _:
start.FileName = exePath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ protected override void GenerateProject(BuildPartition buildPartition, Artifacts

protected override string GetExecutablePath(string binariesDirectoryPath, string programName)
=> Portability.RuntimeInformation.IsWindows()
? Path.Combine(binariesDirectoryPath, $"{programName}.exe")
: Path.Combine(binariesDirectoryPath, programName);
? Path.Combine(binariesDirectoryPath, "publish", $"{programName}.exe")
: Path.Combine(binariesDirectoryPath, "publish", programName);

protected override string GetBinariesDirectoryPath(string buildArtifactsDirectoryPath, string configuration)
=> Path.Combine(buildArtifactsDirectoryPath, "bin", configuration, TargetFrameworkMoniker, CustomDotNetCliToolchainBuilder.GetPortableRuntimeIdentifier(), "publish");
=> Path.Combine(buildArtifactsDirectoryPath, "bin", configuration, TargetFrameworkMoniker, CustomDotNetCliToolchainBuilder.GetPortableRuntimeIdentifier());
}
}