Skip to content

Conversation

Gasoonjia
Copy link
Contributor

This PR enables CUDA version PT installation when building with CUDA delegate enabled from source.

More specific:

  1. ET will keep depending on cpu PT as long as CUDA delegate is not enabled;
  2. We will choose the CUDA PT exactly match user's cuda version: if user don't have CUDA, or have CUDA but not exactly match the versions PT supported, the installation script will raise error.

Copy link

pytorch-bot bot commented Sep 16, 2025

🔗 Helpful Links

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

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

❌ 4 New Failures, 7 Unrelated Failures

As of commit 19c2fb2 with merge base a548635 (image):

NEW FAILURES - The following jobs have failed:

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 16, 2025
Copy link

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Comment on lines 88 to 94
def _check_cuda_enabled():
"""Check if CUDA delegate is enabled via CMAKE_ARGS environment variable."""
cmake_args = os.environ.get("CMAKE_ARGS", "")
return "-DEXECUTORCH_BUILD_CUDA=ON" in cmake_args


def _cuda_version_to_pytorch_suffix(major, minor):
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we pull all cuda related functions into util?

_torch_url = ""


def _determine_torch_url():
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like it belongs to util as well

_torch_url_cache = ""


def determine_torch_url(torch_nightly_url_base, supported_cuda_versions):
Copy link
Contributor

Choose a reason for hiding this comment

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

this function is only called twice is it really necessary to cache?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

main reason to cache is try not print too much noise output.

Copy link
Contributor

Choose a reason for hiding this comment

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

Use @functools.lru_cache

@Gasoonjia Gasoonjia merged commit a954a75 into main Sep 20, 2025
268 of 279 checks passed
@Gasoonjia Gasoonjia deleted the install-cuda-pt branch September 20, 2025 06:22
StrycekSimon pushed a commit to nxp-upstream/executorch that referenced this pull request Sep 23, 2025
This PR enables CUDA version PT installation when building with CUDA
delegate enabled from source.

More specific:
1. ET will keep depending on cpu PT as long as CUDA delegate is not
enabled;
2. We will choose the CUDA PT exactly match user's cuda version: if user
don't have CUDA, or have CUDA but not exactly match the versions PT
supported, the installation script will raise error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants