Repository navigation
Invoke vcvarsall only once before windows compilation - #4570
Conversation
📦 Try the packages from this PRWarning Do not run these scripts without first reviewing the code in this PR. Step 1 — Download the packages bash / macOS / Linux: curl -fsSL https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.sh | bash -s -- 4570PowerShell / Windows: iex "& { $(irm https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.ps1) } 4570"Step 2 — Add the local NuGet source dotnet nuget add source ~/.skiasharp/hives/pr-4570/packages --name skiasharp-pr-4570More options
Or download manually from Azure Pipelines — look for the Remove the source when you're done: dotnet nuget remove source skiasharp-pr-4570 |
|
Hey there @@mmitche! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
|
Cold-cache timing results from Azure build 1531532 on
All three jobs were explicit cache misses. Portable, SHA-verified Spectre library provisioning succeeded in 9-12 seconds. The pool move plus |
|
Starting the isolation run requested after build 1531532: this revision keeps the same |
|
Default-Ninja isolation results from cold-cache build 1531647, compared with the same NetCore-Public pool using
Against the original Azure Pipelines baseline, default Ninja on NetCore-Public was essentially flat for x86 (50:18 vs 49:52), but improved x64 by 21.1% (36:44 vs 46:33) and ARM64 by 18.3% (36:52 vs 45:06). Conclusion: hard-coding |
|
Local follow-up results for the Windows native build:
Conclusion: removing repeated |
|
Reworked the draft in commit d806da6: restored the original Windows pool, removed the old pool/PCH/oversubscription prototype, and pushed the architecture-scoped one-time vcvars implementation. CI should now measure this change in isolation. |
|
Thanks so much for this, I am working on this to move all builds to use the netcore-public agents where possible: #4565 Looking forward to faster starting, and faster BUILDING things. |
|
Formalized the experiment in commit
This remains confined to the existing draft PR for CI testing. No separate mono/skia PR has been opened pending confirmation. |
|
Removed the custom |
Original-pool CI result — build 1532137The formalized one-time
Validation from the task logs:
This confirms the repeated per-edge Visual Studio setup was responsible for roughly half of the original Windows native build duration. No mono/skia PR has been opened pending confirmation. |
📦 Artifact size reportPackages from this PR (build Total Packages
+37 package(s) unchanged (< 50.0 KB). Per-file changes
|
| File | Size |
|---|---|
runtimes/win-x64/native/libHarfBuzzSharp.pdb |
22.0 MB → 21.8 MB (🟢 −240.0 KB) |
runtimes/win-arm64/native/libHarfBuzzSharp.pdb |
22.3 MB → 22.3 MB (🟢 −8.0 KB) |
runtimes/win-x86/native/libHarfBuzzSharp.pdb |
22.0 MB → 21.9 MB (🟢 −8.0 KB) |
SkiaSharp.NativeAssets.WinUI
| File | Size |
|---|---|
runtimes/win-x64/native/libGLESv2.pdb |
66.7 MB → 66.4 MB (🟢 −256.0 KB) |
runtimes/win-arm64/native/libGLESv2.pdb |
64.5 MB → 64.3 MB (🟢 −208.0 KB) |
runtimes/win-x86/native/libGLESv2.pdb |
67.2 MB → 67.0 MB (🟢 −208.0 KB) |
runtimes/win-x64/native/libEGL.pdb |
6.4 MB → 6.3 MB (🟢 −32.0 KB) |
runtimes/win-x86/native/libEGL.pdb |
6.5 MB → 6.5 MB (🟢 −16.0 KB) |
runtimes/win-arm64/native/SkiaSharp.Views.WinUI.Native.pdb |
67.7 MB → 67.7 MB (🟢 −8.0 KB) |
runtimes/win-x64/native/SkiaSharp.Views.WinUI.Native.pdb |
68.0 MB → 68.0 MB (🟢 −8.0 KB) |
🧬 win-x64 (runtimes/win-x64/native/libGLESv2.dll) |
4.9 MB → 4.9 MB (🔴 +2.0 KB) |
🧬 win-arm64 (runtimes/win-arm64/native/libGLESv2.dll) |
4.4 MB → 4.4 MB (🔴 +1.0 KB) |
Informational only — this never blocks the PR. Native binaries are labelled by os/arch.
|
The corresponding Skia change is now open as mono/skia#306: mono/skia#306. This PR will move its submodule back to mono/skia after that change merges. |
|
@mmitche I merged the skia PR, you can update the submodule |
mattleibow
left a comment
There was a problem hiding this comment.
LGTM + the one submodule thing.
| [submodule "externals/skia"] | ||
| path = externals/skia | ||
| url = https://github.com/mono/skia.git | ||
| url = https://github.com/mmitche/skia.git |
There was a problem hiding this comment.
May need to revert this.
|
mono/skia#306 has merged. Commit |
Update to the merged Skia toolchain optimization and initialize the architecture-specific Visual C++ environment once before invoking Ninja. Co-authored-by: Copilot <[email protected]> Copilot-Session: eff0dd62-bdd5-40c3-89ea-7edf50c82b76
0027ea8 to
db99544
Compare
|
Final validation passed on the squashed one-commit PR ( |
[Windows] Stop pinning a Windows SDK version by default (#4588) Context: #4588 Context: 7c23c53 Follow-up: #4589 The benchmark-source (windows-latest, Windows, native/windows) leg of Track - Benchmarks died the instant it began the native build: Done. Made 114 targets from 63 files in 358ms Initializing the Visual C++ environment once for amd64. An error occurred when executing task 'libSkiaSharp'. Error: Process 'cmd.exe' failed with error: 1 RunNinjaWithVcVars invoked vcvarsall.bat with the default of the windowsSdkVersion argument, 10.0.22621.0, which matches the AzDO agents. The hosted runner is windows-2025-vs2026 and ships only Windows SDK 10.0.26100.0, and vcvarsall hard-fails on an SDK that is not installed: [ERROR:winsdk.bat] Windows SDK 10.0.22621.0 : 'C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um' not found or was incomplete Nothing needed that default. Before the MSVC environment was initialized explicitly there was no such argument at all: gn resolved win_sdk_version itself and the toolchain interpolated that resolved value into the vcvarsall command it generated, so the version was always one that existed on the machine and the two could never disagree. Hardcoding a constant only meant the build broke wherever that exact SDK was absent - this runner today, and equally a developer box carrying just a newer one. Default the argument to empty and omit it from both gn and vcvarsall when unset, so each detects an SDK that is present. Setting it still pins both together, so --windowsSdkVersion remains available to build against a specific SDK. * drop the `>nul` that hid the failure. It suppressed the vcvarsall banner, but `>nul` redirects only stdout and VsDevCmd writes its errors there too, so it discarded the diagnosis along with the banner - rerunning with `2>nul` still prints the [ERROR:winsdk.bat] lines, while `>nul` yields nothing but the exit code. The banner is five lines per architecture and worth keeping in the log. * this went unnoticed because benchmark-source runs on pull requests only and is skipped on main, so #4570 merged green without the path ever being exercised. * whether the vcvarsall call is needed at all is left open in #4589: every tool is invoked by absolute path and gn emits the SDK include and lib directories as explicit -imsvc and /LIBPATH: flags, so it may be redundant for our LLVM-based configuration. Co-authored-by: Matthew Leibowitz <[email protected]> Co-authored-by: Copilot App <[email protected]>
[Windows] Initialize the MSVC environment once per native build (#4570) Context: #4570 Skia change: mono/skia#306 Update the Skia submodule to remove per-edge vcvarsall invocation, then initialize the architecture-specific Visual C++ environment once before launching Ninja. Split GN generation from Ninja execution so Windows can capture the required MSVC and Windows SDK environment without changing other native build paths. Running vcvarsall for every compile, archive, and link edge added substantial process overhead. Clean hosted-agent builds for x86, x64, and ARM64 completed successfully with one initialization per job and reduced native build times by 54–57%. Co-authored-by: Matt Mitchell (.NET) <[email protected]> Co-authored-by: Matthew Leibowitz <[email protected]> Co-authored-by: Alexander Köplinger <[email protected]> Co-authored-by: Copilot <[email protected]>
[Windows] Stop pinning a Windows SDK version by default (#4588) Context: #4588 Context: 7c23c53 Follow-up: #4589 The benchmark-source (windows-latest, Windows, native/windows) leg of Track - Benchmarks died the instant it began the native build: Done. Made 114 targets from 63 files in 358ms Initializing the Visual C++ environment once for amd64. An error occurred when executing task 'libSkiaSharp'. Error: Process 'cmd.exe' failed with error: 1 RunNinjaWithVcVars invoked vcvarsall.bat with the default of the windowsSdkVersion argument, 10.0.22621.0, which matches the AzDO agents. The hosted runner is windows-2025-vs2026 and ships only Windows SDK 10.0.26100.0, and vcvarsall hard-fails on an SDK that is not installed: [ERROR:winsdk.bat] Windows SDK 10.0.22621.0 : 'C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um' not found or was incomplete Nothing needed that default. Before the MSVC environment was initialized explicitly there was no such argument at all: gn resolved win_sdk_version itself and the toolchain interpolated that resolved value into the vcvarsall command it generated, so the version was always one that existed on the machine and the two could never disagree. Hardcoding a constant only meant the build broke wherever that exact SDK was absent - this runner today, and equally a developer box carrying just a newer one. Default the argument to empty and omit it from both gn and vcvarsall when unset, so each detects an SDK that is present. Setting it still pins both together, so --windowsSdkVersion remains available to build against a specific SDK. * drop the `>nul` that hid the failure. It suppressed the vcvarsall banner, but `>nul` redirects only stdout and VsDevCmd writes its errors there too, so it discarded the diagnosis along with the banner - rerunning with `2>nul` still prints the [ERROR:winsdk.bat] lines, while `>nul` yields nothing but the exit code. The banner is five lines per architecture and worth keeping in the log. * this went unnoticed because benchmark-source runs on pull requests only and is skipped on main, so #4570 merged green without the path ever being exercised. * whether the vcvarsall call is needed at all is left open in #4589: every tool is invoked by absolute path and gn emits the SDK include and lib directories as explicit -imsvc and /LIBPATH: flags, so it may be redundant for our LLVM-based configuration. Co-authored-by: Matthew Leibowitz <[email protected]> Co-authored-by: Copilot App <[email protected]>
Summary
Initialize the architecture-specific Visual C++ environment once before invoking Ninja for Windows SkiaSharp native builds.
The corresponding Skia change has merged as mono/skia#306. It removes the redundant
vcvarsall.batprefix from every Windows GN compile, archive, and link edge. This PR updates SkiaSharp to that merged commit and invokes one direct command per architecture:Architecture mappings:
amd64_x86amd64amd64_arm64The build remains on the original
Azure Pipelines / windows-2022pool with Ninja's default parallelism.Results
Validated in Azure build 1532137:
libSkiaSharpFor each architecture:
vcvarsall.bat.Additional validation
Skia remains independently buildable on Windows without running
vcvarsall: GN emits absolute compiler/linker paths and explicit MSVC and Windows SDK include/library paths. Standalone clang-cl and MSVC compile/relink tests succeeded withINCLUDE,LIB, andVCINSTALLDIRunset.The final merged-submodule integration is being validated in Azure build 1532412.