Skip to content

[Runtimes][CMake] Add Distributed to Supplemental build #81529

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

edymtt
Copy link
Contributor

@edymtt edymtt commented May 15, 2025

Also add a couple modules to use Swift calling conventions and set the correct C++ standard.

Do not enable this yet, as this would relies on a few find modules that
are not available at the moment.

Addresses rdar://151389005

@edymtt edymtt force-pushed the edymtt/add-distributed-to-new-build-system-inert branch from daaa868 to 440ff7b Compare May 15, 2025 16:50
@edymtt
Copy link
Contributor Author

edymtt commented May 15, 2025

@swift-ci please smoke test

@edymtt edymtt marked this pull request as ready for review May 15, 2025 18:05
CACHE FILEPATH "Location for private build system extension")

include(CxxStandard)
include(SwiftCallingConventions)
Copy link
Member

Choose a reason for hiding this comment

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

Why is distributed special and the only one to perform these checks? I think that we should replicate them across all the builds if we want to perform these.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Of the Supplemental libraries we are converting, only Distributed and Observation use Swift calling conventions -- since in this rewrite we are trying to apply flags/features only to the libraries that only strictly need those, I thought it was sound not require to apply those to Synchronization and Differentiation.

Copy link
Member

Choose a reason for hiding this comment

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

Core definitely uses the swift calling conventions as does the Concurrency runtime.

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 agree, my analysis was focused on the Supplemental libraries alone -- Core and Concurrency are running these checks already with CompilerSettings.cmake


configure_file("CMakeConfig.h.in"
"${PROJECT_BINARY_DIR}/include/swift/Runtime/CMakeConfig.h"
ESCAPE_QUOTES @ONLY)
Copy link
Member

Choose a reason for hiding this comment

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

This seems sketchy. We shouldn't be re-generating the configuration for the runtime build, but should distribute it or pull it from the build tree.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me see what I can do -- possibly a find module may help here, need to think about the distribution scenario.

Copy link
Member

Choose a reason for hiding this comment

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

If we install/export this from Core, find_package(SwiftCore) should be able to wire this up.

Copy link
Contributor

Choose a reason for hiding this comment

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

Once the Core and supplemental libraries are built, the CMakeConfig.h file aren't used by anything so it shouldn't be necessary so installing it isn't great.

You're right that it's sketchy if the projects get out of sync. I do think that the SwiftCoreConfig.cmake should export the appropriate settings and that the supplemental libraries should import them to ensure that the values are kept in sync.

if($CACHE{CMAKE_CXX_STANDARD} AND $CACHE{CMAKE_CXX_STANDARD} LESS ${${PROJECT_NAME}_MIN_CXX_STANDARD})
message(WARNING "Resetting cache value for CMAKE_CXX_STANDARD to ${${PROJECT_NAME}_MIN_CXX_STANDARD}")
unset(CMAKE_CXX_STANDARD CACHE)
endif()
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure that this is valuable to keep. Just using the standard CMAKE_CXX_STANDARD and CMAKE_CXX_STANDARD_REQUIRED should ensure that the compiler is able to support this standard. We also want all the projects to build at the same standard I think, so having a project specific standard is less than ideal.

So far, we haven't set the C++ standard on the other projects, and we should do that uniformly.

Copy link
Contributor Author

@edymtt edymtt May 15, 2025

Choose a reason for hiding this comment

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

I see, I copied and pasted without thinking about this too much -- also this is something we may pull from the configuration of the core libraries.

Differentiation and Synchronization currently do not contain any C++ code -- I think it makes more sense to not set the C++ standard for them until we add C++ code (which I believe we should not be able to forget, since we need also to change the linkage language)

swiftCore
swift_Concurrency)
# swiftDarwin/Libc/Platform
# builtin_float
Copy link
Member

Choose a reason for hiding this comment

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

_Builtin_float is part of the overlays, we should introduce a find_project(SwiftOverlay) for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for suggesting this should be more generic -- I was thinking of focusing specifically on _Builtin_float, but that may be too granular.

edymtt added 3 commits May 19, 2025 08:07
Leave it inert for now, as this would relies on a few find modules that
are not available at the moment.

Addresses rdar://151389005
@edymtt edymtt force-pushed the edymtt/add-distributed-to-new-build-system-inert branch from 440ff7b to fa2add6 Compare May 19, 2025 20:42
@edymtt
Copy link
Contributor Author

edymtt commented May 19, 2025

(This is a rebase to account for merge conflicts and changes in #81558, no review feedback has been incorporated yet)

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