JitBench icon indicating copy to clipboard operation
JitBench copied to clipboard

Discussion: Using custom crossgen for JitBench

Open vkvenkat opened this issue 8 years ago • 7 comments

I'm looking for a way to force the dotnet store in AspNet-GenerateStore.ps1 to pickup a custom crossgen (say, available at D:\coreclr\bin\Product\Windows_NT.x64.Release) to generate native images, rather than use the version pulled in to JitBench\.temp\Optimize\netcoreapp. Any suggestions for this? @rynowak @litian2025

vkvenkat avatar Sep 27 '17 03:09 vkvenkat

The best place to ask for this might be https://github.com/dotnet/sdk - I neither work on the SDK nor the CLR so I don't have much experience for the workflow of using custom builds.

The msbuild file that fundamentally runs the store is here: https://github.com/dotnet/sdk/blob/b5aa4a2b0db4f6203050063139e1873fa024337a/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.ComposeStore.targets


/cc @eerhardt @JosephTremoulet in case they have any ideas about the best way to proceed

rynowak avatar Sep 27 '17 05:09 rynowak

Thanks for the pointer! I'll ask there and reply back once I have my solution.

vkvenkat avatar Sep 27 '17 05:09 vkvenkat

FWIW, when I want to use a custom clrjit.dll, then, working in the dev branch of JitBench, I just copy clrjit.dll out of D:\coreclr\bin\Product\Windows_NT.x64.Release over top of the copy under the local .dotnet directory. I'd imagine the same would work for crossgen.exe.

JosephTremoulet avatar Sep 27 '17 12:09 JosephTremoulet

The crossgen executable that dotnet store uses is resolved from the runtime.{RID}.Microsoft.NETCore.App NuGet package. See

https://github.com/dotnet/sdk/blob/cd25d6bbfc2aac61cc790c511900427ac64fdaa8/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.CrossGen.targets#L60-L89

I tried overwriting the /p:CrossgenDir property on the command line, but that doesn't work since these properties are being set in a Target, and unconditionally set. If we wanted to support this scenario more, we could change that code to check if the property was already defined.

I haven't tried @JosephTremoulet's recommendation, but that sounds reasonable - overwriting the file in the NuGet cache, which is where dotnet store will pick it up from. ex. C:\Users\eerhardt\.nuget\packages\runtime.win-x64.microsoft.netcore.app\2.0.0\runtimes\win-x64\native\..\..\..\tools.

eerhardt avatar Sep 27 '17 13:09 eerhardt

Thanks for the suggestions! Overwriting the crossgen executable at C:\Users\Varun\.nuget\packages\runtime.win-x64.microsoft.netcore.app\2.1.0-preview2-25616-02\tools was the easiest fix for this.

vkvenkat avatar Sep 27 '17 16:09 vkvenkat

Cool, glad you found a solution.

I'm re-opening this to track updating the docs to explain this. If you this suggestion please file an issue on SDK so they can track the feedback.

rynowak avatar Sep 27 '17 19:09 rynowak

Done: #1614

vkvenkat avatar Sep 27 '17 23:09 vkvenkat