diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index b83c4a34295e..56b7f1f4a377 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -1,4 +1,4 @@ -name: CI +name: ROCm CPU CI # We test all supported Python versions as follows: # - 3.10 : Documentation build @@ -11,10 +11,10 @@ on: # but only for the main branch push: branches: - - main + - rocm-main pull_request: branches: - - main + - rocm-main permissions: contents: read # to fetch code @@ -43,9 +43,7 @@ jobs: build: name: "build ${{ matrix.name-prefix }} (py ${{ matrix.python-version }} on ubuntu-20.04, x64=${{ matrix.enable-x64}})" - runs-on: linux-x86-n2-32 - container: - image: index.docker.io/library/ubuntu@sha256:6d8d9799fe6ab3221965efac00b4c34a2bcc102c086a58dff9e19a08b913c7ef # ratchet:ubuntu:20.04 + runs-on: ROCM-Ubuntu timeout-minutes: 60 strategy: matrix: @@ -63,10 +61,6 @@ jobs: num_generated_cases: 1 steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Image Setup - run: | - apt update - apt install -y libssl-dev - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: @@ -107,7 +101,7 @@ jobs: documentation: name: Documentation - test code snippets - runs-on: ubuntu-latest + runs-on: ROCM-Ubuntu timeout-minutes: 10 strategy: matrix: @@ -144,19 +138,13 @@ jobs: documentation_render: name: Documentation - render documentation - runs-on: linux-x86-n2-16 - container: - image: index.docker.io/library/ubuntu@sha256:6d8d9799fe6ab3221965efac00b4c34a2bcc102c086a58dff9e19a08b913c7ef # ratchet:ubuntu:20.04 - timeout-minutes: 10 + runs-on: ubuntu-latest + timeout-minutes: 20 strategy: matrix: python-version: ['3.10'] steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Image Setup - run: | - apt update - apt install -y libssl-dev libsqlite3-dev - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: @@ -227,9 +215,7 @@ jobs: ffi: name: FFI example - runs-on: linux-x86-g2-16-l4-1gpu - container: - image: index.docker.io/tensorflow/build:latest-python3.12@sha256:48e99608fe9434ada5b14e19fdfd8e64f4cfc83aacd328b9c2101b210e984295 # ratchet:index.docker.io/tensorflow/build:latest-python3.12 + runs-on: ROCM-Ubuntu timeout-minutes: 30 steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -248,7 +234,7 @@ jobs: path: ${{ steps.pip-cache.outputs.dir }} key: ${{ runner.os }}-pip-ffi-examples-${{ hashFiles('**/setup.py', '**/requirements.txt', '**/test-requirements.txt', 'examples/**/pyproject.toml') }} - name: Install JAX - run: pip install .[cuda12] + run: pip install . - name: Build and install example project run: python -m pip install -v ./examples/ffi[test] env: @@ -257,7 +243,7 @@ jobs: # a different toolchain. GCC is the default compiler on the # 'ubuntu-latest' runner, but we still set this explicitly just to be # clear. - CMAKE_ARGS: -DCMAKE_CXX_COMPILER=g++ -DJAX_FFI_EXAMPLE_ENABLE_CUDA=ON + CMAKE_ARGS: -DCMAKE_CXX_COMPILER=g++ #-DJAX_FFI_EXAMPLE_ENABLE_CUDA=ON - name: Run CPU tests run: python -m pytest examples/ffi/tests env: diff --git a/.github/workflows/rocm-nightly-upstream-sync.yml b/.github/workflows/rocm-nightly-upstream-sync.yml new file mode 100644 index 000000000000..f309427df197 --- /dev/null +++ b/.github/workflows/rocm-nightly-upstream-sync.yml @@ -0,0 +1,51 @@ +# Pulls the latest changes from upstream into main and opens a PR to merge +# them into rocm-main branch. + +name: ROCm Nightly Upstream Sync +on: + workflow_dispatch: + schedule: + - cron: '0 6 * * 1-5' +permissions: + contents: write + pull-requests: write +env: + SYNC_BRANCH_NAME: ci-upstream-sync-${{ github.run_number }}_${{ github.run_attempt }} +jobs: + sync-main: + runs-on: ubuntu-latest + steps: + - run: | + gh auth status + gh repo sync rocm/jax -b main + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + create-sync-branch: + needs: sync-main + runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Checkout code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Create branch + run: | + git fetch + git checkout origin/main + git checkout -b $SYNC_BRANCH_NAME + # Try and merge rocm-main into this new branch so that we don't run upstream's CI code + git config --global user.email "github-actions@github.com" + git config --global user.name "GitHub Actions" + git merge origin/rocm-main || true + # If the merge creates conflicts, we want to abort and push to origin anyways so that a dev can resolve the conflicts + git merge --abort || true + git push origin HEAD + open-sync-pr: + needs: create-sync-branch + runs-on: ubuntu-latest + steps: + - run: | + gh pr create --repo $GITHUB_REPOSITORY --head $SYNC_BRANCH_NAME --base rocm-main --title "CI: $(date +%x) upstream sync" --body "Daily sync with upstream" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + diff --git a/.github/workflows/rocm-open-upstream-pr.yml b/.github/workflows/rocm-open-upstream-pr.yml new file mode 100644 index 000000000000..bd14fa050577 --- /dev/null +++ b/.github/workflows/rocm-open-upstream-pr.yml @@ -0,0 +1,41 @@ +name: ROCm Open Upstream PR +on: + pull_request: + types: [ labeled ] + branches: [ rocm-main ] +jobs: + open-upstream: + if: ${{ github.event.label.name == 'open-upstream' }} + permissions: + contents: write + pull-requests: write + runs-on: ubuntu-latest + env: + NEW_BRANCH_NAME: "${{ github.head_ref }}-upstream" + steps: + - name: Checkout code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Rebase code to main + run: | + git config --global user.email "github-actions@github.com" + git config --global user.name "Github Actions" + git fetch + git checkout -b $NEW_BRANCH_NAME origin/${{ github.head_ref }} + git rebase --onto origin/main origin/rocm-main + # Force push here so that we don't run into conflicts with the origin branch + git push origin HEAD --force + - name: Leave link to create PR + env: + GH_TOKEN: ${{ github.token }} + run: | + # Bash is not friendly with newline characters, so make our own + NL=$'\n' + # Encode the PR title and body for passing as URL get parameters + TITLE_ENC=$(jq -rn --arg x "[ROCm] ${{ github.event.pull_request.title }}" '$x|@uri') + BODY_ENC=$(jq -rn --arg x $"${{ github.event.pull_request.body }}${NL}${NL}Created from: rocm/jax#${{ github.event.pull_request.number }}" '$x|@uri') + # Create a link to the that will open up a new PR form to upstream and autofill the fields + CREATE_PR_LINK="https://github.com/jax-ml/jax/compare/main...ROCm:jax:$NEW_BRANCH_NAME?expand=1&title=$TITLE_ENC&body=$BODY_ENC" + # Add a comment with the link to the PR + COMMENT_BODY="Feature branch from main is ready. [Create a new PR][1] destined for upstream?${NL}${NL}[1]: $CREATE_PR_LINK" + gh pr comment ${{ github.event.pull_request.number }} --repo rocm/jax --body "$COMMENT_BODY" + diff --git a/.github/workflows/upstream-nightly.yml b/.github/workflows/upstream-nightly.yml index 04df278019a5..ada9b4e5825f 100644 --- a/.github/workflows/upstream-nightly.yml +++ b/.github/workflows/upstream-nightly.yml @@ -22,7 +22,7 @@ on: jobs: upstream-dev: - runs-on: ubuntu-20.04-16core + runs-on: ROCM-Ubuntu permissions: contents: read checks: write # for upload-artifact