Skip to content

Extract shared invocation cache storage from ILLink - #135886

Merged
sbomer merged 13 commits into
mainfrom
sbomer/shared-invocation-cache
Oct 29, 2026
Merged

sbomer merged 13 commits into
mainfrom
sbomer/shared-invocation-cache

Conversation

@sbomer

@sbomer sbomer commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Extracts ILLink's experimental invocation cache into shared sources, compiled into each consumer without adding a shared DLL. Tasks provide invocation descriptions and prepare their outputs before executing; the shared engine handles content hashing, lookup, restoration, storage, and purge. This intentionally goes beyond a mechanical extraction: the common output contract supports owned directories and file sets, records absent outputs, and uses checksummed manifests. That changes the experimental v1 entry format: existing entries are not reused, but remain purgable. #135446 builds on this infrastructure to add crossgen2 caching.

Replaces the ILLink-specific maintenance package and command with dotnet-build-cache, shared by both caches. Existing users should install that package instead of dotnet-illink-cache and replace dotnet illink-cache purge ... with dotnet build-cache purge --cache illink .... Commands already selecting an explicit directory can use dotnet build-cache purge --cache-directory <path> ... without a cache name. The cache-enablement environment variables are unchanged.

Validated independently on this branch: 287 ILLink/shared-cache tests and 65 maintenance-tool tests passed. Modern .NET and net472 task builds passed; net472 was built but not executed on Linux.

Note

This content was created with assistance from AI.

Keep ILLink configuration and input identity in the task while sharing entry validation, publication, directory restoration, and usage metadata. Preserve v1 serialization, mutex names, diagnostics, and purge semantics. Compile shared sources into consumers without adding a runtime assembly.

Assisted-by: GitHub Copilot CLI:gpt-6.1-sol
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: da7cf090-9a92-453d-beb2-f672a9a7b541
@github-actions github-actions Bot added the area-Tools-ILLink .NET linker development as well as trimming analyzers label Oct 15, 2026
@dotnet-policy-service dotnet-policy-service Bot added the linkable-framework Issues associated with delivering a linker friendly framework label Oct 15, 2026
@azure-pipelines

azure-pipelines Bot commented Oct 15, 2026 •

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

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @dotnet/illink
See info in area-owners.md if you want to be subscribed.

@sbomer
sbomer added this pull request to stack #135895 October 15, 2026 20:58
sbomer and others added 2 commits October 15, 2026 14:24
Reference the shared invocation cache entry metadata directly from the purge tool and tests.

Assisted-by: GitHub Copilot CLI:gpt-6.1-sol
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: da7cf090-9a92-453d-beb2-f672a9a7b541
Keep ILLink configuration and task tests in ILLink, and exercise storage with a tool-independent fixture.

Assisted-by: GitHub Copilot CLI:gpt-6.1-sol
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: da7cf090-9a92-453d-beb2-f672a9a7b541
sbomer and others added 2 commits October 16, 2026 09:57
Share opt-in parsing, cache-directory resolution, diagnostics, and construction while keeping ILLink eligibility and input identity in its task. Move configuration tests alongside the shared storage tests and preserve ILLink configuration behavior.

Assisted-by: GitHub Copilot CLI:gpt-6.1-sol
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: da7cf090-9a92-453d-beb2-f672a9a7b541
Share entry enumeration, last-used handling, deletion, diagnostics, and summary reporting with explicit layout and tool labels. Keep the ILLink CLI and idle-cache requirement unchanged. Move engine tests into shared sources and cover independent layouts while retaining CLI tests in the tool project.

Assisted-by: GitHub Copilot CLI:gpt-6.1-sol
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: da7cf090-9a92-453d-beb2-f672a9a7b541
Move restore-or-execute orchestration and successful-result storage into the shared cache sources. Keep ILLink eligibility, key computation and output preparation in task callbacks, preserving the existing directory-only v1 storage contract.

Assisted-by: GitHub Copilot CLI:gpt-6.1-sol
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: da7cf090-9a92-453d-beb2-f672a9a7b541
sbomer and others added 4 commits October 21, 2026 11:57
Describe inputs, context, and outputs independently of cache policy and compute content identities in the shared layer. Resolve cache configuration lazily and keep output preparation in normal tool execution, with cache-owned restoration on hits.

