-
Notifications
You must be signed in to change notification settings - Fork 14.5k
[CI][Github] Enable CIR CI build and test #147430
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
andykaylor
wants to merge
7
commits into
llvm:main
Choose a base branch
from
andykaylor:ci-enable-cir
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
233b53a
[Github] Enable CIR CI build and test
andykaylor cbb524b
Fix formatting
andykaylor ac54157
Fix formatting again
andykaylor 5f6bda7
Update compute_projects_test.py
andykaylor a4ed027
Fix formatting
andykaylor 87cba17
Fix formatting yet again
andykaylor f1457f9
Defer mlir->cir testing dependency to a later change
andykaylor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
PROJECT_DEPENDENCIES = { | ||
"llvm": set(), | ||
"clang": {"llvm"}, | ||
"CIR": {"clang", "mlir"}, | ||
"bolt": {"clang", "lld", "llvm"}, | ||
"clang-tools-extra": {"clang", "llvm"}, | ||
"compiler-rt": {"clang", "lld"}, | ||
|
@@ -50,11 +51,15 @@ | |
"lld": {"bolt", "cross-project-tests"}, | ||
# TODO(issues/132795): LLDB should be enabled on clang changes. | ||
"clang": {"clang-tools-extra", "cross-project-tests"}, | ||
"mlir": {"flang"}, | ||
"mlir": { | ||
"CIR", | ||
"flang", | ||
}, | ||
# Test everything if ci scripts are changed. | ||
".ci": { | ||
"llvm", | ||
"clang", | ||
"CIR", | ||
"lld", | ||
"lldb", | ||
"bolt", | ||
|
@@ -128,6 +133,7 @@ | |
"lldb": "check-lldb", | ||
"llvm": "check-llvm", | ||
"clang": "check-clang", | ||
"CIR": "check-clang-cir", | ||
"bolt": "check-bolt", | ||
"lld": "check-lld", | ||
"flang": "check-flang", | ||
|
@@ -192,7 +198,12 @@ def _compute_projects_to_test(modified_projects: Set[str], platform: str) -> Set | |
def _compute_projects_to_build( | ||
projects_to_test: Set[str], runtimes: Set[str] | ||
) -> Set[str]: | ||
return _add_dependencies(projects_to_test, runtimes) | ||
projects_with_deps = _add_dependencies(projects_to_test, runtimes) | ||
# CIR is used as a pseudo-project in this script. We detect modifications | ||
# to clang's CIR-specific subdirectories and add CIR as a modified project | ||
# if a file in these directories is modified, but we need to remove it | ||
# explicitly here. | ||
return projects_with_deps - {"CIR"} | ||
|
||
|
||
def _compute_project_check_targets(projects_to_test: Set[str]) -> Set[str]: | ||
|
@@ -247,6 +258,15 @@ def _get_modified_projects(modified_files: list[str]) -> Set[str]: | |
# capacity. | ||
if len(path_parts) > 3 and path_parts[:3] == ("llvm", "utils", "gn"): | ||
continue | ||
# If the file is in the clang/lib/CIR directory, add the CIR project. | ||
if len(path_parts) > 3 and ( | ||
path_parts[:3] == ("clang", "lib", "CIR") | ||
or path_parts[:3] == ("clang", "test", "CIR") | ||
or path_parts[:4] == ("clang", "include", "clang", "CIR") | ||
): | ||
modified_projects.add("clang") | ||
modified_projects.add("CIR") | ||
continue | ||
modified_projects.add(pathlib.Path(modified_file).parts[0]) | ||
return modified_projects | ||
|
||
|
@@ -267,6 +287,12 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]: | |
runtimes_check_targets_needs_reconfig = _compute_project_check_targets( | ||
runtimes_to_test_needs_reconfig | ||
) | ||
|
||
# Check if both clang and mlir are in projects_to_build to enable CIR | ||
enable_cir = ( | ||
"ON" if "clang" in projects_to_build and "mlir" in projects_to_build else "OFF" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a bit weird. Why aren't we just checking if |
||
) | ||
|
||
# We use a semicolon to separate the projects/runtimes as they get passed | ||
# to the CMake invocation and thus we need to use the CMake list separator | ||
# (;). We use spaces to separate the check targets as they end up getting | ||
|
@@ -279,6 +305,7 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]: | |
"runtimes_check_targets_needs_reconfig": " ".join( | ||
sorted(runtimes_check_targets_needs_reconfig) | ||
), | ||
"enable_cir": enable_cir, | ||
} | ||
|
||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If something in
clang/
is touched,modified_projects
should already containclang
, no?