-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Optimize CoreCLR Helix runs by pruning the CORE_ROOT folder content #35243
Conversation
This change limits the content of CORE_ROOT by removing some of the unused artifacts, most notably the sharedFramework subfolder that is not used by CoreCLR tests at all. The aim of this change is to optimize the execution of CoreCLR tests in Helix where according to Jarret's findings a large amount of time gets spent just downloading and unpacking the test payloads. Thanks Tomas
Basic testing mostly seems to work, I need to run CG1 / CG2 and more tests but the AzDO job scheduling is currently experiencing some authentication issues so I need to wait on that. According to my local measurements this trims CORE_ROOT to about one half (less than 400 MB). |
|
||
<!-- Add binary dependencies to copy-local items --> | ||
<RunTimeDependencyCopyLocal | ||
Include="$(CoreCLRArtifactsPath)/%(RunTimeArtifactsIncludeFolders.Identity)*" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nit in these two lines: CoreCLRArtifactsPath should already contain a trailing /
:
runtime/eng/liveBuilds.targets
Line 4 in 4034228
<CoreCLRArtifactsPath Condition="'$(CoreCLROverridePath)' != ''">$([MSBuild]::NormalizeDirectory('$(CoreCLROverridePath)'))</CoreCLRArtifactsPath> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing that out, fixed in 2nd commit.
<RunTimeDependencyCopyLocal | ||
Include="$(CoreCLRArtifactsPath)/%(RunTimeArtifactsIncludeFolders.Identity)*" | ||
Exclude="@(RunTimeArtifactsExcludeFiles -> '$(CoreCLRArtifactsPath)/%(Identity)')"> | ||
<TargetDir>%(RunTimeArtifactsIncludeFolders.Identity)</TargetDir> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could simplify this by setting the metadata inline. I.e:
<RunTimeDependencyCopyLocal
Include="$(CoreCLRArtifactsPath)/%(RunTimeArtifactsIncludeFolders.Identity)*"
Exclude="@(RunTimeArtifactsExcludeFiles -> '$(CoreCLRArtifactsPath)/%(Identity)')"
TargetDir="%(RuntimeArtifactsIncludeFolders.Identity)" />
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for teaching me MSBuild, I never knew that :D. Fixed in 2nd commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logic-wise looks good to me. Don't know much about the coreclr tests but as long as they're green feel free to merge 😄
<RunTimeDependencyCopyLocalFile Include="@(AllResolvedRuntimeDependencies)" Exclude="@(RunTimeDependencyExcludeFiles)"/> | ||
<RunTimeDependencyCopyLocal Include="@(RunTimeDependencyCopyLocalFile -> '%(File)')" /> | ||
<RunTimeDependencyCopyLocal Include="$(TargetingPackPath)/*" /> | ||
|
||
<RunTimeArtifactsExcludeFiles Include="protononjit.dll" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That change affects @dotnet/jit-contrib team workflow because now we don't have these altjits in CoreRoot after running src\coreclr\build-test.cmd
.
I remember there was an environment variable, like ci
or similar to distinguish runs in ci from local runs, could that be used to make optimizations in this PR only when it is set and do not affect others?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I was curious what would break :-). Will fix. Can you point me to some pipeline or script I can run to verify the change? Other than that, if this is just about the protononjit / linuxonjit binaries, these aren't very long so I guess we can put them back unconditionally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check that these altjit.dlls are in the Core_Root. I am not sure if any additional verification is needed, but you can build an individual test and try to run it:
set ARCH=x86
set MODE=Checked
set RUNTIME_PATH=F:\git\runtime
%RUNTIME_PATH%\src\coreclr\build-test.cmd skipnative skipmanaged %ARCH% %MODE% /p:LibrariesConfiguration=Release
REM build a test
%RUNTIME_PATH%\.dotnet\dotnet.exe msbuild /p:TargetArchitecture=%ARCH% /p:Configuration=%MODE% /p:LibrariesConfiguration=Release %RUNTIME_PATH%\src\coreclr\tests\src\JIT\Regression\JitBlue\Runtime_33884\Runtime_33884.csproj
set COMPlus_AltJit=*
set COMPlus_AltJitName=protononjit.dll
set CORE_ROOT=%RUNTIME_PATH%\artifacts\tests\coreclr\Windows_NT.%ARCH%.%MODE%\Tests\CORE_ROOT
REM run the test with altjit
%RUNTIME_PATH%\artifacts\tests\coreclr\Windows_NT.x86.Checked\JIT\Regression\JitBlue\Runtime_33884\Runtime_33884\Runtime_33884.cmd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, great. Just tried this (on x64 that I have a complete build for readily available) and I do see some difference - the test you mentioned passes with the normal JIT, with the protononjit it crashes as follows:
BEGIN EXECUTION "d:\git\runtime2\artifacts\tests\coreclr\Windows_NT.x64.Checked\tests\Core_Root\corerun.exe" Runtime_33884.dll Assert failure(PID 12860 [0x0000323c], Thread: 14480 [0x3890]): Assertion failed 'tree->IsLocal() || (tree->OperGet() == GT_RET_EXPR) || (tree->OperGet() == GT_CALL) || ((tree->gtOper == GT_ADDR) && varTypeIsSIMD(tree->gtGetOp1()))' in 'System.SpanHelpers:IndexOf(byref,ushort,int):int' during 'Importation' (IL size 899) File: D:\git\runtime2\src\coreclr\src\jit\simd.cpp Line: 1197 Image: d:\git\runtime2\artifacts\tests\coreclr\Windows_NT.x64.Checked\tests\Core_Root\CoreRun.exe Expected: 100 Actual: -1073740286 END EXECUTION - FAILED FAILED
Is that the expected behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the expected behavior because the SIMD size is different. It should work if you set COMPlus_SIMD16ByteOnly=1
@trylek It looks like this change broke Windows arm32/arm64 R2R outerloop legs: with errors like:
|
This change limits the content of CORE_ROOT by removing some of the
unused artifacts, most notably the sharedFramework subfolder that
is not used by CoreCLR tests at all. The aim of this change is
to optimize the execution of CoreCLR tests in Helix where according
to Jarret's findings a large amount of time gets spent just
downloading and unpacking the test payloads.
In technical terms I have slightly changed the semantics of the target
CreateTestOverlay (or rather of its dependent target
CopyDependencyToCoreRoot) so that it also copies over
the appropriate binary artifacts. This let me simplify the cmd / sh
script logic and introduce common filtering at the MSBuild level.
Thanks
Tomas