From 74c230edd24e3507d7a7212ef91b54e6e1c3457b Mon Sep 17 00:00:00 2001 From: sgasho Date: Fri, 10 Jul 2026 11:00:59 +0000 Subject: [PATCH 1/2] ci: Enable autodiff tests on x86_64 linux * Enable autodiff tests on x86_64 linux * move autodiff job def * remove redundant ./x build --- .../optional-x86_64-gnu-autodiff/Dockerfile | 37 +++++++++++++++++++ src/ci/docker/scripts/autodiff.sh | 9 +++++ src/ci/github-actions/jobs.yml | 4 ++ 3 files changed, 50 insertions(+) create mode 100644 src/ci/docker/host-x86_64/optional-x86_64-gnu-autodiff/Dockerfile create mode 100755 src/ci/docker/scripts/autodiff.sh diff --git a/src/ci/docker/host-x86_64/optional-x86_64-gnu-autodiff/Dockerfile b/src/ci/docker/host-x86_64/optional-x86_64-gnu-autodiff/Dockerfile new file mode 100644 index 0000000000000..f4633f951c645 --- /dev/null +++ b/src/ci/docker/host-x86_64/optional-x86_64-gnu-autodiff/Dockerfile @@ -0,0 +1,37 @@ +FROM ubuntu:24.04 + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && apt-get install -y --no-install-recommends \ + g++ \ + make \ + ninja-build \ + file \ + curl \ + ca-certificates \ + python3 \ + git \ + cmake \ + pkg-config \ + xz-utils \ + zlib1g-dev \ + && rm -rf /var/lib/apt/lists/* + +COPY scripts/sccache.sh /scripts/ +RUN sh /scripts/sccache.sh + +COPY scripts/autodiff.sh /scripts/ + +ENV NO_DOWNLOAD_CI_LLVM 1 +ENV CODEGEN_BACKENDS llvm + +ENV RUST_CONFIGURE_ARGS \ + --build=x86_64-unknown-linux-gnu \ + --enable-llvm-enzyme \ + --enable-llvm-link-shared \ + --enable-ninja \ + --enable-option-checking \ + --disable-docs \ + --set llvm.download-ci-llvm=false + +ENV SCRIPT /scripts/autodiff.sh diff --git a/src/ci/docker/scripts/autodiff.sh b/src/ci/docker/scripts/autodiff.sh new file mode 100755 index 0000000000000..90b36078faccd --- /dev/null +++ b/src/ci/docker/scripts/autodiff.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +set -ex + +../x.py test --stage 2 --no-fail-fast \ + tests/codegen-llvm/autodiff \ + tests/pretty/autodiff \ + tests/ui/autodiff \ + tests/ui/feature-gates/feature-gate-autodiff.rs diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index a8eebe7599fda..a6b23fe516c89 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -469,6 +469,10 @@ auto: - name: x86_64-gnu-miri <<: *job-linux-4c + - name: optional-x86_64-gnu-autodiff + continue_on_error: true + <<: *job-linux-4c + #################### # macOS Builders # #################### From 4ee71fea02ec90e3031966ee46ea28bfabe91142 Mon Sep 17 00:00:00 2001 From: sgasho Date: Sun, 19 Jul 2026 18:13:29 +0900 Subject: [PATCH 2/2] docs: add autodiff CI job document --- src/ci/github-actions/jobs.yml | 1 + src/doc/rustc-dev-guide/src/SUMMARY.md | 1 + .../src/tests/autodiff-ci-job.md | 45 +++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 src/doc/rustc-dev-guide/src/tests/autodiff-ci-job.md diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index a6b23fe516c89..706095890b114 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -471,6 +471,7 @@ auto: - name: optional-x86_64-gnu-autodiff continue_on_error: true + doc_url: https://rustc-dev-guide.rust-lang.org/tests/autodiff-ci-job.html <<: *job-linux-4c #################### diff --git a/src/doc/rustc-dev-guide/src/SUMMARY.md b/src/doc/rustc-dev-guide/src/SUMMARY.md index bf2de84575d69..6a3a5a0a936f3 100644 --- a/src/doc/rustc-dev-guide/src/SUMMARY.md +++ b/src/doc/rustc-dev-guide/src/SUMMARY.md @@ -34,6 +34,7 @@ - [Codegen backend testing](./tests/codegen-backend-tests/intro.md) - [Cranelift codegen backend](./tests/codegen-backend-tests/cg_clif.md) - [GCC codegen backend](./tests/codegen-backend-tests/cg_gcc.md) + - [Autodiff CI job](./tests/autodiff-ci-job.md) - [Performance testing](./tests/perf.md) - [Pre-stabilization CI job for the next solver and polonius alpha](./tests/x86_64-gnu-next-trait-solver-polonius-ci-job.md) - [Misc info](./tests/misc.md) diff --git a/src/doc/rustc-dev-guide/src/tests/autodiff-ci-job.md b/src/doc/rustc-dev-guide/src/tests/autodiff-ci-job.md new file mode 100644 index 0000000000000..3e5d55fbc81a9 --- /dev/null +++ b/src/doc/rustc-dev-guide/src/tests/autodiff-ci-job.md @@ -0,0 +1,45 @@ +# Autodiff CI job + +The [`optional-x86_64-gnu-autodiff`] job provides continuous test coverage for +the experimental `autodiff` feature and its integration with LLVM Enzyme. It is +an optional [auto job](./ci.md#auto-builds), so a failure does not prevent a +pull request from being merged. + +For more context about the feature, see the [autodiff tracking issue] and the +[autodiff internals](../autodiff/internals.md) chapter. + +## What is tested + +The job checks: + +- forward- and reverse-mode macro expansion and diagnostics; +- LLVM IR generation for autodiff; +- enforcement of the `autodiff` feature gate. + +## Running the job + +To run the job in a try build, comment on a pull request: + +```text +@bors try jobs=optional-x86_64-gnu-autodiff +``` + +To run the job locally, run this command from a Rust checkout: + +```console +$ cargo run --manifest-path src/ci/citool/Cargo.toml run-local optional-x86_64-gnu-autodiff +``` + +See [Testing with Docker](./docker.md) for more information about running CI +jobs locally. + +## Point of contact + +If you have questions or need help with a failure in this job, open a new topic +in the [autodiff Zulip channel]. For suspected Enzyme backend failures, see the +[autodiff debugging guide]. + +[autodiff Zulip channel]: https://rust-lang.zulipchat.com/#narrow/channel/390790-wg-autodiff +[autodiff debugging guide]: ../autodiff/debugging.md +[autodiff tracking issue]: https://github.com/rust-lang/rust/issues/124509 +[`optional-x86_64-gnu-autodiff`]: https://github.com/rust-lang/rust/blob/HEAD/src/ci/github-actions/jobs.yml