Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/uv-resolver/src/resolver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1839,6 +1839,7 @@ impl<InstalledPackages: InstalledPackagesProvider> ResolverState<InstalledPackag
.torch_backend
.as_ref()
.filter(|torch_backend| matches!(torch_backend, TorchStrategy::Cuda { .. }))
.filter(|torch_backend| torch_backend.has_system_dependency(name))
.and_then(|_| pins.get(name, version).and_then(ResolvedDist::index))
.map(IndexUrl::url)
.and_then(SystemDependency::from_index)
Expand Down
19 changes: 19 additions & 0 deletions crates/uv-torch/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,25 @@ impl TorchStrategy {
)
}

/// Returns `true` if the given [`PackageName`] has a system dependency (e.g., CUDA or ROCm).
///
/// For example, `triton` is hosted on the PyTorch indexes, but does not have a system
/// dependency on the associated CUDA version (i.e., the `triton` on the `cu128` index doesn't
/// depend on CUDA 12.8).
pub fn has_system_dependency(&self, package_name: &PackageName) -> bool {
matches!(
package_name.as_str(),
"torch"
| "torcharrow"
| "torchaudio"
| "torchcsprng"
| "torchdata"
| "torchdistx"
| "torchtext"
| "torchvision"
)
}

/// Return the appropriate index URLs for the given [`TorchStrategy`].
pub fn index_urls(&self) -> impl Iterator<Item = &IndexUrl> {
match self {
Expand Down
Loading