diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9421c5b097c..f6238ab0fdd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,6 +43,10 @@ on: windows_use_prebuilt_artifacts: type: boolean description: "If enabled, the CI will pull Windows artifacts using artifact_run_id and only run tests" + additional_label_options: + type: string + description: "If enabled, these additional labels options will be applied. ex: test_runner:oem" + default: "" artifact_run_id: type: string description: "If provided, the tests will run on this artifact ID" diff --git a/.github/workflows/setup.yml b/.github/workflows/setup.yml index 2a4f46c6bc8..7fb0398c948 100644 --- a/.github/workflows/setup.yml +++ b/.github/workflows/setup.yml @@ -75,6 +75,7 @@ jobs: INPUT_WINDOWS_AMDGPU_FAMILIES: ${{ github.event.inputs.windows_amdgpu_families }} WINDOWS_TEST_LABELS: ${{ github.event.inputs.windows_test_labels }} WINDOWS_USE_PREBUILT_ARTIFACTS: ${{ github.event.inputs.windows_use_prebuilt_artifacts }} + ADDITIONAL_LABEL_OPTIONS: ${{ github.event.inputs.additional_label_options }} BUILD_VARIANT: ${{ inputs.build_variant }} MULTI_ARCH: ${{ inputs.multi_arch }} # Variable comes from ROCm organization variable 'ROCM_THEROCK_TEST_RUNNERS' diff --git a/build_tools/github_actions/amdgpu_family_matrix.py b/build_tools/github_actions/amdgpu_family_matrix.py index d0bdc924d10..6fbab98d9dd 100644 --- a/build_tools/github_actions/amdgpu_family_matrix.py +++ b/build_tools/github_actions/amdgpu_family_matrix.py @@ -77,6 +77,9 @@ "gfx1151": { "linux": { "test-runs-on": "linux-gfx1151-gpu-rocm", + "test-runs-on-kernel": { + "oem": "linux-strix-halo-gpu-rocm-oem", + }, "family": "gfx1151", "bypass_tests_for_releases": True, "build_variants": ["release"], diff --git a/build_tools/github_actions/configure_ci.py b/build_tools/github_actions/configure_ci.py index 281ccf0d2d6..9ba531473e0 100755 --- a/build_tools/github_actions/configure_ci.py +++ b/build_tools/github_actions/configure_ci.py @@ -224,13 +224,27 @@ def should_ci_run_given_modified_paths(paths: Optional[Iterable[str]]) -> bool: def get_pr_labels(args) -> List[str]: """Gets a list of labels applied to a pull request.""" - data = json.loads(args.get("pr_labels")) + data = json.loads(args.get("pr_labels", "{}")) labels = [] for label in data.get("labels", []): labels.append(label["name"]) return labels +def get_workflow_dispatch_additional_label_options(args) -> List[str]: + """Gets a list of additional label options from workflow_dispatch.""" + additional_label_options = args.get( + "workflow_dispatch_additional_label_options", "" + ) + if additional_label_options: + return [ + label.strip() + for label in additional_label_options.split(",") + if label.strip() + ] + return [] + + def filter_known_names( requested_names: List[str], name_type: str, target_matrix=None ) -> List[str]: @@ -608,6 +622,33 @@ def matrix_generator( artifact_group += f"-{build_variant_suffix}" matrix_row["artifact_group"] = artifact_group + # We retrieve labels from both PR and workflow_dispatch to customize the build and test jobs + label_options = [] + label_options.extend(get_pr_labels(base_args)) + label_options.extend( + get_workflow_dispatch_additional_label_options(base_args) + ) + for label in label_options: + # If a specific test kernel type was specified, we use that kernel-enabled test runners + # We disable the other machines that do not have the specified kernel type + # If a kernel test label was added, we set the test-runs-on accordingly to kernel-specific test machines + if "test_runner" in label: + _, kernel_type = label.split(":") + # If the architecture has a valid kernel machine, we set it here + if ( + "test-runs-on-kernel" in platform_info + and kernel_type in platform_info["test-runs-on-kernel"] + ): + matrix_row["test-runs-on"] = platform_info[ + "test-runs-on-kernel" + ][kernel_type] + # Otherwise, we disable the test runner for this architecture + else: + matrix_row["test-runs-on"] = "" + if "test-runs-on-multi-gpu" in platform_info: + matrix_row["test-runs-on-multi-gpu"] = "" + break + matrix_output.append(matrix_row) print(f"Generated build matrix: {str(matrix_output)}") @@ -766,6 +807,9 @@ def format_variants(variants): base_args["workflow_dispatch_windows_test_labels"] = os.getenv( "WINDOWS_TEST_LABELS", "" ) + base_args["workflow_dispatch_additional_label_options"] = os.getenv( + "ADDITIONAL_LABEL_OPTIONS", "" + ) base_args["build_variant"] = os.getenv("BUILD_VARIANT", "release") base_args["multi_arch"] = os.environ.get("MULTI_ARCH", "false") == "true" diff --git a/build_tools/github_actions/tests/configure_ci_test.py b/build_tools/github_actions/tests/configure_ci_test.py index ad12290c073..689e793ad28 100644 --- a/build_tools/github_actions/tests/configure_ci_test.py +++ b/build_tools/github_actions/tests/configure_ci_test.py @@ -293,6 +293,28 @@ def test_invalid_test_label_linux_pull_request_matrix_generator(self): ) self.assertEqual(linux_test_labels, []) + def test_kernel_test_label_linux_pull_request_matrix_generator(self): + base_args = { + "pr_labels": '{"labels":[{"name":"test_runner:oem"}]}', + "build_variant": "release", + } + linux_target_output, linux_test_labels = configure_ci.matrix_generator( + is_pull_request=True, + is_workflow_dispatch=False, + is_push=False, + is_schedule=False, + base_args=base_args, + families={}, + platform="linux", + ) + self.assertGreaterEqual(len(linux_target_output), 1) + # check that at least one runner name has "oem" in test runner name if "oem" test runner was requested + self.assertTrue("oem" in item["test-runs-on"] for item in linux_target_output) + self.assert_target_output_is_valid( + target_output=linux_target_output, allow_xfail=False + ) + self.assertEqual(linux_test_labels, []) + def test_main_linux_branch_push_matrix_generator(self): base_args = {"branch_name": "main", "build_variant": "release"} linux_target_output, linux_test_labels = configure_ci.matrix_generator( diff --git a/build_tools/print_driver_gpu_info.py b/build_tools/print_driver_gpu_info.py index 29c72390db8..9babdc3d36d 100644 --- a/build_tools/print_driver_gpu_info.py +++ b/build_tools/print_driver_gpu_info.py @@ -120,6 +120,12 @@ def run_sanity(os_name: str) -> None: args=[], extra_command_search_paths=[bin_dir], ) + run_command_with_search( + label="Kernel version", + command="uname -r", + args=[], + extra_command_search_paths=[bin_dir], + ) log("\n=== End of sanity check ===") diff --git a/docs/development/ci_behavior_manipulation.md b/docs/development/ci_behavior_manipulation.md index 4049fd81726..e3454dd2198 100644 --- a/docs/development/ci_behavior_manipulation.md +++ b/docs/development/ci_behavior_manipulation.md @@ -16,6 +16,7 @@ However, if additional options are wanted, you can add a label to manipulate the - `run-all-archs-ci`: The CI will build all possible architectures - `gfx...`: A build and test (if a test machine is available) is added to the CI matrix for the specified gfx family. (ex: `gfx120X`, `gfx950`) - `test:...`: The full test will run only for the specified label and other labeled projects (ex: `test:rocthrust`, `test:hipblaslt`) +- `test_runner:...`: The CI will run tests on only custom test machines (ex: `test_runner:oem`) ## Workflow dispatch behavior