This repository builds PJRT artifacts for the OpenXLA project.
When CI breaks because upstream changes invalidate our pinned commit or patches, follow this checklist to repair it.
- Use SSH for GitHub access (
git@github.com:zml/pjrt-artifacts.git). - Workflow lives in
.github/workflows/_build.yaml; default commit pins must always track a revision verified locally. - Custom patches live under
openxla/patches/{upstream,rocm}and are applied before every build.
Nightly runs are defined in .github/workflows/nightly.yaml. Always read that file first—its matrix and openxla/commits.env specify the authoritative pins (XLA_COMMIT, CUDA_XLA_COMMIT, ROCM_XLA_COMMIT, …). When fixing nightly failures, validate the relevant repos at those exact SHAs unless the task explicitly asks to move them forward.
- Confirm the listed SHAs build:
- Clone
openxla/xlaatXLA_COMMITand applyopenxla/patches/upstream/*.patch(CPU). - Clone
zml/xlaatCUDA_XLA_COMMIT(branchcuda) with no pjrt-artifacts patches (CUDA, like oneAPI). - Clone
ROCm/xlaatROCM_XLA_COMMITand applyopenxla/patches/rocm/*.patchwhen debugging ROCm nightly failures.
- Clone
- Only update the commit values in
openxla/commits.envafter verifying both the checkout andbazelcommands succeed. - When you do update them, always write the exact SHA (not branch names) in
openxla/commits.env.
- Clone upstream via SSH
git clone git@github.com:openxla/xla.git openxla-work cd openxla-work git checkout <target commit or main>
- Apply upstream patches
git apply ../openxla/patches/upstream/*.patch- If any patch fails, edit it inside
openxla/patches/upstream/…so that it applies cleanly to the new commit (e.g., update context or add missing loads). - Keep patches minimal; they must stay in sync with the repo copy committed later.
- If any patch fails, edit it inside
- Run a quick Bazel validation
bazel --batch --output_base="$(pwd)/.bazel_output" query //xla/pjrt/c:pjrt_c_api_cpu_plugin--output_baseinside the repo keeps permissions simple.- If Bazel refuses to start (port permissions or missing deps), adjust the patches or add Bazelrc overrides locally until the query succeeds.
- Record extra tweaks
- When a patch adds new Bazel macros (e.g.,
http_archive), ensure the patch itself contains any required loads so future checkouts do not need manual edits.
- When a patch adds new Bazel macros (e.g.,
- Edit
.github/workflows/_build.yaml- Set
XLA_COMMIT(and ROCm if needed) to the validated SHA. - Update the inline comment with the actual commit date (grab via
git show -s --format=%ci <sha>).
- Set
- Update patches
- Copy any edits from the temporary checkout back into the corresponding patch files under
openxla/patches/.... - Keep diffs ASCII and deterministic; number patches sequentially.
- Copy any edits from the temporary checkout back into the corresponding patch files under
- Document testing
- Always re-run the Bazel query after editing patches to confirm they still apply.
- If build steps are required (cuda/rocm), mention the configs in the PR body even if not run locally.
- Stage relevant files only (workflow + updated patches).
- Commit with attribution, e.g.,
Fix OpenXLA commit date comment (by ChatGPT). - Push the branch (
git push origin HEAD) and create a PR usinggh pr create --base master --head <branch>. - PR body template:
## Summary - describe workflow/patch changes ## Testing - bazel --batch --output_base="$(pwd)/.bazel_output" query //xla/pjrt/c:pjrt_c_api_cpu_plugin
- Bazel output permissions: If
/var/tmpis read-only, override--output_base. - Missing symbols in patches: Make sure required
load()statements are added; otherwise Bazel commands will fail with “name 'http_archive' is not defined.” - SSH requirement: The environment often rewrites HTTPS URLs to SSH, so always prefer
git@github.com:URIs to avoid cloning failures.
Keep this file current whenever the workflow changes. Future agents should be able to follow these steps end-to-end without extra context.