Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
40 changes: 38 additions & 2 deletions .github/workflows/multi_arch_build_native_windows_packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ on:
description: "Branch, tag, or SHA to checkout. Defaults to the triggering ref."
type: string
default: ""
quartz_tracking_id:
description: >-
Leave empty. Internal Quartz tracking id, set automatically by the
top-level orchestrator to link this run to its release lineage. Do not
set it manually.
type: string
default: ""
workflow_call:
inputs:
artifact_github_repo:
Expand All @@ -63,6 +70,9 @@ on:
ref:
type: string
default: ""
quartz_tracking_id:
type: string
default: ""

permissions:
contents: read
Expand All @@ -84,7 +94,7 @@ jobs:
env:
ARTIFACT_RUN_ID: ${{ inputs.artifact_run_id }}
ARTIFACT_GITHUB_REPO: ${{ inputs.artifact_github_repo }}
PACKAGE_VERSION: ${{ inputs.rocm_version }}
ROCM_VERSION: ${{ inputs.rocm_version }}
PACKAGES: ${{ inputs.packages }}
MSI_DIR: ${{ github.workspace }}/msi-output
RELEASE_TYPE: ${{ inputs.release_type }}
Expand All @@ -105,6 +115,31 @@ jobs:
- name: Install Python requirements
run: pip install -r requirements.txt

# The incoming rocm_version is the PEP440 wheel version (e.g.
# 10.2.0.dev0+<sha>), which WiX rejects (WIX0108: the MSI ProductVersion
# must be numeric #.#.#.#). Derive the numeric MSI ProductVersion
# (major.minor.<days-since-2016-04-01>.0) for Package/@Version; the full
# rocm_version is kept as the display version (ARP + discovery key). Writes
# to GITHUB_ENV rather than capturing stdout, since the helper logs there.
- name: Compute MSI version
run: |
python - <<'PY'
import os, re
from compute_rocm_package_version import compute_msi_build_field

rocm_version = os.environ["ROCM_VERSION"]
m = re.match(r"^(\d+)\.(\d+)\.", rocm_version)
if not m:
raise SystemExit(f"cannot parse major.minor from {rocm_version!r}")
major, minor = m.group(1), m.group(2)
msi_version = f"{major}.{minor}.{compute_msi_build_field()}.0"
with open(os.environ["GITHUB_ENV"], "a") as f:
f.write(f"MSI_PACKAGE_VERSION={msi_version}\n")
print(f"MSI ProductVersion: {msi_version} (display {rocm_version})")
PY
env:
PYTHONPATH: ${{ github.workspace }}/build_tools

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Relating to my other comment - no logic in workflow files! ESPECIALLY inline python like this, that is significantly worse than inline bash. Follow the style guide: https://github.com/ROCm/TheRock/blob/main/docs/development/style_guides/github_actions_style_guide.md#prefer-python-scripts-over-inline-bash

The versions are already computed at the start of the CI pipeline, just pass them through to this workflow. No need to say "well you passed me a python version so now I'll convert it to the version I actually want" - just pass the versions that the script wants directly.

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.

Done in b0f3450 — removed the inline-python step entirely. The WiX-legal MSI ProductVersion is now computed once upstream (setup_multi_arch.yml already runs compute_rocm_package_version.py, which emits rocm_msi_package_version) and threaded through multi_arch_ci.yml → multi_arch_ci_windows.yml → the build workflow as a new msi_version input, mirroring how the deb/rpm versions are passed. The build workflow now receives both the display version (rocm_version) and the numeric ProductVersion (msi_version) directly.


# Pin to WiX v4: v5+ compiles the same schema but v7 gates every command
# behind the OSMF EULA (error WIX7015), which would fail unattended CI.
- name: Install WiX Toolset v4
Expand All @@ -131,7 +166,8 @@ jobs:
--packages "${PACKAGES}" \
--run-id "${ARTIFACT_RUN_ID}" \
--run-github-repo "${ARTIFACT_GITHUB_REPO}" \
--package-version "${PACKAGE_VERSION}" \
--package-version "${MSI_PACKAGE_VERSION}" \
--display-version "${ROCM_VERSION}" \
--output-dir "${MSI_DIR}"

