Skip to content

[CI] Add native build image for linux-riscv64 - #190887

Closed
luhenry wants to merge 2 commits into
pytorch:mainfrom
riseproject-dev:native-riscv64-ci
Closed

luhenry wants to merge 2 commits into
pytorch:mainfrom
riseproject-dev:native-riscv64-ci

Conversation

@luhenry

@luhenry luhenry commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

This is used as part of the riseproject-dev out-of-tree CI 1 2, to get us closer to having native builds of PyTorch on RISC-V.

@luhenry
luhenry requested a review from a team as a code owner July 23, 2026 13:26
@pytorch-bot pytorch-bot Bot added ciflow/docker release notes: releng release notes category labels Jul 23, 2026
@pytorch-bot

pytorch-bot Bot commented Jul 23, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/190887

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 Unclassified Failure

As of commit 602f297 with merge base 7610a3a (image):

UNCLASSIFIED FAILURE - DrCI could not classify the following job because the workflow did not run on the merge base. The failure may be pre-existing on trunk or introduced by this PR:

  • pull / linux-jammy-cuda13.2-cudnn9-py3.10-clang18 / build (gh) (this job did not run on the merge base, so DrCI cannot tell whether the failure is pre-existing)
    Executing the custom container implementation failed. Please contact your self hosted runner administrator.

    AI verdict: AI verdict: infra issue

    The job failed because it couldn't pull the Docker image from ECR. The commit changed .ci/docker/ files which triggered a new content hash and required a new Docker image, but the docker-builds workflow was still in progress when the build job tried to pull the image, causing a 2-hour image pull timeout.

    Full reasoning on HUD →

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot

pytorch-bot Bot commented Jul 23, 2026 •

Copy link
Copy Markdown

Workflows were awaiting approval. CI has now been triggered for the ciflow labels on this PR.

@luhenry

luhenry commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

Replaces #182278.

@luhenry

luhenry commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor Author

cc @zxiiro @Skylion007 @ezyang I needed to close and reopen this PR because the stale "request changes" is blocking the merge bot from merging.

@luhenry
luhenry force-pushed the native-riscv64-ci branch from 8d958b7 to 346fcf0 Compare July 23, 2026 13:41
@luhenry

luhenry commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

@pytorchmergebot merge

@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label Jul 23, 2026
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge failed

Reason: Approvers from one of the following sets are needed:

  • OSS CI (alband, pytorch/pytorch-dev-infra)
  • Metamates (8Keep, aditvenk, AmesingFlank, andrewor14, andyanwang, ...)
  • Core Reviewers (mruberry, lezcano, Skylion007, ngimel, peterbell10, ...)
  • Core Maintainers (soumith, gchanan, ezyang, malfet, albanD, ...)
Details for Dev Infra team Raised by workflow job

Failing merge rule: Core Maintainers

@Skylion007
Skylion007 requested a review from Copilot July 23, 2026 16:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Comment thread .ci/docker/common/install_openblas.sh Resolved
if [[ "$(uname -m)" == "riscv64" ]]; then
# Rust's riscv64 arch is riscv64gc
ARCH=riscv64gc
# sccache-dist is not available on riscv64, so we only install sccache

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We add scache-dist support for aarch, we should try to upstream this. It actually was a pretty simple PR. We actually build from source and enabled it with a quick patch before. Should add an upstream PR for RISCV: mozilla/sccache#2668

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll get that done in mozilla/sccache following same steps as mozilla/sccache#2668 with 1 as well. Would you be ok merging this PR before we land the sccache-dist support upstream? There currently is no use of sccache-dist on riscv64 as pytorch/pytorch doesn't build riscv64 and the downstream that builds it 2 doesn't depend on it.

I have a strong track record of working to minimize the diff for riscv64 for PyTorch so please be assured I'll work on getting upstream support done for sccache and come back here when it's done and released.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The blocker is currently failure to compile 1 because one of the dependencies is on an old version when the newer version added support for riscv64 2 3. I'll follow up on this PR 3 and try to get it merged to be able to submit support for sccache-dist on riscv64.

@Skylion007

Copy link
Copy Markdown
Collaborator

@claude review this PR

@claude

claude Bot commented Jul 23, 2026 •

Copy link
Copy Markdown

Claude finished @Skylion007's task in 2m 20s —— View job


PR Review: #190887 — Add native build image for linux-riscv64

One-sentence summary: This adds a native (QEMU-emulated) pytorch-linux-noble-riscv64-py3.12-gcc14 Docker image plus the arch-specific tweaks (no valgrind/sccache-dist, no bf16 OpenBLAS, disabled MKLDNN/CUDA, WERROR off) needed to build PyTorch natively on RISC-V; it looks correct and low-risk, with one supply-chain point worth confirming before merge.

Full review details

Summary

Config-only change for out-of-tree RISC-V CI. No production code paths are touched; the native image tag is intentionally not wired into docker-builds.yml/riscv64.yml (those still only reference the -cross-build variant), consistent with the PR description that this image is consumed by the riseproject-dev out-of-tree CI. Two maintainers have already approved. Findings below are minor.

Security

  • .ci/docker/build.sh:290-291 — PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple combined with PIP_PREFER_BINARY=1 is baked into the image as a persistent ENV (via .ci/docker/ubuntu/Dockerfile:9-12), so every pip install at build and test time will consult this third-party index. Because --extra-index-url unions with PyPI rather than replacing it, and pip does not partition by index, any package name published on pypi.riseproject.dev can shadow the PyPI package of the same name (classic dependency-confusion surface). For a RISC-V-only image pulling arch-specific wheels this is understandable, but please confirm the index is trusted/controlled and consider whether it should instead be scoped to the RISC-V build steps rather than a global image ENV. Non-riscv64 images pass an empty build-arg, so they are unaffected.

Code Quality

  • .ci/docker/common/install_cache.sh:9,12 — ARCH is already $(uname -m) on line 9, but line 12 re-invokes uname -m in the if. Reuse the variable: if [[ "$ARCH" == "riscv64" ]]; then. Fix this →

