Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if this option is only for PRs, you dont need those here as you can get the pr label content from the github event

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I plan on leaving this option in case developers want to test without waiting for build!

type: string
description: "If enabled, these additional labels options will be applied. ex: kernel:oem"
default: ""
artifact_run_id:
type: string
description: "If provided, the tests will run on this artifact ID"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
3 changes: 3 additions & 0 deletions build_tools/github_actions/amdgpu_family_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
46 changes: 45 additions & 1 deletion build_tools/github_actions/configure_ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down Expand Up @@ -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 "kernel" 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)}")
Expand Down Expand Up @@ -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"

Expand Down
20 changes: 20 additions & 0 deletions build_tools/github_actions/tests/configure_ci_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,26 @@ 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):
Comment thread
geomin12 marked this conversation as resolved.
base_args = {
"pr_labels": '{"labels":[{"name":"kernel: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)
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(
Expand Down
1 change: 1 addition & 0 deletions docs/development/ci_behavior_manipulation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
- `kernel:...`: The CI will run tests on only kernel-specific enabled test machines (ex: `kernel:oem`)

## Workflow dispatch behavior

Expand Down
Loading