# Compile every generated .wxs into a matching .msi alongside it.
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/multi_arch_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ on:
type: boolean
default: true
description: "Build native Linux packages and run install tests"
build_native_windows:
type: boolean
default: true
description: "Build native Windows packages (MSI)"
# --- Artifact reuse ---
prebuilt_stages:
type: string
Expand Down Expand Up @@ -113,6 +117,9 @@ on:
build_native_linux:
type: boolean
default: true
build_native_windows:
type: boolean
default: true
prebuilt_stages:
type: string
default: ""
Expand Down Expand Up @@ -170,6 +177,7 @@ jobs:
build_pytorch: ${{ github.event_name != 'workflow_dispatch' || inputs.build_pytorch }}
build_jax: ${{ github.event_name != 'workflow_dispatch' || inputs.build_jax }}
build_native_linux: ${{ github.event_name != 'workflow_dispatch' || inputs.build_native_linux }}
build_native_windows: ${{ github.event_name != 'workflow_dispatch' || inputs.build_native_windows }}
build_stages: ${{ inputs.build_stages || '' }}

linux_build_and_test:
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/multi_arch_ci_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,28 @@ jobs:
contents: read
id-token: write

# Build the native Windows MSI installer(s) from this run's artifacts. In CI
# the MSI is produced and uploaded to the run's artifacts bucket (a build
# artifact) to exercise the packaging path; it is not published to a release
# bucket here (that happens only in the release workflow).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Done in b0f3450 — removed the comment.

