Skip to content

Conversation

artemcm
Copy link
Contributor

@artemcm artemcm commented Nov 7, 2022

The driver previously implemented a scheme where it computed an output path for the PCMs of clang module dependencies by hashing the command-line used to build the PCM plus a set of special arguments determined by the depending Swift module that made the PCM unique to the depending Swift module in the build graph. This was previously done first and foremost to accomodate the fact that we used to have Clang modules built against different target triples in the build graph.

The driver would previously execute a dependency scan, and follow it up with a re-scan of relevant clang modules which we require to have dependency info about at a target triple that is different from the main module's target triple. With the introduction of '-clang-target', we are aiming to ensure that '-target' triple of all Clang modules built matches that of the top-level Swift main module being built; therefore, making re-scanning and manual hashing of the PCM output filename unnecessary.

@artemcm
Copy link
Contributor Author

artemcm commented Nov 8, 2022

@swift-ci test

@artemcm artemcm force-pushed the ExplicitScanNoReVersion branch from 39d3f18 to 89c6813 Compare November 8, 2022 18:51
@artemcm
Copy link
Contributor Author

artemcm commented Nov 8, 2022

@swift-ci test

@artemcm artemcm force-pushed the ExplicitScanNoReVersion branch from 89c6813 to a161764 Compare November 8, 2022 18:59
@artemcm
Copy link
Contributor Author

artemcm commented Nov 8, 2022

@swift-ci test

@artemcm artemcm force-pushed the ExplicitScanNoReVersion branch from a161764 to 18aaa94 Compare November 8, 2022 19:37
@artemcm
Copy link
Contributor Author

artemcm commented Nov 8, 2022

@swift-ci test

…etermine the PCM output filename

The driver previously implemented a scheme where it computed an output path for the PCMs of clang module dependencies by hashing the command-line used to build the PCM plus a set of special arguments determined by the depending Swift module that made the PCM unique to the depending Swift module in the build graph. This was previously done first and foremost to accomodate the fact that we used to have Clang modules built against different target triples in the build graph.

The driver would previously execute a dependency scan, and follow it up with a re-scan of relevant clang modules which we require to have dependency info about at a target triple that is different from the main module's target triple. With the introduction of '-clang-target', we are aiming to ensure that '-target' triple of all Clang modules built matches that of the top-level Swift main module being built; therefore, making re-scanning and manual hashing of the PCM output filename unnecessary.
@artemcm artemcm force-pushed the ExplicitScanNoReVersion branch from 18aaa94 to 36f08da Compare November 8, 2022 19:50
@artemcm
Copy link
Contributor Author

artemcm commented Nov 8, 2022

@swift-ci test

@artemcm artemcm marked this pull request as ready for review November 8, 2022 21:20
@artemcm artemcm requested a review from nkcsgexi November 8, 2022 21:21
@nkcsgexi
Copy link
Contributor

nkcsgexi commented Nov 8, 2022

by hashing the command-line used to build the PCM plus a set of special arguments determined by the depending Swift

To refresh my memory about this, why are these special arguments not part of the PCM building command?

@artemcm
Copy link
Contributor Author

artemcm commented Nov 8, 2022

by hashing the command-line used to build the PCM plus a set of special arguments determined by the depending Swift

To refresh my memory about this, why are these special arguments not part of the PCM building command?

The only example really is a depending Swift module's target triple. Say we're building main module A for macOS 11.0, which depends on B, whose interface specifies a target of macOS 10.0, and both A and B depend on Clang module C.

The dependency scan is done with the specified target of the main module - macOS 11.0, but when building B, we would note its target triple as a special PCM argument, which would really only be the target triple.

Then during planning, we would note that C is depended upon by two modules whose "special" PCM argument sets are different (because of the triple difference) so we would re-scan C by appending these special arguments to the scanner commands, getting us different scan results of C, depending on its target triple. These different scans actually would propagate down to the eventual build commands to build C, we would just have two of them.

Now that we have settled on a scheme where we aim to only build modules for a single target (that of the main module), I am hoping we can move away from this scheme entirely. Simply execute a scan at the main module triple and use the results of this scan to form a complete build graph.

In my testing, since we introduced the notion of -clang-target, I haven't yet encountered a case where it broke a build, so I am hopeful we will be able to remove the re-scanning logic altogether. 🤞🏼

Copy link
Contributor

@nkcsgexi nkcsgexi left a comment

Choose a reason for hiding this comment

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

Makes sense. Thank you for explaining the details!

@artemcm artemcm merged commit 6146666 into swiftlang:main Nov 9, 2022
@artemcm artemcm deleted the ExplicitScanNoReVersion branch November 9, 2022 18:19
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.

2 participants