Skip to content

Commit 5907a05

Browse files
committed
Fix misc
Signed-off-by: zichguan-amd <zichuan.guan@amd.com>
1 parent ec7d459 commit 5907a05

8 files changed

Lines changed: 69 additions & 58 deletions

File tree

.github/build_tools/configure_ci.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,20 @@
66
# GPU target to TheRock family mapping
77
GPU_CONFIG_MAP = {
88
"gfx1100": "gfx110X-all",
9-
"gfx90a": "gfx90X-dcgpu",
10-
"gfx942": "gfx94X-dcgpu",
9+
"gfx1151": "gfx1151",
10+
# "gfx1201": "gfx120X-all",
11+
# "gfx90a": "gfx90X-dcgpu",
12+
# "gfx942": "gfx94X-dcgpu",
1113
}
1214

1315
# Default configurations for automated runs (push/PR)
14-
ALLOWED_INSTALL_METHODS = ["wheel", "tarball"]
15-
16+
INSTALL_METHODS = ["wheel", "tarball"]
1617

1718
def main():
1819
# Read inputs from environment (set by workflow)
1920
gpu_input = os.getenv("GPU_CONFIG", "")
2021
install_input = os.getenv("INSTALL_METHOD", "")
2122

22-
23-
2423
# Determine GPU configurations
2524
if gpu_input:
2625
if gpu_input not in GPU_CONFIG_MAP:
@@ -32,12 +31,12 @@ def main():
3231

3332
# Determine install methods
3433
if install_input:
35-
if install_input not in ALLOWED_INSTALL_METHODS:
36-
raise ValueError(f"Invalid install method: {install_input}. Allowed: {ALLOWED_INSTALL_METHODS}")
34+
if install_input not in INSTALL_METHODS:
35+
raise ValueError(f"Invalid install method: {install_input}. Allowed: {INSTALL_METHODS}")
3736
install_methods = [install_input]
3837
else:
3938
# Automated run: use all allowed methods
40-
install_methods = ALLOWED_INSTALL_METHODS
39+
install_methods = INSTALL_METHODS
4140

4241
# Build gpu_config array with both gpu_target and therock_family
4342
gpu_configs = []
@@ -54,12 +53,9 @@ def main():
5453
with open(github_output, "a") as f:
5554
f.write(f"gpu_configs={json.dumps(gpu_configs)}\n")
5655
f.write(f"install_methods={json.dumps(install_methods)}\n")
57-
print(f"Wrote outputs to {github_output}")
58-
else:
59-
# Local testing
60-
print(f"gpu_configs={json.dumps(gpu_configs)}")
61-
print(f"install_methods={json.dumps(install_methods)}")
6256

57+
print(f"gpu_configs={json.dumps(gpu_configs)}")
58+
print(f"install_methods={json.dumps(install_methods)}")
6359

6460
if __name__ == "__main__":
6561
main()

.github/workflows/build_docker.yml

Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
name: Build Docker
22

33
on:
4+
workflow_dispatch:
45
push:
5-
branches: [ amd-staging, amd-mainline, release/** ]
6+
branches: [ amd-staging ]
67
paths:
78
- 'Dockerfiles/**'
8-
- '.github/workflows/**'
9+
- '.github/workflows/build_docker.yml'
910
pull_request:
1011
branches: [ amd-staging, amd-mainline, release/** ]
1112
paths:
1213
- 'Dockerfiles/**'
13-
- '.github/workflows/**'
14+
- '.github/workflows/build_docker.yml'
1415

1516
permissions:
1617
contents: read
@@ -25,53 +26,49 @@ env:
2526
IMAGE_PREFIX: ${{ github.repository }}
2627

2728
jobs:
28-
find-dockerfiles:
29+
find-dockerfiles:
2930
name: Find Dockerfiles
3031
runs-on: ubuntu-latest
31-
outputs:
32+
outputs:
3233
files: ${{ steps.find-files.outputs.files }}
33-
steps:
34-
- name: Checkout repository
35-
uses: actions/checkout@v4
36-
- name: Find Dockerfiles
37-
id: find-files
38-
run: |
39-
echo "## Finding all Dockerfiles in the 'Dockerfiles/' directory"
40-
FILES=$(find Dockerfiles/ -type f -printf "%f\n" | grep .*Dockerfile)
41-
echo "Found Dockerfiles:"
42-
echo "$FILES"
43-
# Convert the array to JSON array
44-
JSON_ARRAY=$(printf '%s\n' "${FILES[@]}" | jq -R . | jq -s . | jq -c .)
34+
steps:
35+
- name: Checkout repository
36+
uses: actions/checkout@v4
37+
- name: Find Dockerfiles
38+
id: find-files
39+
run: |
40+
echo "## Finding all Dockerfiles in the 'Dockerfiles/' directory"
41+
FILES=$(find Dockerfiles/ -type f -printf "%f\n" | grep .*Dockerfile)
42+
echo "Found Dockerfiles:"
43+
echo "${FILES}"
44+
# Convert the array to JSON array
45+
JSON_ARRAY=$(printf '%s\n' "${FILES[@]}" | jq -R . | jq -s . | jq -c .)
4546
echo "JSON_ARRAY is"
46-
echo $JSON_ARRAY
47-
echo "files=$JSON_ARRAY" >> $GITHUB_OUTPUT
48-
49-
# Clean the workspace here since other jobs may not have the permissions to do so later
50-
# (needed for self-hosted runners)
51-
- name: Clean the workspace
52-
run: find $GITHUB_WORKSPACE -mindepth 1 -delete
47+
echo "${JSON_ARRAY}"
48+
echo "files=${JSON_ARRAY}" >> $GITHUB_OUTPUT
5349
5450
build:
5551
name: Build Docker Images
56-
runs-on: self-hosted
52+
runs-on: ubuntu-latest
5753
needs: find-dockerfiles
5854
strategy:
55+
fail-fast: false
5956
matrix:
6057
file: ${{fromJson(needs.find-dockerfiles.outputs.files)}}
6158
steps:
62-
- name: Checkout repository
63-
uses: actions/checkout@v4
59+
- name: Checkout repository
60+
uses: actions/checkout@v4
6461

65-
- name: Set up Docker Buildx
66-
uses: docker/setup-buildx-action@v3
62+
- name: Set up Docker Buildx
63+
uses: docker/setup-buildx-action@v3
6764

6865
- name: Generate image tag
6966
id: image-tag
7067
run: |
71-
# Extract image name from Dockerfile name (e.g., "ubuntu-22.04-rocm.Dockerfile" -> "ubuntu-22.04-rocm")
68+
# Extract image name from Dockerfile name (e.g., "ubuntu-22.04.Dockerfile" -> "ubuntu-22.04")
7269
IMAGE_NAME=$(echo "${{ matrix.file }}" | sed 's/\.Dockerfile$//' | tr '[:upper:]' '[:lower:]')
73-
echo "name=$IMAGE_NAME" >> $GITHUB_OUTPUT
74-
echo "Image name: $IMAGE_NAME"
70+
echo "name=${IMAGE_NAME}" >> $GITHUB_OUTPUT
71+
echo "Image name: ${IMAGE_NAME}"
7572
7673
- name: Log in to GHCR
7774
if: github.event_name == 'push'
@@ -81,18 +78,19 @@ jobs:
8178
username: ${{ github.actor }}
8279
password: ${{ secrets.GITHUB_TOKEN }}
8380

81+
- name: Extract metadata (tags, labels) for Docker
82+
id: meta
83+
uses: docker/metadata-action@v5
84+
with:
85+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}-${{ steps.image-tag.outputs.name }}
86+
tags: |
87+
type=raw,value=latest,enable={{is_default_branch}}
88+
8489
- name: Build and push Docker image for ${{ matrix.file }}
8590
uses: docker/build-push-action@v5
86-
with:
91+
with:
8792
context: Dockerfiles/
8893
file: Dockerfiles/${{ matrix.file }}
8994
push: ${{ github.event_name == 'push' }}
90-
tags: |
91-
${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}:${{ steps.image-tag.outputs.name }}
92-
${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}:${{ steps.image-tag.outputs.name }}-${{ github.sha }}
93-
94-
# Clean the workspace here since other jobs may not have the permissions to do so later
95-
# (needed for self-hosted runners)
96-
- name: Clean the workspace
97-
if: always()
98-
run: find "$GITHUB_WORKSPACE" -mindepth 1 -delete
95+
tags: ${{ steps.meta.outputs.tags }}
96+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/ci_nightly.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ on:
1717
type: choice
1818
options:
1919
- gfx1100
20+
- gfx1151
21+
- gfx1201
22+
- gfx90a
23+
- gfx942
2024
install_method:
2125
description: "Installation method"
2226
required: true

.github/workflows/ci_therock.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ on:
3838
type: choice
3939
options:
4040
- gfx1100
41+
- gfx1151
42+
- gfx1201
43+
- gfx90a
44+
- gfx942
4145
install_method:
4246
description: "Installation method"
4347
required: true

Common/FilterHIPArchitectures.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function(filter_hip_architectures EXAMPLE_NAME SUPPORTED_ARCHS SHOULD_SKIP_VAR)
6060
endif()
6161

6262
if(NOT FILTERED_HIP_ARCHITECTURES)
63-
message(STATUS "${EXAMPLE_NAME}: No supported architectures found. Not building ${EXAMPLE_NAME}")
63+
message(WARNING "${EXAMPLE_NAME}: No supported architectures found. Not building ${EXAMPLE_NAME}")
6464
set(${SHOULD_SKIP_VAR} TRUE PARENT_SCOPE)
6565
else()
6666
# Override CMAKE_HIP_ARCHITECTURES for this directory scope

Dockerfiles/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,12 @@ Dockerfile: [hip-libraries-cuda-ubuntu.Dockerfile](hip-libraries-cuda-ubuntu.Doc
2828
This is environment is based on Ubuntu targeting the CUDA platform. It has the
2929
HIP runtime and the ROCm libraries installed. CMake is also installed in the image.
3030
It can be used with the samples that support the CUDA target.
31+
32+
### CI base images
33+
34+
Lightweight base images for CI workflows based on various supported Linux distributions. The images include a Python virtual environment and complete system dependencies to build rocm-examples from source, but they **do not include any ROCm installation**.
35+
36+
Dockerfiles:
37+
38+
- [ubuntu-22.04.Dockerfile](ubuntu-22.04.Dockerfile)
39+
- [sles-15.7.Dockerfile](sles-15.7.Dockerfile)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ ENV HIP_PLATFORM=amd
6161
# Create virtual environment with base packages
6262
RUN python3.13 -m venv /opt/venv && \
6363
/opt/venv/bin/pip install --upgrade pip && \
64-
/opt/venv/bin/pip install pyyaml cmake
64+
/opt/venv/bin/pip install pyyaml
6565

6666
# Set up virtual environment in PATH
6767
ENV PATH="/opt/venv/bin:${PATH}"

0 commit comments

Comments
 (0)