Notes (not blocking)

  • .ci/docker/common/install_openblas.sh:12 — The FIXME says zvfbfwma bf16 support landed in GCC 15 while this image is GCC 14. This aligns with @Skylion007's inline question: it would be more future-proof to gate OPENBLAS_BUILD_BFLOAT16 on the GCC version rather than purely on uname -m == riscv64, so bumping to GCC 15 later re-enables bf16 automatically. Optional.
  • .ci/pytorch/build.sh:279 — The added [[ "${USE_NINJA}" != "0" ]] guard on the debinfo --dry-run path is a reasonable defensive check for the non-ninja native build; no correctness concern.
  • sccache for native riscv64 downloads sccache-v0.16.0-riscv64gc-unknown-linux-musl.tar.gz from the mozilla release. Worth verifying that asset actually exists in the v0.16.0 release (per @Skylion007's note about upstreaming RISC-V support); if it doesn't publish a riscv64gc binary, install_cache.sh will fail. Couldn't verify from the repo alone.

Recommendation

Approve — config-only, arch-gated, no impact on other platforms. Please confirm the trust boundary of the pypi.riseproject.dev extra index (Security note) before merge.

· branch `native-riscv64-ci`

@luhenry

luhenry commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

linux-jammy-py3.10-clang18-asan / test (default, 5, 18, lf-l-x86iavx512-16-128) is a spurious failure. Every other tests that have to do with platforms that may have been impacted by these changes (aarch64 mostly) are green.

fi

if [[ "$(uname -m)" == "riscv64" ]]; then
valgrind="" # it's not available on riscv64 yet

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It actually is available on riscv64, but it's very recent. Not sure if it needs a PPA to backport to Ubuntu

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's available starting Ubuntu 26.04 on riscv64: https://packages.ubuntu.com/resolute/valgrind. Once we bump to Ubuntu 26.04 (which will bring both GCC 15 and valgrind) we can remove these two workarounds.

@luhenry

luhenry commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

@pytorchmergebot merge

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge failed

Reason: 1 mandatory check(s) failed. The first few are:

Dig deeper by viewing the failures on hud

Details for Dev Infra team Raised by workflow job

Failing merge rule: Core Maintainers

@luhenry

luhenry commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

@zxiiro @Skylion007 could you please re-run https://github.com/pytorch/pytorch/actions/runs/30107072884/job/89542635561?pr=190887, the failure isn't related to the changes here. Thank you! 🙏

@luhenry

luhenry commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor Author

@zxiiro looking through https://github.com/pytorch/pytorch/actions/workflows/docker-builds.yml, it doesn't even build pytorch/ci-image:pytorch-linux-jammy-cuda13.2-cudnn9-py3.10-clang18-*. It does build the cuda13.0 1 version though. Anything else I missed?

EDIT: linux-jammy-cuda13.2-cudnn9-py3.10-clang18 2 was added 3 at around the same time as this CI was triggered, so I expect it's a timing issue

@luhenry

luhenry commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

@pytorchmergebot merge -i

@pytorch-bot

pytorch-bot Bot commented Jul 27, 2026

Copy link
Copy Markdown

-i flag is only allowed for users with write permissions

@zxiiro

zxiiro commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

@pytorchmergebot merge -i

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged while ignoring the following 1 checks: pull / linux-jammy-cuda13.2-cudnn9-py3.10-clang18 / build

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@luhenry
luhenry deleted the native-riscv64-ci branch July 27, 2026 16:21
zklaus added a commit to zklaus/pytorch that referenced this pull request Aug 26, 2026
…rements

With the routing fixed, the riscv64 cross job reaches the build and stops at
`python -m build`: the crossenv is provisioned with `setuptools pyyaml
typing_extensions wheel`, which was enough for `setup.py bdist_wheel` but not for
the scikit-build-core front end and backend. Run 32955566963 ends at

    /opt/riscv-cross-env/cross/bin/python3: No module named build

Install the missing pieces into the crossenv. What goes where follows from what
crossenv actually is: its `cross` interpreter is the host CPython with sysconfig
patched to report the target's values, not a riscv64 binary -- the error above is
an x86_64 process raising a Python error. So pure-Python build tooling (build,
scikit-build-core, packaging, six) installs into the cross environment and runs
there natively, and it has to be reachable from that interpreter specifically:
driving the build from the host environment would hand the backend the host
sysconfig and produce a host-tagged wheel. cmake and ninja stay where they are,
on the host, because they are executed rather than imported; installing them into
the cross environment would fetch riscv64 wheels the host cannot run.

numpy is the exception that needs a target wheel, and PyPI has none for riscv64.
The RISE project index does, and it is already a trusted host here -- pytorch#190887
wired it into the native riscv64 image the same way. 1.26.4 is chosen on two
counts: it matches the Python 3.12 pin in .ci/docker/requirements-ci.txt, and it
is the newest numpy published there under a plain linux_riscv64 tag, so it does
not depend on crossenv resolving manylinux glibc tags for the target. The pin is
load-bearing in a second way: with an extra index pip resolves the highest
version across both, and every newer numpy exists on PyPI without a riscv64
wheel, so leaving it unpinned would silently cross-build numpy from an sdist.

Provisioning belongs in the image rather than in this script, and moving it to
.ci/docker/ubuntu-cross-riscv/Dockerfile is the intended end state. It is
deliberately not done here: the job has been red since 2025-10 and there is
almost certainly more breakage past this point, while any change under .ci/docker
rehashes the directory and rebuilds every CI image. Doing that once, when the
whole path is known green, is cheaper than doing it per iteration.

Note that numpy may still not end up enabled. It satisfies the build-requires
check, which `build` performs through importlib.metadata rather than by importing
(build/_util.py), but FindPython's NumPy component discovers its include
directory by running `import numpy; numpy.get_include()`, and a riscv64 extension
module cannot be imported on an x86_64 host. FindPython swallows that in a bare
`except: pass`, so the expected outcome is a "NumPy could not be found" warning
from Dependencies.cmake and USE_NUMPY off -- no worse than the status quo. If
numpy is wanted for real, the follow-up is to set Python_NumPy_INCLUDE_DIR
directly instead of letting FindPython probe.

This commit was authored with the assistance of an AI coding assistant.

Test Plan:

Needs a ciflow/riscv64 run; the job is opt-in and cannot be exercised locally.

The previous run on this branch
(https://github.com/pytorch/pytorch/actions/runs/32955566963) established the
starting point -- the guard now resolves and the crossenv activates:

```
+ [[ linux-noble-riscv64-py3.12-gcc14-cross-build == *riscv64*cross* ]]
+ source /opt/riscv-cross-env/bin/activate
+ export CMAKE_CROSSCOMPILING=TRUE
```

Confirmed the RISE project index actually serves the wheel this pins, via the
simple repository API:

```
curl -sS https://pypi.riseproject.dev/simple/numpy/ \
  | grep -o 'numpy-[^<]*cp312[^<]*\.whl' | sort -u
```

which lists numpy-1.26.4-cp312-cp312-linux_riscv64.whl among 16 cp312 riscv64
wheels; everything from 2.3.1 onward is published only under
manylinux_2_38/manylinux_2_39 tags. The same query against the index root shows
it carries numpy, pyyaml, ninja and cmake but not build, scikit-build-core,
packaging or six, which is why PyPI stays the primary index and this is an
--extra-index-url rather than an --index-url.

Checked that PIP_EXTRA_INDEX_URL is not already in effect for this image, so the
flag is not redundant: .ci/docker/build.sh sets it only for the native
pytorch-linux-noble-riscv64-py3.12-gcc14 tag, ubuntu-cross-riscv/Dockerfile
declares no matching ARG, and no PIP_* variable appears in the container
environment dumped by the run above.

Lint:

```
lintrunner --paths-cmd='git diff --name-only origin/viable/strict'
bash -n .ci/pytorch/build.sh
```
zklaus added a commit to zklaus/pytorch that referenced this pull request Aug 26, 2026
…rements

With the routing fixed, the riscv64 cross job reaches the build and stops at
`python -m build`: the crossenv is provisioned with `setuptools pyyaml
typing_extensions wheel`, which was enough for `setup.py bdist_wheel` but not for
the scikit-build-core front end and backend. Run 32955566963 ends at

    /opt/riscv-cross-env/cross/bin/python3: No module named build

Install the missing pieces into the crossenv. What goes where follows from what
crossenv actually is: its `cross` interpreter is the host CPython with sysconfig
patched to report the target's values, not a riscv64 binary -- the error above is
an x86_64 process raising a Python error. So pure-Python build tooling (build,
scikit-build-core, packaging, six) installs into the cross environment and runs
there natively, and it has to be reachable from that interpreter specifically:
driving the build from the host environment would hand the backend the host
sysconfig and produce a host-tagged wheel. cmake and ninja stay where they are,
on the host, because they are executed rather than imported; installing them into
the cross environment would fetch riscv64 wheels the host cannot run.

The install has to sit after the chown loop rather than beside the other exports.
The crossenv is root-owned in the image while the container runs as jenkins, so
until `sudo chown -R jenkins /opt/riscv-cross-env` has run the cross interpreter
cannot read `cross/pyvenv.cfg` and dies during startup, before `site` is
imported. Nothing else in the script makes that dependency visible -- the
existing `python -m build` call is far enough down that it never noticed -- so it
is called out in a comment.

numpy is the exception that needs a target wheel, and PyPI has none for riscv64.
The RISE project index does, and it is already a trusted host here -- pytorch#190887
wired it into the native riscv64 image the same way. 1.26.4 is chosen on two
counts: it matches the Python 3.12 pin in .ci/docker/requirements-ci.txt, and it
is the newest numpy published there under a plain linux_riscv64 tag, so it does
not depend on crossenv resolving manylinux glibc tags for the target. The pin is
load-bearing in a second way: with an extra index pip resolves the highest
version across both, and every newer numpy exists on PyPI without a riscv64
wheel, so leaving it unpinned would silently cross-build numpy from an sdist.

Provisioning belongs in the image rather than in this script, and moving it to
.ci/docker/ubuntu-cross-riscv/Dockerfile is the intended end state. It is
deliberately not done here: the job has been red since 2025-10 and there is
almost certainly more breakage past this point, while any change under .ci/docker
rehashes the directory and rebuilds every CI image. Doing that once, when the
whole path is known green, is cheaper than doing it per iteration.

Note that numpy may still not end up enabled. It satisfies the build-requires
check, which `build` performs through importlib.metadata rather than by importing
(build/_util.py), but FindPython's NumPy component discovers its include
directory by running `import numpy; numpy.get_include()`, and a riscv64 extension
module cannot be imported on an x86_64 host. FindPython swallows that in a bare
`except: pass`, so the expected outcome is a "NumPy could not be found" warning
from Dependencies.cmake and USE_NUMPY off -- no worse than the status quo. If
numpy is wanted for real, the follow-up is to set Python_NumPy_INCLUDE_DIR
directly instead of letting FindPython probe.

This commit was authored with the assistance of an AI coding assistant.

Test Plan:

Needs a ciflow/riscv64 run; the job is opt-in and cannot be exercised locally.
Two runs on this branch informed this change.

32955566963 established the starting point -- the guard from the previous commit
resolves, the crossenv activates, and the build stops on the missing front end:

```
+ [[ linux-noble-riscv64-py3.12-gcc14-cross-build == *riscv64*cross* ]]
+ source /opt/riscv-cross-env/bin/activate
+ export CMAKE_CROSSCOMPILING=TRUE
...
+ python -m build --wheel --no-isolation
/opt/riscv-cross-env/cross/bin/python3: No module named build
```

32971278636 ran this install from the wrong place, before the chown, and is what
established the ownership constraint above:

```
Fatal Python error: init_import_site: Failed to import the site module
PermissionError: [Errno 13] Permission denied: '/opt/riscv-cross-env/cross/pyvenv.cfg'
```

Confirmed the RISE project index actually serves the wheel this pins, via the
simple repository API:

```
curl -sS https://pypi.riseproject.dev/simple/numpy/ \
  | grep -o 'numpy-[^<]*cp312[^<]*\.whl' | sort -u
```

which lists numpy-1.26.4-cp312-cp312-linux_riscv64.whl among 16 cp312 riscv64
wheels; everything from 2.3.1 onward is published only under
manylinux_2_38/manylinux_2_39 tags. The same query against the index root shows
it carries numpy, pyyaml, ninja and cmake but not build, scikit-build-core,
packaging or six, which is why PyPI stays the primary index and this is an
--extra-index-url rather than an --index-url.

Checked that PIP_EXTRA_INDEX_URL is not already in effect for this image, so the
flag is not redundant: .ci/docker/build.sh sets it only for the native
pytorch-linux-noble-riscv64-py3.12-gcc14 tag, ubuntu-cross-riscv/Dockerfile
declares no matching ARG, and no PIP_* variable appears in the container
environment dumped by those runs.

Lint:

```
lintrunner --paths-cmd='git diff --name-only origin/viable/strict'
bash -n .ci/pytorch/build.sh
```
zklaus added a commit to zklaus/pytorch that referenced this pull request Aug 29, 2026
The riscv64 cross build has not taken its own code path since pytorch#187821. That PR
renamed the docker image to pytorch-linux-noble-riscv64-py3.12-gcc14-cross-build
and narrowed the guards from *riscv* to *riscv*cross*, but the guards in
.ci/docker/build.sh test the image name while the ones in .ci/pytorch/build.sh
test BUILD_ENVIRONMENT -- and only the image name gained the "cross" marker.
BUILD_ENVIRONMENT stayed linux-noble-riscv64-py3.12-gcc14, so
`[[ "$BUILD_ENVIRONMENT" == *riscv64*cross* ]]` has been false ever since.

Everything in that block is skipped as a result: the crossenv at
/opt/riscv-cross-env is never activated, so the build runs against the host
interpreter; CMAKE_CROSSCOMPILING, CMAKE_SYSTEM_NAME and CMAKE_SYSTEM_PROCESSOR
are never exported, so CMake never enters cross mode even though CC/CXX point at
the riscv64 toolchain; and SLEEF_TARGET_EXEC_USE_QEMU and the workspace chown are
missed too. pytorch#190887 later added an `elif *riscv64*` arm for the new native image,
which is the branch this job has been taking.

Aligning BUILD_ENVIRONMENT with the image name is the smaller of the two possible
fixes and matches the intent of pytorch#187821. Widening the guards back to *riscv64*
would work for this job but would pull the native image, which is genuinely named
linux-noble-riscv64-py3.12-gcc14, onto the cross path -- and that path exits 1
when /opt/riscv-cross-env is absent. The string is only consumed as
$BUILD_ENVIRONMENT and as the build artifact name, so renaming it is contained;
no other pattern in .ci/pytorch/build.sh matches the added "-cross-build".

This commit was authored with the assistance of an AI coding assistant.

Test Plan:

The job is opt-in, so this needs a ciflow/riscv64 run to verify. It has been red
since 2025-10 and the last run predates both pytorch#190887 and the scikit-build-core
migration, so this is expected to uncover further breakage rather than turn the
job green on its own -- in particular the crossenv is provisioned with
`setuptools pyyaml typing_extensions wheel` only, while the build now invokes
`python -m build --wheel --no-isolation`. Fixing that needs to be informed by a
real run, since crossenv splits host and target environments and build backends
belong in the host one.

Root cause confirmed from the last run's log
(https://github.com/pytorch/pytorch/actions/runs/28817304405), which shows the
guard evaluating false:

```
+ [[ linux-noble-riscv64-py3.12-gcc14 == *riscv64*cross* ]]
+ [[ linux-noble-riscv64-py3.12-gcc14 == *vulkan* ]]
```

Checked that no other BUILD_ENVIRONMENT pattern in the build script starts
matching once "-cross-build" is appended:

```
grep -on 'BUILD_ENVIRONMENT" [!=]= \*[^]]*\*' .ci/pytorch/build.sh \
  | sed 's/.*== //;s/.*!= //' | sort -u
```

yields *aarch64* *clang* *-clang*-asan* *client* *cuda* *cuda13* *-debug*
*-full-debug* *full-debug* *libtorch* *riscv64* *riscv64*cross* *rocm* *-tsan*
*vulkan* *xla* *xpu*, of which only the two riscv64 patterns match, both
intentionally.

Lint:

```
lintrunner --paths-cmd='git diff --name-only origin/viable/strict'
```
zklaus added a commit to zklaus/pytorch that referenced this pull request Aug 29, 2026
…rements

With the routing fixed, the riscv64 cross job reaches the build and stops at
`python -m build`: the crossenv is provisioned with `setuptools pyyaml
typing_extensions wheel`, which was enough for `setup.py bdist_wheel` but not for
the scikit-build-core front end and backend. Run 32955566963 ends at

    /opt/riscv-cross-env/cross/bin/python3: No module named build

Install the missing pieces into the crossenv. What goes where follows from what
crossenv actually is: its `cross` interpreter is the host CPython with sysconfig
patched to report the target's values, not a riscv64 binary -- the error above is
an x86_64 process raising a Python error. So pure-Python build tooling (build,
scikit-build-core, packaging, six) installs into the cross environment and runs
there natively, and it has to be reachable from that interpreter specifically:
driving the build from the host environment would hand the backend the host
sysconfig and produce a host-tagged wheel. cmake and ninja stay where they are,
on the host, because they are executed rather than imported; installing them into
the cross environment would fetch riscv64 wheels the host cannot run.

The install has to sit after the chown loop rather than beside the other exports.
The crossenv is root-owned in the image while the container runs as jenkins, so
until `sudo chown -R jenkins /opt/riscv-cross-env` has run the cross interpreter
cannot read `cross/pyvenv.cfg` and dies during startup, before `site` is
imported. Nothing else in the script makes that dependency visible -- the
existing `python -m build` call is far enough down that it never noticed -- so it
is called out in a comment.

numpy is the exception that needs a target wheel, and PyPI has none for riscv64.
The RISE project index does, and it is already a trusted host here -- pytorch#190887
wired it into the native riscv64 image the same way. 1.26.4 is chosen on two
counts: it matches the Python 3.12 pin in .ci/docker/requirements-ci.txt, and it
is the newest numpy published there under a plain linux_riscv64 tag, so it does
not depend on crossenv resolving manylinux glibc tags for the target. The pin is
load-bearing in a second way: with an extra index pip resolves the highest
version across both, and every newer numpy exists on PyPI without a riscv64
wheel, so leaving it unpinned would silently cross-build numpy from an sdist.

Provisioning belongs in the image rather than in this script, and moving it to
.ci/docker/ubuntu-cross-riscv/Dockerfile is the intended end state. It is
deliberately not done here: the job has been red since 2025-10 and there is
almost certainly more breakage past this point, while any change under .ci/docker
rehashes the directory and rebuilds every CI image. Doing that once, when the
whole path is known green, is cheaper than doing it per iteration.

Note that numpy may still not end up enabled. It satisfies the build-requires
check, which `build` performs through importlib.metadata rather than by importing
(build/_util.py), but FindPython's NumPy component discovers its include
directory by running `import numpy; numpy.get_include()`, and a riscv64 extension
module cannot be imported on an x86_64 host. FindPython swallows that in a bare
`except: pass`, so the expected outcome is a "NumPy could not be found" warning
from Dependencies.cmake and USE_NUMPY off -- no worse than the status quo. If
numpy is wanted for real, the follow-up is to set Python_NumPy_INCLUDE_DIR
directly instead of letting FindPython probe.

This commit was authored with the assistance of an AI coding assistant.

Test Plan:

Needs a ciflow/riscv64 run; the job is opt-in and cannot be exercised locally.
Two runs on this branch informed this change.

32955566963 established the starting point -- the guard from the previous commit
resolves, the crossenv activates, and the build stops on the missing front end:

```
+ [[ linux-noble-riscv64-py3.12-gcc14-cross-build == *riscv64*cross* ]]
+ source /opt/riscv-cross-env/bin/activate
+ export CMAKE_CROSSCOMPILING=TRUE
...
+ python -m build --wheel --no-isolation
/opt/riscv-cross-env/cross/bin/python3: No module named build
```

32971278636 ran this install from the wrong place, before the chown, and is what
established the ownership constraint above:

```
Fatal Python error: init_import_site: Failed to import the site module
PermissionError: [Errno 13] Permission denied: '/opt/riscv-cross-env/cross/pyvenv.cfg'
```

Confirmed the RISE project index actually serves the wheel this pins, via the
simple repository API:

```
curl -sS https://pypi.riseproject.dev/simple/numpy/ \
  | grep -o 'numpy-[^<]*cp312[^<]*\.whl' | sort -u
```

which lists numpy-1.26.4-cp312-cp312-linux_riscv64.whl among 16 cp312 riscv64
wheels; everything from 2.3.1 onward is published only under
manylinux_2_38/manylinux_2_39 tags. The same query against the index root shows
it carries numpy, pyyaml, ninja and cmake but not build, scikit-build-core,
packaging or six, which is why PyPI stays the primary index and this is an
--extra-index-url rather than an --index-url.

Checked that PIP_EXTRA_INDEX_URL is not already in effect for this image, so the
flag is not redundant: .ci/docker/build.sh sets it only for the native
pytorch-linux-noble-riscv64-py3.12-gcc14 tag, ubuntu-cross-riscv/Dockerfile
declares no matching ARG, and no PIP_* variable appears in the container
environment dumped by those runs.

Lint:

```
lintrunner --paths-cmd='git diff --name-only origin/viable/strict'
bash -n .ci/pytorch/build.sh
```
zklaus added a commit to zklaus/pytorch that referenced this pull request Sep 14, 2026
The riscv64 cross build has not taken its own code path since pytorch#187821. That PR
renamed the docker image to pytorch-linux-noble-riscv64-py3.12-gcc14-cross-build
and narrowed the guards from *riscv* to *riscv*cross*, but the guards in
.ci/docker/build.sh test the image name while the ones in .ci/pytorch/build.sh
test BUILD_ENVIRONMENT -- and only the image name gained the "cross" marker.
BUILD_ENVIRONMENT stayed linux-noble-riscv64-py3.12-gcc14, so
`[[ "$BUILD_ENVIRONMENT" == *riscv64*cross* ]]` has been false ever since.

Everything in that block is skipped as a result: the crossenv at
/opt/riscv-cross-env is never activated, so the build runs against the host
interpreter; CMAKE_CROSSCOMPILING, CMAKE_SYSTEM_NAME and CMAKE_SYSTEM_PROCESSOR
are never exported, so CMake never enters cross mode even though CC/CXX point at
the riscv64 toolchain; and SLEEF_TARGET_EXEC_USE_QEMU and the workspace chown are
missed too. pytorch#190887 later added an `elif *riscv64*` arm for the new native image,
which is the branch this job has been taking.

Aligning BUILD_ENVIRONMENT with the image name is the smaller of the two possible
fixes and matches the intent of pytorch#187821. Widening the guards back to *riscv64*
would work for this job but would pull the native image, which is genuinely named
linux-noble-riscv64-py3.12-gcc14, onto the cross path -- and that path exits 1
when /opt/riscv-cross-env is absent. The string is only consumed as
$BUILD_ENVIRONMENT and as the build artifact name, so renaming it is contained;
no other pattern in .ci/pytorch/build.sh matches the added "-cross-build".

This commit was authored with the assistance of an AI coding assistant.

Test Plan:

The job is opt-in, so this needs a ciflow/riscv64 run to verify. It has been red
since 2025-10 and the last run predates both pytorch#190887 and the scikit-build-core
migration, so this is expected to uncover further breakage rather than turn the
job green on its own -- in particular the crossenv is provisioned with
`setuptools pyyaml typing_extensions wheel` only, while the build now invokes
`python -m build --wheel --no-isolation`. Fixing that needs to be informed by a
real run, since crossenv splits host and target environments and build backends
belong in the host one.

Root cause confirmed from the last run's log
(https://github.com/pytorch/pytorch/actions/runs/28817304405), which shows the
guard evaluating false:

```
+ [[ linux-noble-riscv64-py3.12-gcc14 == *riscv64*cross* ]]
+ [[ linux-noble-riscv64-py3.12-gcc14 == *vulkan* ]]
```

Checked that no other BUILD_ENVIRONMENT pattern in the build script starts
matching once "-cross-build" is appended:

```
grep -on 'BUILD_ENVIRONMENT" [!=]= \*[^]]*\*' .ci/pytorch/build.sh \
  | sed 's/.*== //;s/.*!= //' | sort -u
```

yields *aarch64* *clang* *-clang*-asan* *client* *cuda* *cuda13* *-debug*
*-full-debug* *full-debug* *libtorch* *riscv64* *riscv64*cross* *rocm* *-tsan*
*vulkan* *xla* *xpu*, of which only the two riscv64 patterns match, both
intentionally.

Lint:

```
lintrunner --paths-cmd='git diff --name-only origin/viable/strict'
```
zklaus added a commit to zklaus/pytorch that referenced this pull request Sep 14, 2026
…rements

With the routing fixed, the riscv64 cross job reaches the build and stops at
`python -m build`: the crossenv is provisioned with `setuptools pyyaml
typing_extensions wheel`, which was enough for `setup.py bdist_wheel` but not for
the scikit-build-core front end and backend. Run 32955566963 ends at

    /opt/riscv-cross-env/cross/bin/python3: No module named build

Install the missing pieces into the crossenv. What goes where follows from what
crossenv actually is: its `cross` interpreter is the host CPython with sysconfig
patched to report the target's values, not a riscv64 binary -- the error above is
an x86_64 process raising a Python error. So pure-Python build tooling (build,
scikit-build-core, packaging, six) installs into the cross environment and runs
there natively, and it has to be reachable from that interpreter specifically:
driving the build from the host environment would hand the backend the host
sysconfig and produce a host-tagged wheel. cmake and ninja stay where they are,
on the host, because they are executed rather than imported; installing them into
the cross environment would fetch riscv64 wheels the host cannot run.

The install has to sit after the chown loop rather than beside the other exports.
The crossenv is root-owned in the image while the container runs as jenkins, so
until `sudo chown -R jenkins /opt/riscv-cross-env` has run the cross interpreter
cannot read `cross/pyvenv.cfg` and dies during startup, before `site` is
imported. Nothing else in the script makes that dependency visible -- the
existing `python -m build` call is far enough down that it never noticed -- so it
is called out in a comment.

numpy is the exception that needs a target wheel, and PyPI has none for riscv64.
The RISE project index does, and it is already a trusted host here -- pytorch#190887
wired it into the native riscv64 image the same way. 1.26.4 is chosen on two
counts: it matches the Python 3.12 pin in .ci/docker/requirements-ci.txt, and it
is the newest numpy published there under a plain linux_riscv64 tag, so it does
not depend on crossenv resolving manylinux glibc tags for the target. The pin is
load-bearing in a second way: with an extra index pip resolves the highest
version across both, and every newer numpy exists on PyPI without a riscv64
wheel, so leaving it unpinned would silently cross-build numpy from an sdist.

Provisioning belongs in the image rather than in this script, and moving it to
.ci/docker/ubuntu-cross-riscv/Dockerfile is the intended end state. It is
deliberately not done here: the job has been red since 2025-10 and there is
almost certainly more breakage past this point, while any change under .ci/docker
rehashes the directory and rebuilds every CI image. Doing that once, when the
whole path is known green, is cheaper than doing it per iteration.

Note that numpy may still not end up enabled. It satisfies the build-requires
check, which `build` performs through importlib.metadata rather than by importing
(build/_util.py), but FindPython's NumPy component discovers its include
directory by running `import numpy; numpy.get_include()`, and a riscv64 extension
module cannot be imported on an x86_64 host. FindPython swallows that in a bare
`except: pass`, so the expected outcome is a "NumPy could not be found" warning
from Dependencies.cmake and USE_NUMPY off -- no worse than the status quo. If
numpy is wanted for real, the follow-up is to set Python_NumPy_INCLUDE_DIR
directly instead of letting FindPython probe.

This commit was authored with the assistance of an AI coding assistant.

Test Plan:

Needs a ciflow/riscv64 run; the job is opt-in and cannot be exercised locally.
Two runs on this branch informed this change.

32955566963 established the starting point -- the guard from the previous commit
resolves, the crossenv activates, and the build stops on the missing front end:

```
+ [[ linux-noble-riscv64-py3.12-gcc14-cross-build == *riscv64*cross* ]]
+ source /opt/riscv-cross-env/bin/activate
+ export CMAKE_CROSSCOMPILING=TRUE
...
+ python -m build --wheel --no-isolation
/opt/riscv-cross-env/cross/bin/python3: No module named build
```

32971278636 ran this install from the wrong place, before the chown, and is what
established the ownership constraint above:

```
Fatal Python error: init_import_site: Failed to import the site module
PermissionError: [Errno 13] Permission denied: '/opt/riscv-cross-env/cross/pyvenv.cfg'
```

Confirmed the RISE project index actually serves the wheel this pins, via the
simple repository API:

```
curl -sS https://pypi.riseproject.dev/simple/numpy/ \
  | grep -o 'numpy-[^<]*cp312[^<]*\.whl' | sort -u
```

which lists numpy-1.26.4-cp312-cp312-linux_riscv64.whl among 16 cp312 riscv64
wheels; everything from 2.3.1 onward is published only under
manylinux_2_38/manylinux_2_39 tags. The same query against the index root shows
it carries numpy, pyyaml, ninja and cmake but not build, scikit-build-core,
packaging or six, which is why PyPI stays the primary index and this is an
--extra-index-url rather than an --index-url.

Checked that PIP_EXTRA_INDEX_URL is not already in effect for this image, so the
flag is not redundant: .ci/docker/build.sh sets it only for the native
pytorch-linux-noble-riscv64-py3.12-gcc14 tag, ubuntu-cross-riscv/Dockerfile
declares no matching ARG, and no PIP_* variable appears in the container
environment dumped by those runs.

Lint:

```
lintrunner --paths-cmd='git diff --name-only origin/viable/strict'
bash -n .ci/pytorch/build.sh
```
zklaus added a commit to zklaus/pytorch that referenced this pull request Sep 29, 2026
The riscv64 cross build has not taken its own code path since pytorch#187821. That PR
renamed the docker image to pytorch-linux-noble-riscv64-py3.12-gcc14-cross-build
and narrowed the guards from *riscv* to *riscv*cross*, but the guards in
.ci/docker/build.sh test the image name while the ones in .ci/pytorch/build.sh
test BUILD_ENVIRONMENT -- and only the image name gained the "cross" marker.
BUILD_ENVIRONMENT stayed linux-noble-riscv64-py3.12-gcc14, so
`[[ "$BUILD_ENVIRONMENT" == *riscv64*cross* ]]` has been false ever since.

Everything in that block is skipped as a result: the crossenv at
/opt/riscv-cross-env is never activated, so the build runs against the host
interpreter; CMAKE_CROSSCOMPILING, CMAKE_SYSTEM_NAME and CMAKE_SYSTEM_PROCESSOR
are never exported, so CMake never enters cross mode even though CC/CXX point at
the riscv64 toolchain; and SLEEF_TARGET_EXEC_USE_QEMU and the workspace chown are
missed too. pytorch#190887 later added an `elif *riscv64*` arm for the new native image,
which is the branch this job has been taking.

Aligning BUILD_ENVIRONMENT with the image name is the smaller of the two possible
fixes and matches the intent of pytorch#187821. Widening the guards back to *riscv64*
would work for this job but would pull the native image, which is genuinely named
linux-noble-riscv64-py3.12-gcc14, onto the cross path -- and that path exits 1
when /opt/riscv-cross-env is absent. The string is only consumed as
$BUILD_ENVIRONMENT and as the build artifact name, so renaming it is contained;
no other pattern in .ci/pytorch/build.sh matches the added "-cross-build".

This commit was authored with the assistance of an AI coding assistant.

Test Plan:

The job is opt-in, so this needs a ciflow/riscv64 run to verify. It has been red
since 2025-10 and the last run predates both pytorch#190887 and the scikit-build-core
migration, so this is expected to uncover further breakage rather than turn the
job green on its own -- in particular the crossenv is provisioned with
`setuptools pyyaml typing_extensions wheel` only, while the build now invokes
`python -m build --wheel --no-isolation`. Fixing that needs to be informed by a
real run, since crossenv splits host and target environments and build backends
belong in the host one.

Root cause confirmed from the last run's log
(https://github.com/pytorch/pytorch/actions/runs/28817304405), which shows the
guard evaluating false:

```
+ [[ linux-noble-riscv64-py3.12-gcc14 == *riscv64*cross* ]]
+ [[ linux-noble-riscv64-py3.12-gcc14 == *vulkan* ]]
```

Checked that no other BUILD_ENVIRONMENT pattern in the build script starts
matching once "-cross-build" is appended:

```
grep -on 'BUILD_ENVIRONMENT" [!=]= \*[^]]*\*' .ci/pytorch/build.sh \
  | sed 's/.*== //;s/.*!= //' | sort -u
```

yields *aarch64* *clang* *-clang*-asan* *client* *cuda* *cuda13* *-debug*
*-full-debug* *full-debug* *libtorch* *riscv64* *riscv64*cross* *rocm* *-tsan*
*vulkan* *xla* *xpu*, of which only the two riscv64 patterns match, both
intentionally.

Lint:

```
lintrunner --paths-cmd='git diff --name-only origin/viable/strict'
```
zklaus added a commit to zklaus/pytorch that referenced this pull request Sep 29, 2026
…rements

With the routing fixed, the riscv64 cross job reaches the build and stops at
`python -m build`: the crossenv is provisioned with `setuptools pyyaml
typing_extensions wheel`, which was enough for `setup.py bdist_wheel` but not for
the scikit-build-core front end and backend. Run 32955566963 ends at

    /opt/riscv-cross-env/cross/bin/python3: No module named build

Install the missing pieces into the crossenv. What goes where follows from what
crossenv actually is: its `cross` interpreter is the host CPython with sysconfig
patched to report the target's values, not a riscv64 binary -- the error above is
an x86_64 process raising a Python error. So pure-Python build tooling (build,
scikit-build-core, packaging, six) installs into the cross environment and runs
there natively, and it has to be reachable from that interpreter specifically:
driving the build from the host environment would hand the backend the host
sysconfig and produce a host-tagged wheel. cmake and ninja stay where they are,
on the host, because they are executed rather than imported; installing them into
the cross environment would fetch riscv64 wheels the host cannot run.

The install has to sit after the chown loop rather than beside the other exports.
The crossenv is root-owned in the image while the container runs as jenkins, so
until `sudo chown -R jenkins /opt/riscv-cross-env` has run the cross interpreter
cannot read `cross/pyvenv.cfg` and dies during startup, before `site` is
imported. Nothing else in the script makes that dependency visible -- the
existing `python -m build` call is far enough down that it never noticed -- so it
is called out in a comment.

numpy is the exception that needs a target wheel, and PyPI has none for riscv64.
The RISE project index does, and it is already a trusted host here -- pytorch#190887
wired it into the native riscv64 image the same way. 1.26.4 is chosen on two
counts: it matches the Python 3.12 pin in .ci/docker/requirements-ci.txt, and it
is the newest numpy published there under a plain linux_riscv64 tag, so it does
not depend on crossenv resolving manylinux glibc tags for the target. The pin is
load-bearing in a second way: with an extra index pip resolves the highest
version across both, and every newer numpy exists on PyPI without a riscv64
wheel, so leaving it unpinned would silently cross-build numpy from an sdist.

Provisioning belongs in the image rather than in this script, and moving it to
.ci/docker/ubuntu-cross-riscv/Dockerfile is the intended end state. It is
deliberately not done here: the job has been red since 2025-10 and there is
almost certainly more breakage past this point, while any change under .ci/docker
rehashes the directory and rebuilds every CI image. Doing that once, when the
whole path is known green, is cheaper than doing it per iteration.

Note that numpy may still not end up enabled. It satisfies the build-requires
check, which `build` performs through importlib.metadata rather than by importing
(build/_util.py), but FindPython's NumPy component discovers its include
directory by running `import numpy; numpy.get_include()`, and a riscv64 extension
module cannot be imported on an x86_64 host. FindPython swallows that in a bare
`except: pass`, so the expected outcome is a "NumPy could not be found" warning
from Dependencies.cmake and USE_NUMPY off -- no worse than the status quo. If
numpy is wanted for real, the follow-up is to set Python_NumPy_INCLUDE_DIR
directly instead of letting FindPython probe.

This commit was authored with the assistance of an AI coding assistant.

Test Plan:

Needs a ciflow/riscv64 run; the job is opt-in and cannot be exercised locally.
Two runs on this branch informed this change.

32955566963 established the starting point -- the guard from the previous commit
resolves, the crossenv activates, and the build stops on the missing front end:

```
+ [[ linux-noble-riscv64-py3.12-gcc14-cross-build == *riscv64*cross* ]]
+ source /opt/riscv-cross-env/bin/activate
+ export CMAKE_CROSSCOMPILING=TRUE
...
+ python -m build --wheel --no-isolation
/opt/riscv-cross-env/cross/bin/python3: No module named build
```

32971278636 ran this install from the wrong place, before the chown, and is what
established the ownership constraint above:

```
Fatal Python error: init_import_site: Failed to import the site module
PermissionError: [Errno 13] Permission denied: '/opt/riscv-cross-env/cross/pyvenv.cfg'
```

Confirmed the RISE project index actually serves the wheel this pins, via the
simple repository API:

```
curl -sS https://pypi.riseproject.dev/simple/numpy/ \
  | grep -o 'numpy-[^<]*cp312[^<]*\.whl' | sort -u
```

which lists numpy-1.26.4-cp312-cp312-linux_riscv64.whl among 16 cp312 riscv64
wheels; everything from 2.3.1 onward is published only under
manylinux_2_38/manylinux_2_39 tags. The same query against the index root shows
it carries numpy, pyyaml, ninja and cmake but not build, scikit-build-core,
packaging or six, which is why PyPI stays the primary index and this is an
--extra-index-url rather than an --index-url.

Checked that PIP_EXTRA_INDEX_URL is not already in effect for this image, so the
flag is not redundant: .ci/docker/build.sh sets it only for the native
pytorch-linux-noble-riscv64-py3.12-gcc14 tag, ubuntu-cross-riscv/Dockerfile
declares no matching ARG, and no PIP_* variable appears in the container
environment dumped by those runs.

Lint:

```
lintrunner --paths-cmd='git diff --name-only origin/viable/strict'
bash -n .ci/pytorch/build.sh
```
pytorchmergebot pushed a commit that referenced this pull request Sep 29, 2026
)

The riscv64 cross build has not taken its own code path since #187821. That PR renamed the docker image to pytorch-linux-noble-riscv64-py3.12-gcc14-cross-build and narrowed the guards from *riscv* to *riscv*cross*, but the guards in .ci/docker/build.sh test the image name while the ones in .ci/pytorch/build.sh test BUILD_ENVIRONMENT -- and only the image name gained the "cross" marker. BUILD_ENVIRONMENT stayed linux-noble-riscv64-py3.12-gcc14, so `[[ "$BUILD_ENVIRONMENT" == *riscv64*cross* ]]` has been false ever since.

Everything in that block is skipped as a result: the crossenv at /opt/riscv-cross-env is never activated, so the build runs against the host interpreter; CMAKE_CROSSCOMPILING, CMAKE_SYSTEM_NAME and CMAKE_SYSTEM_PROCESSOR are never exported, so CMake never enters cross mode even though CC/CXX point at the riscv64 toolchain; and SLEEF_TARGET_EXEC_USE_QEMU and the workspace chown are missed too. #190887 later added an `elif *riscv64*` arm for the new native image, which is the branch this job has been taking.

Aligning BUILD_ENVIRONMENT with the image name is the smaller of the two possible fixes and matches the intent of #187821. Widening the guards back to *riscv64* would work for this job but would pull the native image, which is genuinely named linux-noble-riscv64-py3.12-gcc14, onto the cross path -- and that path exits 1 when /opt/riscv-cross-env is absent. The string is only consumed as $BUILD_ENVIRONMENT and as the build artifact name, so renaming it is contained; no other pattern in .ci/pytorch/build.sh matches the added "-cross-build".

This commit was authored with the assistance of an AI coding assistant.

Test Plan:

The job is opt-in, so this needs a ciflow/riscv64 run to verify. It has been red since 2025-10 and the last run predates both #190887 and the scikit-build-core migration, so this is expected to uncover further breakage rather than turn the job green on its own -- in particular the crossenv is provisioned with `setuptools pyyaml typing_extensions wheel` only, while the build now invokes `python -m build --wheel --no-isolation`. Fixing that needs to be informed by a real run, since crossenv splits host and target environments and build backends belong in the host one.

Root cause confirmed from the last run's log
(https://github.com/pytorch/pytorch/actions/runs/28817304405), which shows the guard evaluating false:

```
+ [[ linux-noble-riscv64-py3.12-gcc14 == *riscv64*cross* ]]
+ [[ linux-noble-riscv64-py3.12-gcc14 == *vulkan* ]]
```

Checked that no other BUILD_ENVIRONMENT pattern in the build script starts matching once "-cross-build" is appended:

```
grep -on 'BUILD_ENVIRONMENT" [!=]= \*[^]]*\*' .ci/pytorch/build.sh \
  | sed 's/.*== //;s/.*!= //' | sort -u
```

yields *aarch64* *clang* *-clang*-asan* *client* *cuda* *cuda13* *-debug* *-full-debug* *full-debug* *libtorch* *riscv64* *riscv64*cross* *rocm* *-tsan* *vulkan* *xla* *xpu*, of which only the two riscv64 patterns match, both intentionally.

Lint:

```
lintrunner --paths-cmd='git diff --name-only origin/viable/strict'
```
Pull Request resolved: #194880
Approved by: https://github.com/isuruf, https://github.com/atalman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/docker ciflow/trunk Trigger trunk jobs on your pull request Merged open source release notes: releng release notes category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants