Skip to content

[SwiftDriver] PathRemapping and Cache Replay Support #1453

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

Conversation

cachemeifyoucan
Copy link
Contributor

Teach swift-driver to use newly added functions in swift-frontend and libSwiftScan.

@cachemeifyoucan
Copy link
Contributor Author

Depends on: swiftlang/swift#68660 and swiftlang/swift#68684

}
}

// Add cached diagnostics entry for primary files, or the first input for multithreaded compilation.
Copy link
Contributor

Choose a reason for hiding this comment

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

Changing the order of inputs here will invalidate the corresponding cache entries for this whole compilation, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the order of the file matters for cache key. Not sure if that really matters for the compilation but the order is unlikely to change in most cases.

Currently, file passed through filelist vs. argument will get different key, and there is a FIXME in swift somewhere to address that sometime.

@cachemeifyoucan cachemeifyoucan force-pushed the eng/PR-swift-driver-path-remap-and-replay branch 2 times, most recently from d9e75f7 to 03054e2 Compare September 26, 2023 19:54
@cachemeifyoucan cachemeifyoucan force-pushed the eng/PR-swift-driver-path-remap-and-replay branch from 03054e2 to 33bd1b1 Compare October 27, 2023 18:45
@cachemeifyoucan
Copy link
Contributor Author

Updated to match new APIs.

@cachemeifyoucan
Copy link
Contributor Author

@swift-ci please test

@cachemeifyoucan
Copy link
Contributor Author

ping

@cachemeifyoucan cachemeifyoucan force-pushed the eng/PR-swift-driver-path-remap-and-replay branch from 33bd1b1 to c3cc47d Compare October 30, 2023 22:36
@cachemeifyoucan
Copy link
Contributor Author

@swift-ci please test

@cachemeifyoucan cachemeifyoucan force-pushed the eng/PR-swift-driver-path-remap-and-replay branch from c3cc47d to be14c2d Compare October 30, 2023 22:56
@cachemeifyoucan
Copy link
Contributor Author

@swift-ci please test

@cachemeifyoucan cachemeifyoucan force-pushed the eng/PR-swift-driver-path-remap-and-replay branch from be14c2d to 56516af Compare November 2, 2023 16:42
@cachemeifyoucan
Copy link
Contributor Author

@swift-ci please test

@cachemeifyoucan
Copy link
Contributor Author

@swift-ci please smoke test macOS

@cachemeifyoucan
Copy link
Contributor Author

@swift-ci please test macOS platform

@cachemeifyoucan cachemeifyoucan force-pushed the eng/PR-swift-driver-path-remap-and-replay branch from 56516af to eefc658 Compare November 2, 2023 20:25
@cachemeifyoucan
Copy link
Contributor Author

@swift-ci please test

@cachemeifyoucan cachemeifyoucan force-pushed the eng/PR-swift-driver-path-remap-and-replay branch from eefc658 to 36503c8 Compare November 3, 2023 17:20
@cachemeifyoucan
Copy link
Contributor Author

@swift-ci please test

@cachemeifyoucan cachemeifyoucan force-pushed the eng/PR-swift-driver-path-remap-and-replay branch from 36503c8 to 474fc4e Compare November 3, 2023 18:28
@cachemeifyoucan
Copy link
Contributor Author

@swift-ci please test

@cachemeifyoucan cachemeifyoucan force-pushed the eng/PR-swift-driver-path-remap-and-replay branch from 474fc4e to 808cc4d Compare November 3, 2023 22:15
Copy link
Contributor

@akyrtzi akyrtzi left a comment

Choose a reason for hiding this comment

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

Some nitpicks, otherwise LGTM!

return callback
}

func getContext() -> UnsafeMutableRawPointer {
Copy link
Contributor

Choose a reason for hiding this comment

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

This would be more clearly named as takeContext() since it returns a +1 object.

Copy link
Contributor Author

@cachemeifyoucan cachemeifyoucan Nov 3, 2023

Choose a reason for hiding this comment

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

Is take indicating +1 or -1? Should this be copyContext() or retainContext()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I change to retain().

@cachemeifyoucan cachemeifyoucan force-pushed the eng/PR-swift-driver-path-remap-and-replay branch 2 times, most recently from 347ff17 to bc87263 Compare November 4, 2023 00:15
@cachemeifyoucan
Copy link
Contributor Author

@swift-ci please test

@cachemeifyoucan cachemeifyoucan force-pushed the eng/PR-swift-driver-path-remap-and-replay branch from bc87263 to 95345ae Compare November 6, 2023 17:41
Teach swift-driver to remap path when needed. This involves:
* Infer SDK/toolchain related path that needs to remapped
* Send path remap related arguments to swift-frontend for depscanning
* Send reverse map to swift-frontend for diagnostics replay
* Constructing the compilation command for main module using remapped
  path
Teach swift-driver to replay cached compilation result using
libSwiftScan APIs directly. Jobs constructed from swift-driver is going
to have a new field for all the cache keys associated with the job. The
Executor can choose to query and replay using those cache keys if
possible, instead of executing the build command.

rdar://117947710
…ration

Re-unify caching availability check behind swift feature query and
adjust the default caching build configuration changes.
Remove extra `-Xcc` in the command-line.`
@cachemeifyoucan cachemeifyoucan force-pushed the eng/PR-swift-driver-path-remap-and-replay branch from 95345ae to 2de866d Compare November 13, 2023 17:59
@cachemeifyoucan
Copy link
Contributor Author

@artemcm Some changes after I change the configuration in swift-frontend and swift most of the checks for if swift-frontend/libSwiftScan supports caching behind swift feature json flag.

@cachemeifyoucan
Copy link
Contributor Author

@swift-ci please test

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