Skip to content

Commit

Permalink
Fix Mono AOT LLVM (#2539)
Browse files Browse the repository at this point in the history
* Attempt at fixing Mono AOT LLVM

* Ensure runtime moniker is preserved

* Missed to update one spot
  • Loading branch information
caaavik-msft committed Mar 8, 2024
1 parent 63626bb commit 9a9d7e7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
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());
}
}

0 comments on commit 9a9d7e7

Please sign in to comment.