镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Enable root-relative ILLink task cache sharing - #135320

Draft
sbomer wants to merge 26 commits into
mainfrom
sbomer/illink-cache-worktree-sharing
Draft

sbomer wants to merge 26 commits into
mainfrom
sbomer/illink-cache-worktree-sharing

Conversation

@sbomer

@sbomer sbomer commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Builds on #135886 to share eligible ILLink task cache entries across worktrees with equivalent layouts. Map declared source roots into stable cache identities while retaining full content hashing, and run single-root invocations from that root with structured relative arguments rather than rewriting raw command strings. Use the shared invocation cache for storage and restoration.

Caching remains opt-in, with compiler and symbol-preservation defaults unchanged. Unsupported inputs run uncached with their original arguments and working directory. This branch retains the already-merged resolver fix from #136249 because the current base predates it.

Validated both task targets, 355 task/shared-cache tests, 1,307 linker tests (30 existing skips), and 65 cache-maintenance tests on Linux. Real enclosing-root and disjoint-root cache hits matched uncached DLL/PDB bytes, including concurrent writers and SDK mapping probes. Windows/macOS execution and full runtime builds were not run.

Note

This pull request description was created with assistance from GitHub Copilot.

@dotnet-policy-service dotnet-policy-service Bot added the linkable-framework Issues associated with delivering a linker friendly framework label Oct 7, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
12 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.

Copilot review overview

🟡 Changes recommended

Untracked assembly-resolution paths and Windows drive-root rewriting can produce unsound cache keys.

Review effort: Balanced
Findings: 2 High severity

Open (2)
What changed in this PR

Adds root-relative ILLink cache identities so equivalent worktrees can share eligible cached outputs.

Changes:

  • Maps source-root paths into stable cache keys and relative invocations.
  • Expands cache eligibility checks and input hashing.
  • Adds target wiring, documentation, and extensive tests.
File Description
LinkTask.cs Implements path mapping and cache validation.
Microsoft.NET.ILLink.targets Forwards SDK source roots.
Mock.cs Captures cache invocation details.
ILLink.Tasks.Tests.cs Tests sharing, eligibility, and fallback behavior.
eng/​illink.targets Defines the runtime repository source root.
sfx-finish.proj Forwards source roots for framework trimming.
oob-trim.proj Forwards source roots for OOB trimming.
illink-tasks.md Documents task behavior and configuration.
task-cache.md Updates cache design decisions.

@github-actions github-actions Bot added the area-Tools-ILLink .NET linker development as well as trimming analyzers label Oct 7, 2026
@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 and others added 11 commits October 15, 2026 11:52
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
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
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
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
@sbomer
sbomer changed the base branch from main to sbomer/illink-reject-path-shaped-resolution October 21, 2026 21:48
@sbomer
sbomer added this pull request to stack #136310 October 22, 2026 17:49
Base automatically changed from sbomer/illink-reject-path-shaped-resolution to main October 22, 2026 20:57
sbomer and others added 5 commits October 23, 2026 15:10
Map declared source roots into structured cache identity and use relative execution arguments for eligible single-root invocations. Retain full content hashing, conservative symbol and resolution checks, and original execution for uncached requests.

Assisted-by: Copilot:gpt-6.1-sol
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: cf203c67-3550-4744-a063-3f1230546d53
Assisted-by: Copilot:gpt-6.1-sol
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: cf203c67-3550-4744-a063-3f1230546d53
Bypass unsupported escaped quotes, account for Unix ToolTask normalization, and strengthen disjoint-root coverage. Clarify the SDK mapping prerequisites without changing compilation defaults.

Assisted-by: GitHub Copilot CLI:gpt-6.1-sol
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: cf203c67-3550-4744-a063-3f1230546d53
Retain the stricter ILLink identity diagnostics when exercising eligibility tests from the shared-cache extraction.

Assisted-by: Copilot:gpt-6.1-sol
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: cf203c67-3550-4744-a063-3f1230546d53
)

Treat path-shaped assembly-name strings as unresolved before
constructing assembly-name references or consulting the loaded cache.
This prevents name-based lookup from probing parent directories or other
paths while preserving each caller's existing unresolved diagnostics and
tolerant reflection probing. Explicit reference file paths and
already-created assembly-name references retain their current behavior.

Linux validation passed: 1,317 ILLink tests (including 175 focused
resolver cases), 212 task tests, 33 cache-tool tests, and 1,135 analyzer
tests, with 39 existing skips and no failures. ILTrim also builds
successfully. Windows/macOS and the ILC/ILTrim test suites were not run.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 58eb5972-179d-44fb-8b71-3632cb35ab0c
(cherry picked from commit 598d884)
@sbomer
sbomer force-pushed the sbomer/illink-cache-worktree-sharing branch from 78eb283 to 1dd380b Compare October 23, 2026 22:28
@sbomer
sbomer removed this pull request from stack #136310 October 23, 2026 22:29
@sbomer
sbomer changed the base branch from main to sbomer/shared-invocation-cache October 23, 2026 22:29
Use analyzer-compliant path checks on both task targets and dispose the Cecil reader before rewriting the path-shaped-reference fixture.

Assisted-by: Copilot:gpt-6.1-sol
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: cf203c67-3550-4744-a063-3f1230546d53

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

Cross-worktree cache identity and platform-specific subprocess argument handling warrant maintainer review, especially with Windows and macOS execution unvalidated.

No open issues 🎉

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

Cross-worktree cache correctness relies on platform-specific path and symbol behavior that still warrants maintainer review and Windows/macOS validation.

No open issues 🎉

Review effort: Balanced

Base automatically changed from sbomer/shared-invocation-cache to main October 29, 2026 17:34
sbomer and others added 4 commits October 29, 2026 10:55
Preserve root-aware cache identity while integrating the shared invocation cache changes.

Assisted-by: GitHub Copilot:gpt-6.1-sol
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: af970add-1797-4965-9c32-5230b3bf3400
Assisted-by: GitHub Copilot:gpt-6.1-sol
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: af970add-1797-4965-9c32-5230b3bf3400
Keep cache orchestration in the shared adapter and let ILLink handle root and XML assembly-name validation. Retain metadata-reference and working-directory safeguards, and remove the redundant key version suffix.

Assisted-by: GitHub Copilot:gpt-6.1-sol
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: af970add-1797-4965-9c32-5230b3bf3400
Prepare the same root-relative invocation regardless of cache eligibility and reuse initialized SourceRoot items. Describe logical path identities for the shared key builder instead of duplicating serialization and hashing in ILLink.

Assisted-by: Copilot:gpt-6.1-sol
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: af970add-1797-4965-9c32-5230b3bf3400
sbomer and others added 3 commits November 11, 2026 11:53
Rely on full-content hashes to distinguish embedded checkout paths instead of rejecting those inputs. Remove scan-only machinery while retaining root mapping, input readability checks, and symbol eligibility checks. Cover identical-byte sharing and embedded-path invalidation.

Assisted-by: Copilot:gpt-6.1-sol
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: af970add-1797-4965-9c32-5230b3bf3400
Record input roles while generating execution arguments and logical cache context. Capture normalized file identities in InvocationDescription and extract source-root mapping from LinkTask. Remove override detection and assembly-name/module preflight restrictions; defer hashless linked-resource tracking.

Assisted-by: Copilot:gpt-6.1-sol
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: af970add-1797-4965-9c32-5230b3bf3400
Resolve physical input and output locations through a reversible path map instead of retaining parallel path and identity inventories.

Assisted-by: Copilot:gpt-6.1-sol
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: af970add-1797-4965-9c32-5230b3bf3400

This branch has not been deployed

No deployments
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: No status

Development

Successfully merging this pull request may close these issues.

2 participants