Repository navigation
[CI][ROCm] Add opt-in TheRock builds for AMD CI #56351
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
Merged
+188
−20
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
582487c
[CI][ROCm] Add opt-in TheRock builds for AMD CI
AndreasKaratzas 21f99b3
[CI][ROCm] Allow custom Dockerfile pairs in AMD CI
AndreasKaratzas df17e69
[CI][ROCm] Remove added Dockerfile regression tests
AndreasKaratzas c33bf97
[CI][ROCm] Use Dockerfile overrides for custom AMD CI builds
AndreasKaratzas 6cf11d1
Merge branch 'main' into ci/rock-opt-in
AndreasKaratzas 6233a5b
Merge origin/main into ci/rock-opt-in
AndreasKaratzas 2895151
Merge branch 'main' into ci/rock-opt-in
AndreasKaratzas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| #!/usr/bin/env bash | ||
| # Shared Dockerfile selection for the normal AMD CI build chain. | ||
| # CI_ROCM_DOCKERFILE_BASE and CI_ROCM_DOCKERFILE accept repository-relative paths. | ||
| # VLLM_USE_ROCK=1 remains a shorthand; explicit Dockerfile settings take priority. | ||
| # Custom recipes must preserve the CI targets and artifact layout. Additional | ||
| # COPY inputs also need the corresponding *_CONTENT_FILES overrides. | ||
|
|
||
| rocm_base_dockerfile() { | ||
| local default="docker/Dockerfile.rocm_base" | ||
| if [[ "${VLLM_USE_ROCK:-0}" == "1" ]]; then | ||
| default="docker/Dockerfile.rock_base" | ||
| fi | ||
| printf '%s\n' "${CI_ROCM_DOCKERFILE_BASE:-${ROCM_BASE_DOCKERFILE:-${default}}}" | ||
| } | ||
|
|
||
| rocm_ci_dockerfile() { | ||
| local default="docker/Dockerfile.rocm" | ||
| if [[ "${VLLM_USE_ROCK:-0}" == "1" ]]; then | ||
| default="docker/Dockerfile.rock" | ||
| fi | ||
| printf '%s\n' "${CI_ROCM_DOCKERFILE:-${CI_BASE_DOCKERFILE:-${default}}}" | ||
| } | ||
|
|
||
| using_custom_rocm_dockerfiles() { | ||
| [[ "$(rocm_base_dockerfile)" != "docker/Dockerfile.rocm_base" \ | ||
| || "$(rocm_ci_dockerfile)" != "docker/Dockerfile.rocm" ]] | ||
| } | ||
|
|
||
| rocm_dockerfile_stages() { | ||
| awk ' | ||
| toupper($1) == "FROM" { | ||
| for (idx = 2; idx < NF; idx++) { | ||
| if (tolower($idx) == "as") print tolower($(idx + 1)) | ||
| } | ||
| } | ||
| ' "$1" | ||
| } | ||
|
|
||
| validate_rocm_dockerfile() { | ||
| local dockerfile="$1" | ||
| local stage="" | ||
| local stages="" | ||
| shift | ||
|
|
||
| case "${dockerfile}" in | ||
| /*|../*|*/../*|*/..|*[[:space:]]*) | ||
| echo "ROCm Dockerfile must be a repository-relative path without '..' or whitespace: ${dockerfile}" >&2 | ||
| return 2 | ||
| ;; | ||
| esac | ||
| if [[ ! -f "${dockerfile}" ]]; then | ||
| echo "ROCm Dockerfile not found: ${dockerfile}" >&2 | ||
| return 2 | ||
| fi | ||
| if (($#)) && ! awk ' | ||
| toupper($1) == "FROM" { | ||
| named = 0 | ||
| for (idx = 2; idx < NF; idx++) { | ||
| if (tolower($idx) == "as") named = 1 | ||
| } | ||
| if (!named) exit 1 | ||
| } | ||
| ' "${dockerfile}"; then | ||
| echo "ROCm Dockerfile must name every build stage: ${dockerfile}" >&2 | ||
| return 2 | ||
| fi | ||
| stages=$(rocm_dockerfile_stages "${dockerfile}") | ||
| for stage in "$@"; do | ||
| if ! grep -Fxq -- "${stage}" <<< "${stages}"; then | ||
| echo "ROCm Dockerfile ${dockerfile} is missing required stage: ${stage}" >&2 | ||
| return 2 | ||
| fi | ||
| done | ||
| } | ||
|
|
||
| configure_rocm_build() { | ||
| case "${VLLM_USE_ROCK:-0}" in | ||
| 0|1) ;; | ||
| *) | ||
| echo "VLLM_USE_ROCK must be 0 or 1" >&2 | ||
| return 2 | ||
| ;; | ||
| esac | ||
|
|
||
| ROCM_BASE_DOCKERFILE=$(rocm_base_dockerfile) | ||
| CI_BASE_DOCKERFILE=$(rocm_ci_dockerfile) | ||
| export ROCM_BASE_DOCKERFILE CI_BASE_DOCKERFILE | ||
| using_custom_rocm_dockerfiles || return 0 | ||
|
|
||
| # Custom stacks may supply dependencies without separate build stages. | ||
| export ROCM_DEP_CACHE_EXPORT_MODE=never | ||
|
|
||
| # Preserve the standard runtime tags, which are unique to each build, | ||
| # while preventing experimental builds from promoting stable images. | ||
| export ROCM_BASE_PUSH_STABLE_TAG=0 | ||
| export CI_BASE_PUSH_STABLE_TAG=0 | ||
| echo "Custom ROCm Dockerfiles: ${ROCM_BASE_DOCKERFILE} and ${CI_BASE_DOCKERFILE}" | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do we need
VLLM_USE_ROCK, or can we make the behavior that we just setCI_ROCM_DOCKERFILE_BASEandCI_ROCM_DOCKERFILEto the ROCk dockerfiles to override Dockerfile.rocm and Dockerfile.rocm_base?Basically, I am wondering if we can boil this PR down to just two additional env vars (
CI_ROCM_DOCKERFILE_BASEandCI_ROCM_DOCKERFILE) to override the Dockerfiles. This would be nice in case we want to support multiple dockerfiles/ROCm versions in the future (e.g. then we could also use this PR directly when we want to start testingDockerfile.rocm_base_gfx1250andDockerfile.rocm_gfx1250in CI).