build_native_msi_packages:
needs: [build_multi_arch_stages]
name: Build Native MSI Packages
if: ${{ !failure() && !cancelled() && !contains(needs.*.result, 'cancelled') && fromJSON(inputs.build_config).build_native_windows == true }}
uses: ./.github/workflows/multi_arch_build_native_windows_packages.yml
with:
artifact_run_id: ${{ github.run_id }}
rocm_version: ${{ inputs.rocm_package_version }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this the version you want to pass?

Native Linux packaging workflows pass the deb/rpm version here:

build_native_deb_packages:
needs: [build_multi_arch_stages]
name: Build DEB Packages
if: ${{ !failure() && !cancelled() && !contains(needs.*.result, 'cancelled') && fromJSON(inputs.build_config).build_native_linux == true }}
uses: ./.github/workflows/multi_arch_build_native_linux_packages.yml
with:
dist_amdgpu_families: ${{ fromJSON(inputs.build_config).dist_amdgpu_families }}
rocm_version: ${{ inputs.rocm_deb_package_version }}

I would suggest passing both the user-facing version and the build version as two separate inputs.

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.

Addressed in b0f3450 — now passing two separate inputs: rocm_version (user-facing display version) and msi_version (the WiX-legal numeric ProductVersion from setup.outputs.rocm_msi_package_version), matching the deb/rpm pattern you linked. The release path is wired the same way in the companion PR #9371 (commit 4847342).

# Only the runtime package is published in nightly artifacts today; core's
# Windows artifacts (core-amdsmi, core-runtime) are not yet available.
packages: runtime

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is a CI workflow. Why does it mention "nightly" artifacts?

Dev -> Nightly -> Prod. This is dev.

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.

Done in b0f3450 — reworded from "nightly" to "CI" artifacts (this is the dev/CI path).

release_type: ${{ inputs.release_type }}
repository: ${{ inputs.repository }}
ref: ${{ inputs.ref }}
permissions:
contents: read
id-token: write

test_python_packages_per_family:
needs: [build_python_packages]
name: Test Python
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/setup_multi_arch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ on:
description: "Build native Linux packages (deb/rpm) and run their install tests."
type: boolean
default: true
build_native_windows:
description: "Build native Windows packages (MSI)."
type: boolean
default: true
Comment on lines +94 to +97

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Note that we may want to set this explicitly in repositories that use TheRock CI, as is done for build_native_linux: https://github.com/ROCm/rocm-libraries/blob/04e9f86ab9e6e49e64c820ba97b4cea16e5a5fed/.github/workflows/therock-multi-arch-ci.yml#L178-L180

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.

Good point — noted. This PR keeps the default true so TheRock CI behavior is unchanged; I'll follow up to set build_native_windows explicitly in the downstream repo CI configs (rocm-libraries/rocm-systems) the same way build_native_linux is, as a separate change.

python_version:
description: "Single Python version for wheel builds; empty uses the default matrix."
type: string
Expand Down Expand Up @@ -246,6 +250,7 @@ jobs:
BUILD_PYTORCH: ${{ inputs.build_pytorch }}
BUILD_JAX: ${{ inputs.build_jax }}
BUILD_NATIVE_LINUX: ${{ inputs.build_native_linux }}
BUILD_NATIVE_WINDOWS: ${{ inputs.build_native_windows }}
PYTHON_VERSION: ${{ inputs.python_version }}
LINUX_AMDGPU_FAMILIES: ${{ inputs.linux_amdgpu_families }}
WINDOWS_AMDGPU_FAMILIES: ${{ inputs.windows_amdgpu_families }}
Expand Down
73 changes: 66 additions & 7 deletions build_tools/compute_rocm_package_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@
"""Computes a ROCm package version with an appropriate suffix for a given release type.

For usage from other Python scripts, call the `compute_version()` function
directly. When used from GitHub Actions, this writes all three version outputs
to GITHUB_OUTPUT:
directly. When used from GitHub Actions, this writes all version outputs to
GITHUB_OUTPUT:
- 'rocm_package_version' for wheel packages
- 'rocm_deb_package_version' for deb packages
- 'rocm_rpm_package_version' for rpm packages
- 'rocm_msi_package_version' for Windows MSI packages

Sample usage:

python compute_rocm_package_version.py --release-type=dev
# rocm_package_version=7.10.0.dev0+f689a8ea40232f3f6be1ec958354b108349023ff
# rocm_deb_package_version=7.10.0~dev20251203
# rocm_rpm_package_version=7.10.0~20251203gf689a8e
# rocm_msi_package_version=7.10.3929.0 (major.minor.<days-since-2016-04-01>.0)

python compute_rocm_package_version.py --release-type=prerelease --prerelease-version=2
# rocm_package_version=7.10.0rc2
Expand All @@ -43,7 +45,7 @@

import argparse
from collections.abc import Mapping
from datetime import datetime
from datetime import date, datetime
from pathlib import Path
import json
import os
Expand All @@ -56,6 +58,16 @@
THIS_SCRIPT_DIR = Path(__file__).resolve().parent
THEROCK_DIR = THIS_SCRIPT_DIR.parent

# Epoch for the MSI ProductVersion build field: the first ROCm release (ROCm 1.0,
# April 2016). The MSI version's third field is the number of days since this
# date, giving a strictly increasing, WiX-legal integer. See compute_msi_build_field.
MSI_EPOCH = date(2016, 4, 1)

# Windows Installer compares only the first three ProductVersion fields and caps
# the third (build) field at 65535. days-since-MSI_EPOCH stays under this until
# ~year 2195, after which a build would raise rather than silently wrap.
MSI_BUILD_FIELD_MAX = 65535


def _log(*args, **kwargs):
print(*args, **kwargs)
Expand Down Expand Up @@ -137,6 +149,27 @@ def get_current_date():
return datetime.today().strftime("%Y%m%d")


def compute_msi_build_field(today: date | None = None) -> int:
"""Return the MSI ProductVersion build field: days since MSI_EPOCH.

This is the third field of the four-field MSI version. It increases by one
per day, so a later build always outranks an earlier one within its
major.minor line (Windows Installer compares only the first three fields).
Raises if it would exceed the installer's 65535 limit.
"""
if today is None:
today = date.today()
days = (today - MSI_EPOCH).days
if days < 0:
raise ValueError(f"build date {today} precedes the MSI epoch {MSI_EPOCH}")
if days > MSI_BUILD_FIELD_MAX:
raise ValueError(
f"MSI build field {days} exceeds the Windows Installer limit of "
f"{MSI_BUILD_FIELD_MAX} (third ProductVersion field)"
)
return days


def compute_version(
package_type: str = "wheel",
release_type: str | None = None,
Expand All @@ -149,7 +182,7 @@ def compute_version(
"""Compute package version based on package type and release type.

Args:
package_type: Type of package ("wheel", "deb", or "rpm")
package_type: Type of package ("wheel", "deb", "rpm", or "msi")
release_type: Release type ("ci", "dev", "dev-bkc", "nightly",
"nightly-bkc", "prerelease", or "release")
custom_version_suffix: Custom suffix to override automatic suffix
Expand Down Expand Up @@ -183,6 +216,32 @@ def compute_version(
f"for release type '{release_type}'"
)

# Handle Windows MSI packages (WiX ProductVersion: numeric major.minor.build.0).
#
# Unlike the other package types, the MSI version does NOT carry a dev/nightly
# suffix: Windows Installer versions must be numeric #.#.#.# and it compares
# only the first three fields. We keep major.minor from version.json visible
# and put the build DATE (days since the ROCm 1.0 epoch) in the third field,
# so every build outranks the previous one within its major.minor line. The
# marketing patch (e.g. 10.2.0) is surfaced separately via the MSI's
# ARPDISPLAYVERSION property, not here. Cross-line coexistence (10.2 vs 10.3)
# is handled by a per-major.minor UpgradeCode in the generator, so this field
# never has to order across lines. All release types share one shape; a
# release simply has the highest build field in its line because it is built
# last (no further nightlies follow a major.minor's release).
if package_type == "msi":

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Rather than add msi before python packages and native linux packages, can you sort this as:

  1. Python
  2. Native Linux
  3. Native Windows

matching what we have in the versioning.md and releases.md docs?

So something like this in code:

    if package_type == "wheel":
        ...
    elif package_type == "deb" or package_type == "rpm":
        ...
    elif package_type == "msi":
        ...
    else:
      raise AssertionError(f"Unexpected package type: {package_type}")

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.

Done in b0f3450 — reordered the branches to wheel → deb/rpm → msi and added an explicit else: raise AssertionError(f"Unexpected package type: {package_type}").

parts = base_version.split(".")
if len(parts) < 2 or not parts[0] or not parts[1]:
raise ValueError(
f"base version must be at least major.minor for msi (got "
f"{base_version!r})"
)
major, minor = parts[0], parts[1]
build_field = compute_msi_build_field()
rocm_package_version = f"{major}.{minor}.{build_field}.0"
_log(f"Full version : '{rocm_package_version}'")
return rocm_package_version

# Handle wheel packages (Python packaging standards)
if package_type == "wheel":
if custom_version_suffix:
Expand Down Expand Up @@ -315,9 +374,9 @@ def main(argv):

version_data = load_version_file()

# Compute versions for all three package types: wheel, deb, and rpm
# Compute versions for all package types: wheel, deb, rpm, and msi.
outputs = {}
for pkg_type in ["wheel", "deb", "rpm"]:
for pkg_type in ["wheel", "deb", "rpm", "msi"]:
version = compute_version(
package_type=pkg_type,
release_type=args.release_type,
Expand All @@ -331,7 +390,7 @@ def main(argv):
# Set appropriate output variable based on package type
if pkg_type == "wheel":
outputs["rocm_package_version"] = version
else: # deb or rpm
else: # deb, rpm, or msi
outputs[f"rocm_{pkg_type}_package_version"] = version

gha_set_output(outputs)
Expand Down
2 changes: 2 additions & 0 deletions build_tools/github_actions/configure_ci_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,12 @@ class Label:
Label("ci:build-pytorch", COLOR_CI_PACKAGING, "Opt-in to building PyTorch packages"),
Label("ci:build-jax", COLOR_CI_PACKAGING, "Opt-in to building JAX packages"),
Label("ci:build-native-linux", COLOR_CI_PACKAGING, "Opt-in to building native Linux packages"),
Label("ci:build-native-windows", COLOR_CI_PACKAGING, "Opt-in to building native Windows packages"),
Label("ci:build-python-packages", COLOR_CI_PACKAGING, "Opt-in to building Python packages"),
Label("ci:skip-pytorch", COLOR_CI_PACKAGING, "Skip PyTorch package builds"),
Label("ci:skip-jax", COLOR_CI_PACKAGING, "Skip JAX package builds"),
Label("ci:skip-native-linux", COLOR_CI_PACKAGING, "Skip native Linux package builds"),
Label("ci:skip-native-windows", COLOR_CI_PACKAGING, "Skip native Windows package builds"),
Label("ci:skip-python-packages", COLOR_CI_PACKAGING, "Skip Python package builds"),
]
# fmt: on
Expand Down
16 changes: 16 additions & 0 deletions build_tools/github_actions/configure_multi_arch_ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ class CIInputs:
build_pytorch: bool = True
build_jax: bool = False
build_native_linux: bool = True
build_native_windows: bool = True
python_versions: list[str] = field(default_factory=list)

# Labels from the PR event payload or workflow_dispatch pr_labels input.
Expand Down Expand Up @@ -330,6 +331,9 @@ def from_environ() -> "CIInputs":
build_native_linux = (
os.environ.get("BUILD_NATIVE_LINUX", "true").lower() != "false"
)
build_native_windows = (
os.environ.get("BUILD_NATIVE_WINDOWS", "true").lower() != "false"
)
python_version = os.environ.get("PYTHON_VERSION", "").strip()

pr_labels: list[str] = []
Expand Down Expand Up @@ -414,6 +418,7 @@ def from_environ() -> "CIInputs":
build_pytorch=build_pytorch,
build_jax=build_jax,
build_native_linux=build_native_linux,
build_native_windows=build_native_windows,
python_versions=[python_version] if python_version else [],
pr_labels=pr_labels,
pr_base_ref=pr_base_ref,
Expand Down Expand Up @@ -720,6 +725,7 @@ class BuildConfig:
build_variant_suffix: str
build_variant_cmake_preset: str
build_native_linux: bool
build_native_windows: bool
build_python_packages: bool
build_pytorch: bool
build_jax: bool
Expand Down Expand Up @@ -1752,6 +1758,8 @@ def _expand_build_config_for_platform(
else []
)
build_native_linux = ci_inputs.build_native_linux
# Native Windows (MSI) packages are built only on the windows platform.
build_native_windows = ci_inputs.build_native_windows and platform == "windows"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks like build_native_linux should also get and platform == "linux"?

Then I don't think the comment is useful

  • of course Linux requires Linux and Windows requires Windows
  • what type of windows package it is (MSI) isn't relevant here

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.

Done in b0f3450 — build_native_linux is now and platform == "linux" (matching windows), and dropped the comment.


# PR labels can override packaging build decisions.
pr_labels = ci_inputs.pr_labels
Expand All @@ -1760,6 +1768,12 @@ def _expand_build_config_for_platform(
elif "ci:skip-native-linux" in pr_labels:
build_native_linux = False

if platform == "windows":
if "ci:build-native-windows" in pr_labels:
build_native_windows = True
elif "ci:skip-native-windows" in pr_labels:
build_native_windows = False

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should also check if platform == "linux" here too? Or if not, why check for Windows?

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.

Done in b0f3450 — the native-linux overrides are now wrapped in if platform == "linux":, symmetric with the windows block, so each platform consults only its own labels.


if "ci:build-python-packages" in pr_labels:
build_python_packages = True
elif "ci:skip-python-packages" in pr_labels:
Expand All @@ -1785,6 +1799,7 @@ def _expand_build_config_for_platform(
build_pytorch = False
build_jax = False
build_native_linux = False
build_native_windows = False
pytorch_build_matrix = []
jax_build_matrix = []
test_python_packages_matrix = []
Expand All @@ -1797,6 +1812,7 @@ def _expand_build_config_for_platform(
build_variant_suffix=suffix,
build_variant_cmake_preset=variant_config["build_variant_cmake_preset"],
build_native_linux=build_native_linux,
build_native_windows=build_native_windows,
build_python_packages=build_python_packages,
build_pytorch=build_pytorch,
build_jax=build_jax,
Expand Down
1 change: 1 addition & 0 deletions build_tools/github_actions/skip-ci-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ filenames = [
"build_windows_python_packages.yml",
"manifest-diff.yml",
"multi_arch_build_native_linux_packages.yml",
"multi_arch_build_native_windows_packages.yml",
"multi_arch_build_portable_linux_artifacts.yml",
"multi_arch_build_portable_linux_pytorch_wheels_ci.yml",
"multi_arch_build_linux_jax_wheels_ci.yml",
Expand Down
Loading
Loading