Skip to content

Parallel build#3133

Merged
xen2 merged 4 commits intomasterfrom
feature/parallel-build
Apr 24, 2026
Merged

Parallel build#3133
xen2 merged 4 commits intomasterfrom
feature/parallel-build

Conversation

@xen2
Copy link
Copy Markdown
Member

@xen2 xen2 commented Apr 14, 2026

PR Details

Parallel MSBuild in CI

This PR re-enables parallel MSBuild (-maxcpucount) across the build and test workflows that had been pinned to -m:1 as a workaround for race conditions.

In practice, CI builds seems 10–30% faster.

What changed

  • CI workflows: dropped -m:1 from build/test workflows (runtime, tests, platform builds) — they now run at full CPU parallelism by default like a normal dotnet build.
  • Stride.Build.Sdk: fixed the underlying parallel-build races in Stride.GraphicsApi.InnerBuild.targets + Stride.AssemblyProcessor.targets + Sdk.targets so projects can be safely built in parallel regardless of whether you use single-API, multi-API, or platform-specific configurations.
  • Adding a new graphics-API-dependent library now requires two coordinated edits: set <StrideGraphicsApiDependent>true</StrideGraphicsApiDependent> in the csproj and register the project in the SDK's list (new). The SDK validates this at build time and errors with a clear message pointing to the missing part (if any).

Verified

  • Windows Runtime (Direct3D11 / Direct3D12 / Vulkan)
  • Windows Full
  • iOS / Linux / Assembly Processor / VS Package
  • Windows Tests (Simple, Game Common, Game per-API)
  • Linux Tests (Simple, Game Common, Game Vulkan)
  • Multi-API builds (-p:StrideGraphicsApis=Direct3D11;Direct3D12;Vulkan)
  • Release workflows (release.yml, release-launcher.yml, release-vspackage.yml) — unchanged since msbuild /m was already enabling parallelism

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have built and run the editor to try this change out.

@xen2 xen2 marked this pull request as ready for review April 14, 2026 08:43
@xen2 xen2 force-pushed the master branch 2 times, most recently from ab329f3 to 482bd28 Compare April 16, 2026 07:56
@xen2 xen2 force-pushed the feature/parallel-build branch 5 times, most recently from 0e90097 to 47d25bd Compare April 23, 2026 05:55
xen2 added 3 commits April 23, 2026 14:59
…ojects

Drop Pack from _StrideProjectReferenceGraphicsApiDependent's MSBuild dispatch. Pack re-entry was a source of 'same project built twice with different globals' under parallel MSBuild; the normal ProjectReference walk handles Build, and Pack runs separately on consuming projects. With Pack gone, the explicit Targets attribute is redundant (Build is the default).

Set StrideSkipAutoPack=true on test projects — they don't produce their own .nupkg. Add StrideSkipAutoPack to GlobalPropertiesToRemove on the Stride.Core.Assets.CompilerApp ProjectReference so the property stays local: CompilerApp still needs its own .nupkg in bin\packages\ for the test's AssetCompiler run.
Non-API-dependent middle projects (e.g. Stride.Engine, built with default API) re-export the wrong-variant ssdeps through the reference graph; under parallel MSBuild the direct API-dependent reference races with the transitive one on the same output filename.
@xen2 xen2 force-pushed the feature/parallel-build branch 5 times, most recently from 9b9958e to aa9b560 Compare April 24, 2026 03:38
…ches

Fixes obj/ file-lock races between competing cache entries that targeted
the same per-project obj path. Two independent sources of cache-key
divergence were aligning on the output path but not on the project
instance:

1. StrideGraphicsApi propagation through ProjectReferences:
   _MSBuildProjectReferenceExistent includes transitive refs auto-promoted
   from project.assets.json by the .NET SDK — those items don't carry any
   per-ref attribute, so classify refs by target filename against a central
   list instead. API-dep refs get StrideGraphicsApi via AdditionalProperties
   (cache-key-contributing); non-API-dep refs strip it so different-API
   callers collapse to one cache entry per (project, TF).

2. Stride.Core.CompilerServices analyzer ref:
   The explicit SetTargetFramework="TargetFramework=netstandard2.0" was
   redundant (CompilerServices is single-TF netstandard2.0) and also put
   TargetFramework into the consumer-ref dispatch globals, creating a
   cache entry distinct from the slnf-direct outer dispatch. Both entries
   then raced on the same obj/ path. Manifested most visibly in
   test-*-simple.yml CI where many small test projects referenced the
   analyzer and slnf also built it directly.

Also: unescape StrideGraphicsApis so a command-line '%3B' separator
survives as real item splits in multi-API builds; drop the competing
no-SGA query-dispatch cache entry created by _ComputeTargetFrameworkItems.
@xen2 xen2 force-pushed the feature/parallel-build branch from aa9b560 to 15e2c18 Compare April 24, 2026 05:49
@xen2 xen2 merged commit e098bc8 into master Apr 24, 2026
33 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant