Skip to content

[ThinLTO] Asynchronous caching #8614

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 22, 2024

Conversation

jansvoboda11
Copy link

Cherry-pick of #8236.

Explanation: ThinLTO performs cache operations synchronously on a thread pool. If they happen to be slow (e.g. using a remote cache with poor latency/throughput), the requests can block threads for a long period of time and slow down the build. This patch makes cache requests asynchronous and starts performing codegen locally, avoiding unnecessary waits on slow cache.

Risk: Moderate. The changes are non-trivial and the asynchronous nature makes it hard to programatically test.

Testing: Existing tests exercise the affected code path, manual testing with fault injection was performed but not easy to replicate in automated tests.

Reviewed By: @akyrtzi

All existing kinds of `ModuleCacheEntry` contain the same kind of optionality: their `getEntryPath()`, `tryLoadingBuffer()` and `write()` functions are no-op if the ThinLTO key could not be computed in their constructors.

This patch extracts the concept of no-op cache entry into `NullModuleCacheEntry`, simplifying the logic.

(cherry picked from commit b168a63)
[ThinLTO] Asynchronous caching

(cherry picked from commit 03af59c)
@jansvoboda11 jansvoboda11 requested a review from akyrtzi April 19, 2024 22:52
@jansvoboda11
Copy link
Author

@swift-ci please test

@jansvoboda11
Copy link
Author

@swift-ci please test windows platform

@jansvoboda11
Copy link
Author

@swift-ci please test

@jansvoboda11
Copy link
Author

@swift-ci please test windows platform

1 similar comment
@jansvoboda11
Copy link
Author

@swift-ci please test windows platform

@nkcsgexi nkcsgexi merged commit 94447cf into swift/release/6.0 Apr 22, 2024
@jansvoboda11 jansvoboda11 deleted the jan_svoboda/async-thinlto-release branch April 22, 2024 14:35
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.

3 participants