Skip to content

Caching compiler: support binary additional texts - #84916

Merged
jjonescz merged 1 commit into
dotnet:mainfrom
jjonescz:84889-caching-AdditionalTextBinary
Aug 18, 2026
Merged

jjonescz merged 1 commit into
dotnet:mainfrom
jjonescz:84889-caching-AdditionalTextBinary

Conversation

@jjonescz

@jjonescz jjonescz commented Aug 17, 2026 •

Copy link
Copy Markdown
Member

Fixes #84889.

Microsoft Reviewers: Open in CodeFlow

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enables compiler-cache key generation for binary AdditionalFiles without decoding them as source text.

Changes:

  • Hashes command-line additional files as raw streams.
  • Adds file-stream access to AdditionalTextFile.
  • Tests binary-file cache hits and invalidation for C# and Visual Basic.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
AdditionalTextFile.cs Adds raw file-stream access.
DeterministicKeyBuilder.cs Hashes command-line additional-file bytes.
CompilationCacheBehaviorTests.cs Covers binary-file caching behavior.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@jjonescz
jjonescz enabled auto-merge (squash) August 18, 2026 08:18
@jjonescz
jjonescz merged commit abc68c2 into dotnet:main Aug 18, 2026
27 of 28 checks passed
@jjonescz
jjonescz deleted the 84889-caching-AdditionalTextBinary branch August 18, 2026 09:27
333fred added a commit that referenced this pull request Aug 24, 2026
* upstream/main: (730 commits)
  Improve recovery for repeated partial type modifiers (#84934)
  Add standalone C# LSP telemetry (#84874)
  Suppress AI artifact audit failure issues (#84925)
  Remove empty ExternalAccessAspNetCoreResources.resx (#84939)
  Update helix job monitor version (#84940)
  Add HasPendingUpdates to HotReloadService.Updates to be used in dotnet-watch (#84891)
  Add LocalizableBranches parameter for OneLocBuild (#84933)
  Pin version of Microsoft.CodeAnalysis.Analyzers (#84924)
  Centralize record and union keyword checks (#84928)
  Caching compiler: support binary additional texts (#84916)
  Remove unused AdditionalTextComparer (#84917)
  Remove Try-Both matching mode for unions. (#84897)
  Update CodeStyleAnalyzerVersion to 5.9.0 (#84919)
  Fix/84847 source generated rename conflict (#84849)
  Return MethodNotFound for unsupported LSP method dispatch (#84892)
  [main] Update dependencies from dotnet/arcade (#84896)
  [main] Update dependencies from dotnet/arcade (#84882)
  Track status for feature "Type Parameter Inference from Constraints" (#84869)
  [main] Source code updates from dotnet/dotnet (#84879)
  Stop labeling Loc PRs as community (#84878)
  ...
@jjonescz jjonescz added this to the 18.11 milestone Aug 25, 2026
akoeplinger pushed a commit to dotnet/runtime that referenced this pull request Sep 18, 2026
Enable Roslyn's experimental compiler output cache in the Unix x64/arm64
non-official build legs that already use sccache.

The setup:

- persists the compiler cache with Azure Pipelines `Cache@2`
- allows rolling builds to seed caches that PR builds can restore
- preserves Azure's cache security boundary so PR writes cannot affect
caches consumed by main
- disables SourceLink for these non-official builds because
commit-specific SourceLink inputs invalidate compiler cache entries
- uses the deterministic `PathMap` already produced by
`ContinuousIntegrationBuild`
- reports per-build hit/store statistics alongside sccache statistics

Official builds are unaffected and continue to produce
SourceLink-enabled outputs without using this cache.

In a two-commit `libs.tests` experiment using a Roslyn build containing
dotnet/roslyn#84916, globally disabling SourceLink produced 358 hits and
one store across 359 compiler invocations. The cached build took 4m53s
versus 6m32s with the cache disabled, a 25.25% reduction (1.338x
speedup). With SourceLink enabled, only 13 invocations hit.

A local integration probe using `ROSLYN_CACHE_PATH` produced 41 stores
on the first rebuild and 41 hits on the second rebuild.

The Roslyn compiler output cache remains experimental. Cache read or
write failures fall back to normal compilation, and the outer cache key
is versioned so its provisional format can be invalidated independently.

> [!NOTE]
> This pull request description was generated with GitHub Copilot.

---------

Copilot-Session: ab967da8-759b-499d-a20d-d6d6c2cc355d
Copilot-Session: 501aac83-6191-40e5-8dc2-ef3acbcb1e41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compiler output cache fails on binary AdditionalFiles with CS2015

3 participants