Assisted-by: GitHub Copilot CLI:gpt-6.1-sol

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: da7cf090-9a92-453d-beb2-f672a9a7b541
Preserve runtime library ExtraArgs input discovery in DescribeInvocation, including readable XML inputs and assembly search-directory inventories. Adapt bypass returns and diagnostic assertions to the extracted invocation-description contract.

Assisted-by: GitHub Copilot CLI:gpt-6.1-sol

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: da7cf090-9a92-453d-beb2-f672a9a7b541
Move the ILLink cache CLI into a standalone dotnet-build-cache tool. Support named ILLink and crossgen2 caches with explicit-directory, environment, and shared platform-default resolution, independently of task enablement. Update build, test, CI, and usage wiring and align tool-file identity coverage with explicit absence markers.

Assisted-by: Copilot:gpt-6.1-sol
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: da7cf090-9a92-453d-beb2-f672a9a7b541
Use only the explicit cache directory in CI commands and the matching example. Explain that a cache name does not validate directory ownership when an explicit directory is supplied.

Assisted-by: Copilot:gpt-6.1-sol
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: da7cf090-9a92-453d-beb2-f672a9a7b541
Let output validation exceptions propagate instead of falling back to normal execution, preserving the existing protection against overlapping cache and output directories. Cover rejected declarations and ILLink output cleanup with regression tests.

Assisted-by: Copilot:gpt-6.1-sol
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: da7cf090-9a92-453d-beb2-f672a9a7b541

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.

🔵 Needs a closer look

Expanded filesystem restoration and incompatible cache encoding warrant maintainer validation across supported platforms; builds and tests were not rerun in this review.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Low severity Update API sketch and lifecycle docs for current cache contract

docs/​design/​tools/​illink/​task-cache.md:36

The API sketch and lifecycle paragraph describe an integration that the shared cache no longer exposes. TryCreateFromEnvironment takes InvocationCacheConfiguration; ILLink calls ExecuteCached with an InvocationDescription callback and a parameterless execution callback; restore/store take InvocationOutputs. The shared engine now computes the key from the task's input inventory and context. Update the signatures and ownership explanation together so additional consumers do not follow the obsolete callback contract.

3 resolved since last review

Review effort: Balanced

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.

🔵 Needs a closer look

The expanded cache format and destructive output-restoration contract warrant cross-platform maintainer review; builds and tests were not run in this review.

1 open issue

Review effort: Balanced

Comment thread docs/design/tools/illink/task-cache.md Outdated
sbomer and others added 2 commits October 23, 2026 09:32
Use repository license headers for the relocated maintenance tool and enforce the Linux-only default-path test condition at runtime. Align the design notes with the implemented shared API, output validation, experimental format, and maintenance command.

Assisted-by: Copilot:gpt-6.1-sol
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: da7cf090-9a92-453d-beb2-f672a9a7b541
Assisted-by: Copilot:gpt-6.1-sol
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: da7cf090-9a92-453d-beb2-f672a9a7b541

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.

🔵 Needs a closer look

The expanded storage and output-restoration contracts warrant human cross-platform validation, particularly because net472 was built but not executed.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@sbomer
sbomer marked this pull request as ready for review October 23, 2026 20:30
@sbomer

sbomer commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

This change is extracting the ILLink cache logic to allow sharing sources. As part of that I'm starting to make the shared layer have a shape that could be adapted for use in MSBuild.

@agocke @rainersigwald I'm not trying to finalize the API details here, but would appreciate your input on the overall shape, with the goal of eventually moving this to MSBuild (possibly backed by a different cache storage engine later).

@sbomer

sbomer commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

/ba-g "Unrelated failures are dotnet/diagnostics#6143"

@sbomer
sbomer merged commit fc5e8a9 into main Oct 29, 2026
201 of 211 checks passed
@github-project-automation github-project-automation Bot moved this to Done in AppModel Oct 29, 2026
@sbomer
sbomer deleted the sbomer/shared-invocation-cache branch October 29, 2026 17:34
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Tools-ILLink .NET linker development as well as trimming analyzers linkable-framework Issues associated with delivering a linker friendly framework

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants