← Back to Pull requests

Add docker image to use hermetic llvm and sysroot #782

Open
hsharsha opened this pull request with 686 lines diff across 33 files
View on GitHub
hsharsha hsharsha commented on May 29, 2026 20:13 UTC
Author

Add docker image to build and test JAX and XLA using hermetic llvm and sysroot based on ub22 image used for ml-build images

Diff: 686 lines (+618 / -68) across 33 files Reviewer: leo-automation Review duration: 260176m
All Vouch review confidence checks passed
Residual risk 0.08 = Change Risk (0.78) × (1 − Review Confidence (0.89)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.78 · 686 lines diff across 33 files
0.78
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.90 · 5 substantive comment(s)
0.90
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
89%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.391
Mass File Touch mass_file_touch
0.080
Real PR Conversation Timeline
13 items
hsharsha hsharsha commented on May 29, 2026 20:40 UTC
Author

@mminutoli should we keep docker files here now that rocm-jax would be depricated. Or do we still want to keep all the infra related files there?

leo-automation leo-automation commented on code on Jun 01, 2026 10:46 UTC
Code Review
.github/workflows/build_docker.yml:1
@@ -0,0 +1,61 @@
+name: Build docker
+
+on:
+  workflow_call:
+    inputs:
+      rocm-version:
+        required: true
+        type: string
+      runner-label:
+        required: false
+        type: string
+      artifact-prefix:
+        required: false
+        default: 'plugin_wheels'
+        type: string
+      extra-cr-tag:
+        required: false
+        type: string
+
+jobs:
+  build-docker:
+    runs-on: ${{ fromJSON(inputs.runner-label) }}
+    steps:
+      - name: Clean up old runs
+        run: |
+          ls -lah
+          # Make sure that we own all of the files so that we have permissions to delete them
+          docker run --rm -v "./:/rocm-jax" ubuntu \
+            /bin/bash -c "shopt -s dotglob; chown -R $UID /rocm-jax/* || true"
+          # Remove any old work directories from this machine
+          rm -rf * || true
+          ls -lah
+          # Clean up any docker stuff that's more than a week old
+          docker system prune -a --filter "until=168h"
+          # Stop any containers running for more than 12 hours. No CI job should take this long.
+          docker ps --format="{{.RunningFor}} {{.Names}}" | grep hours \
+              | awk -F: '{if($1>12)print$1}' | awk ' {print $4} ' | xargs docker stop || true
+      - name: Print system info
+        run: |
+          whoami
+          printenv
+          df -h
+          rocm-smi -a || true
+          rocminfo | grep gfx || true
+      - uses: actions/checkout@v4
+      - name: Download wheel artifacts
+        uses: actions/download-artifact@v4
+        with:
+          name: ${{ inputs.artifact-prefix }}_r${{ inputs.rocm-version }}
+          path: ./wheelhouse
+      - name: Authenticate to GitHub Container Registry
+        run: |
+          echo "${{ secrets.GITHUB_TOKEN }}" \
+            | docker login ghcr.io -u ${{ github.actor }} --password-stdin
+      - name: Build and push JAX docker image
+        run: |
+          working-directory: ./build/rocm/docker/

Probably a typo, it needs to be its own line. As it is now, the script will fail

leo-automation leo-automation commented on code on Jun 01, 2026 10:49 UTC
Code Review
build/rocm/docker/setup.rocm.sh:1
@@ -0,0 +1,155 @@
+#!/usr/bin/env bash
+#
+# Copyright 2022 The TensorFlow Authors. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ==============================================================================
+#
+# setup.rocm.sh: Prepare the ROCM installation on the container.
+# Usage: setup.rocm.sh <ROCM_VERSION> <DISTRO>
+# Supported Distros:
+#   - focal
+#   - jammy
+#   - el7
+#   - el8
+set -x

set -euo pipefail
set -x

leo-automation leo-automation commented on code on Jun 01, 2026 10:50 UTC
Code Review
.github/workflows/build_docker.yml:1
@@ -0,0 +1,61 @@
+name: Build docker
+
+on:
+  workflow_call:
+    inputs:
+      rocm-version:
+        required: true
+        type: string
+      runner-label:
+        required: false
+        type: string
+      artifact-prefix:
+        required: false
+        default: 'plugin_wheels'
+        type: string
+      extra-cr-tag:
+        required: false
+        type: string
+
+jobs:
+  build-docker:
+    runs-on: ${{ fromJSON(inputs.runner-label) }}

    runs-on: ${{ inputs.runner-label }}

leo-automation leo-automation commented on code on Jun 01, 2026 10:52 UTC
Code Review
.github/workflows/build_docker.yml:1
@@ -0,0 +1,61 @@
+name: Build docker
+
+on:
+  workflow_call:
+    inputs:
+      rocm-version:
+        required: true
+        type: string
+      runner-label:
+        required: false
+        type: string
+      artifact-prefix:
+        required: false
+        default: 'plugin_wheels'
+        type: string
+      extra-cr-tag:

Defined, but never used

leo-automation leo-automation commented on code on Jun 01, 2026 10:54 UTC
Code Review
.github/workflows/build_docker.yml:1
@@ -0,0 +1,61 @@
+name: Build docker
+
+on:
+  workflow_call:
+    inputs:
+      rocm-version:
+        required: true
+        type: string
+      runner-label:
+        required: false
+        type: string
+      artifact-prefix:
+        required: false
+        default: 'plugin_wheels'
+        type: string
+      extra-cr-tag:
+        required: false
+        type: string
+
+jobs:
+  build-docker:
+    runs-on: ${{ fromJSON(inputs.runner-label) }}
+    steps:
+      - name: Clean up old runs
+        run: |
+          ls -lah
+          # Make sure that we own all of the files so that we have permissions to delete them
+          docker run --rm -v "./:/rocm-jax" ubuntu \
+            /bin/bash -c "shopt -s dotglob; chown -R $UID /rocm-jax/* || true"
+          # Remove any old work directories from this machine
+          rm -rf * || true
+          ls -lah
+          # Clean up any docker stuff that's more than a week old
+          docker system prune -a --filter "until=168h"
+          # Stop any containers running for more than 12 hours. No CI job should take this long.
+          docker ps --format="{{.RunningFor}} {{.Names}}" | grep hours \
+              | awk -F: '{if($1>12)print$1}' | awk ' {print $4} ' | xargs docker stop || true
+      - name: Print system info
+        run: |
+          whoami
+          printenv
+          df -h
+          rocm-smi -a || true
+          rocminfo | grep gfx || true
+      - uses: actions/checkout@v4

We should be using v6+ on actions/checkou or pinned hashes

leo-automation leo-automation commented on code on Jun 01, 2026 10:55 UTC
Code Review
.github/workflows/build_docker.yml:1
@@ -0,0 +1,61 @@
+name: Build docker
+
+on:
+  workflow_call:
+    inputs:
+      rocm-version:
+        required: true
+        type: string
+      runner-label:
+        required: false
+        type: string
+      artifact-prefix:
+        required: false
+        default: 'plugin_wheels'
+        type: string
+      extra-cr-tag:
+        required: false
+        type: string
+
+jobs:
+  build-docker:
+    runs-on: ${{ fromJSON(inputs.runner-label) }}
+    steps:
+      - name: Clean up old runs
+        run: |
+          ls -lah
+          # Make sure that we own all of the files so that we have permissions to delete them
+          docker run --rm -v "./:/rocm-jax" ubuntu \
+            /bin/bash -c "shopt -s dotglob; chown -R $UID /rocm-jax/* || true"
+          # Remove any old work directories from this machine
+          rm -rf * || true
+          ls -lah
+          # Clean up any docker stuff that's more than a week old
+          docker system prune -a --filter "until=168h"
+          # Stop any containers running for more than 12 hours. No CI job should take this long.
+          docker ps --format="{{.RunningFor}} {{.Names}}" | grep hours \
+              | awk -F: '{if($1>12)print$1}' | awk ' {print $4} ' | xargs docker stop || true
+      - name: Print system info
+        run: |
+          whoami
+          printenv
+          df -h
+          rocm-smi -a || true
+          rocminfo | grep gfx || true
+      - uses: actions/checkout@v4
+      - name: Download wheel artifacts
+        uses: actions/download-artifact@v4

Same. Needs a relevant version and pinned hash

leo-automation leo-automation commented on code on Jun 01, 2026 10:57 UTC
Code Review
build/rocm/docker/setup.rocm.sh:1
@@ -0,0 +1,155 @@
+#!/usr/bin/env bash
+#
+# Copyright 2022 The TensorFlow Authors. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ==============================================================================
+#
+# setup.rocm.sh: Prepare the ROCM installation on the container.
+# Usage: setup.rocm.sh <ROCM_VERSION> <DISTRO>
+# Supported Distros:
+#   - focal
+#   - jammy
+#   - el7
+#   - el8
+set -x
+
+# Get arguments (or defaults)
+ROCM_VERSION=6.2.0
+DISTRO=focal
+if [[ -n $1 ]]; then
+    ROCM_VERSION=$1
+fi
+if [[ -n $2 ]]; then
+    if [[ "$2" == "focal" ]] || [[ "$2" == "jammy" ]] || [[ "$2" == "noble" ]] || [[ "$2" == "el7" ]] || [[ "$2" == "el8" ]]; then
+        DISTRO=$2
+    else
+        echo "Distro not supported"
+        echo "Supported distros are:\n focal\n jammy\n noble\n el7\n el8"
+	exit 1
+    fi
+fi
+
+ROCM_PATH=${ROCM_PATH:-/opt/rocm-${ROCM_VERSION}}
+# Intial release don't have the trialing '.0'
+# For example ROCM 5.4.0 is at https://repo.radeon.com/rocm/apt/5.4/
+if [ ${ROCM_VERSION##*[^0-9]} -eq '0' ]; then
+        ROCM_VERS=${ROCM_VERSION%.*}
+else
+        ROCM_VERS=$ROCM_VERSION
+fi
+
+# hardcode to 7.0.2
+AMDGPU_REPO_VERS=7.0.2
+
+if [[ "$DISTRO" == "focal" ]] || [[ "$DISTRO" == "jammy" ]] || [[ "$DISTRO" == "noble" ]]; then
+    ROCM_DEB_REPO_HOME=https://repo.radeon.com/rocm/apt/
+    AMDGPU_DEB_REPO_HOME=https://repo.radeon.com/amdgpu/
+    ROCM_BUILD_NAME=${DISTRO}
+    ROCM_BUILD_NUM=main
+
+    # Adjust the ROCM repo location
+    ROCM_DEB_REPO=${ROCM_DEB_REPO_HOME}${ROCM_VERS}/
+    AMDGPU_DEB_REPO=${AMDGPU_DEB_REPO_HOME}${AMDGPU_REPO_VERS}/
+
+    DEBIAN_FRONTEND=noninteractive apt-get --allow-unauthenticated update 

git diff --check says there's a trailing whitspace

i-chaochen i-chaochen commented on Jun 01, 2026 10:57 UTC
Contributor

do we need to put this to jax upstream? not sure what's sync policy in rocm/jax?

leo-automation leo-automation requested changes on Jun 01, 2026 10:57 UTC
Changes Requested Reviewer

Requested changes.

mminutoli mminutoli commented on Jun 01, 2026 22:42 UTC
Contributor

We keep our infra in another repository. So maybe we should close this PR and open one there.

Nevertheless, the right approach seems to have hermetic root in the build, right @alekstheod ?

mminutoli mminutoli requested changes on Jun 01, 2026 22:44 UTC
Changes Requested Reviewer

As said above, this should be closed IMHO.

Assignees
hsharsha hsharsha
Labels
risk: low confidence: 89.2% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 77.6% (HIGH) · Higher = larger blast radius
77.6%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 89.2% · Lower = rushed or shallow review
89.2%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 8.4% · Safe to merge
8.4%
Repository