-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[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
base: main
Are you sure you want to change the base?
Changes from all commits
233b53a
cbb524b
ac54157
5f6bda7
a4ed027
87cba17
f1457f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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"}, | ||
|
@@ -55,6 +56,7 @@ | |
".ci": { | ||
"llvm", | ||
"clang", | ||
"CIR", | ||
"lld", | ||
"lldb", | ||
"bolt", | ||
|
@@ -128,6 +130,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 +195,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 +255,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 +284,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 +302,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, | ||
} | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,6 +104,10 @@ def test_clang(self): | |
env_variables["runtimes_check_targets_needs_reconfig"], | ||
"check-cxx check-cxxabi check-unwind", | ||
) | ||
self.assertEqual( | ||
env_variables["enable_cir"], | ||
"OFF", | ||
) | ||
|
||
def test_clang_windows(self): | ||
env_variables = compute_projects.get_env_variables( | ||
|
@@ -126,6 +130,32 @@ def test_clang_windows(self): | |
env_variables["runtimes_check_targets_needs_reconfig"], | ||
"check-cxx check-cxxabi check-unwind", | ||
) | ||
self.assertEqual(env_variables["enable_cir"], "OFF") | ||
|
||
def test_cir(self): | ||
env_variables = compute_projects.get_env_variables( | ||
["clang/lib/CIR/CMakeLists.txt"], "Linux" | ||
) | ||
self.assertEqual( | ||
env_variables["projects_to_build"], | ||
"clang;clang-tools-extra;lld;llvm;mlir", | ||
) | ||
self.assertEqual( | ||
env_variables["project_check_targets"], | ||
"check-clang check-clang-cir check-clang-tools", | ||
) | ||
self.assertEqual( | ||
env_variables["runtimes_to_build"], "compiler-rt;libcxx;libcxxabi;libunwind" | ||
) | ||
self.assertEqual( | ||
env_variables["runtimes_check_targets"], | ||
"check-compiler-rt", | ||
) | ||
self.assertEqual( | ||
env_variables["runtimes_check_targets_needs_reconfig"], | ||
"check-cxx check-cxxabi check-unwind", | ||
) | ||
self.assertEqual(env_variables["enable_cir"], "ON") | ||
|
||
def test_bolt(self): | ||
env_variables = compute_projects.get_env_variables( | ||
|
@@ -153,11 +183,13 @@ def test_mlir(self): | |
) | ||
self.assertEqual(env_variables["projects_to_build"], "clang;flang;llvm;mlir") | ||
self.assertEqual( | ||
env_variables["project_check_targets"], "check-flang check-mlir" | ||
env_variables["project_check_targets"], | ||
"check-flang check-mlir", | ||
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. Formatting only change that should probably be reverted? |
||
) | ||
self.assertEqual(env_variables["runtimes_to_build"], "") | ||
self.assertEqual(env_variables["runtimes_check_targets"], "") | ||
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "") | ||
self.assertEqual(env_variables["enable_cir"], "ON") | ||
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 needs to be updated after planning to split this out? |
||
|
||
def test_flang(self): | ||
env_variables = compute_projects.get_env_variables( | ||
|
@@ -168,6 +200,7 @@ def test_flang(self): | |
self.assertEqual(env_variables["runtimes_to_build"], "") | ||
self.assertEqual(env_variables["runtimes_check_targets"], "") | ||
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "") | ||
self.assertEqual(env_variables["enable_cir"], "OFF") | ||
|
||
def test_invalid_subproject(self): | ||
env_variables = compute_projects.get_env_variables( | ||
|
@@ -237,7 +270,7 @@ def test_ci(self): | |
) | ||
self.assertEqual( | ||
env_variables["project_check_targets"], | ||
"check-bolt check-clang check-clang-tools check-flang check-lld check-lldb check-llvm check-mlir check-polly", | ||
"check-bolt check-clang check-clang-cir check-clang-tools check-flang check-lld check-lldb check-llvm check-mlir check-polly", | ||
) | ||
self.assertEqual( | ||
env_variables["runtimes_to_build"], | ||
|
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?