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 clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ doc-valid-idents = [
"ReFS",
"PyTorch",
"ROCm",
"XPU",
".." # Include the defaults
]

Expand Down
6 changes: 6 additions & 0 deletions crates/uv-resolver/src/resolver/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,10 @@ mod tests {
let url = DisplaySafeUrl::parse("https://download.pytorch.org/whl/cpu").unwrap();
assert_eq!(SystemDependency::from_index(&url), None);
}

#[test]
fn pytorch_xpu() {
let url = DisplaySafeUrl::parse("https://download.pytorch.org/whl/xpu").unwrap();
assert_eq!(SystemDependency::from_index(&url), None);
}
}
10 changes: 10 additions & 0 deletions crates/uv-torch/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ pub enum TorchMode {
#[serde(rename = "rocm4.0.1")]
#[cfg_attr(feature = "clap", clap(name = "rocm4.0.1"))]
Rocm401,
/// Use the PyTorch index for Intel XPU.
Xpu,
}

/// The strategy to use when determining the appropriate PyTorch index.
Expand Down Expand Up @@ -237,6 +239,7 @@ impl TorchStrategy {
TorchMode::Rocm42 => Ok(Self::Backend(TorchBackend::Rocm42)),
TorchMode::Rocm41 => Ok(Self::Backend(TorchBackend::Rocm41)),
TorchMode::Rocm401 => Ok(Self::Backend(TorchBackend::Rocm401)),
TorchMode::Xpu => Ok(Self::Backend(TorchBackend::Xpu)),
}
}

Expand Down Expand Up @@ -356,6 +359,7 @@ pub enum TorchBackend {
Rocm42,
Rocm41,
Rocm401,
Xpu,
}

impl TorchBackend {
Expand Down Expand Up @@ -403,6 +407,7 @@ impl TorchBackend {
Self::Rocm42 => &ROCM42_INDEX_URL,
Self::Rocm41 => &ROCM41_INDEX_URL,
Self::Rocm401 => &ROCM401_INDEX_URL,
Self::Xpu => &XPU_INDEX_URL,
}
}

Expand Down Expand Up @@ -465,6 +470,7 @@ impl TorchBackend {
TorchBackend::Rocm42 => None,
TorchBackend::Rocm41 => None,
TorchBackend::Rocm401 => None,
TorchBackend::Xpu => None,
}
}

Expand Down Expand Up @@ -512,6 +518,7 @@ impl TorchBackend {
TorchBackend::Rocm42 => Some(Version::new([4, 2])),
TorchBackend::Rocm41 => Some(Version::new([4, 1])),
TorchBackend::Rocm401 => Some(Version::new([4, 0, 1])),
TorchBackend::Xpu => None,
}
}
}
Expand Down Expand Up @@ -562,6 +569,7 @@ impl FromStr for TorchBackend {
"rocm4.2" => Ok(TorchBackend::Rocm42),
"rocm4.1" => Ok(TorchBackend::Rocm41),
"rocm4.0.1" => Ok(TorchBackend::Rocm401),
"xpu" => Ok(TorchBackend::Xpu),
_ => Err(format!("Unknown PyTorch backend: {s}")),
}
}
Expand Down Expand Up @@ -725,3 +733,5 @@ static ROCM41_INDEX_URL: LazyLock<IndexUrl> =
LazyLock::new(|| IndexUrl::from_str("https://download.pytorch.org/whl/rocm4.1").unwrap());
static ROCM401_INDEX_URL: LazyLock<IndexUrl> =
LazyLock::new(|| IndexUrl::from_str("https://download.pytorch.org/whl/rocm4.0.1").unwrap());
static XPU_INDEX_URL: LazyLock<IndexUrl> =
LazyLock::new(|| IndexUrl::from_str("https://download.pytorch.org/whl/xpu").unwrap());
3 changes: 3 additions & 0 deletions docs/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -3451,6 +3451,7 @@ by <code>--python-version</code>.</p>
<li><code>rocm4.2</code>: Use the PyTorch index for ROCm 4.2</li>
<li><code>rocm4.1</code>: Use the PyTorch index for ROCm 4.1</li>
<li><code>rocm4.0.1</code>: Use the PyTorch index for ROCm 4.0.1</li>
<li><code>xpu</code>: Use the PyTorch index for Intel XPU</li>
</ul></dd><dt id="uv-pip-compile--universal"><a href="#uv-pip-compile--universal"><code>--universal</code></a></dt><dd><p>Perform a universal resolution, attempting to generate a single <code>requirements.txt</code> output file that is compatible with all operating systems, architectures, and Python implementations.</p>
<p>In universal mode, the current Python version (or user-provided <code>--python-version</code>) will be treated as a lower bound. For example, <code>--universal --python-version 3.7</code> would produce a universal resolution for Python 3.7 and later.</p>
<p>Implies <code>--no-strip-markers</code>.</p>
Expand Down Expand Up @@ -3708,6 +3709,7 @@ be used with caution, as it can modify the system Python installation.</p>
<li><code>rocm4.2</code>: Use the PyTorch index for ROCm 4.2</li>
<li><code>rocm4.1</code>: Use the PyTorch index for ROCm 4.1</li>
<li><code>rocm4.0.1</code>: Use the PyTorch index for ROCm 4.0.1</li>
<li><code>xpu</code>: Use the PyTorch index for Intel XPU</li>
</ul></dd><dt id="uv-pip-sync--verbose"><a href="#uv-pip-sync--verbose"><code>--verbose</code></a>, <code>-v</code></dt><dd><p>Use verbose output.</p>
<p>You can configure fine-grained logging using the <code>RUST_LOG</code> environment variable. (<a href="https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#directives">https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#directives</a>)</p>
</dd></dl>
Expand Down Expand Up @@ -3998,6 +4000,7 @@ should be used with caution, as it can modify the system Python installation.</p
<li><code>rocm4.2</code>: Use the PyTorch index for ROCm 4.2</li>
<li><code>rocm4.1</code>: Use the PyTorch index for ROCm 4.1</li>
<li><code>rocm4.0.1</code>: Use the PyTorch index for ROCm 4.0.1</li>
<li><code>xpu</code>: Use the PyTorch index for Intel XPU</li>
</ul></dd><dt id="uv-pip-install--upgrade"><a href="#uv-pip-install--upgrade"><code>--upgrade</code></a>, <code>-U</code></dt><dd><p>Allow package upgrades, ignoring pinned versions in any existing output file. Implies <code>--refresh</code></p>
</dd><dt id="uv-pip-install--upgrade-package"><a href="#uv-pip-install--upgrade-package"><code>--upgrade-package</code></a>, <code>-P</code> <i>upgrade-package</i></dt><dd><p>Allow upgrades for a specific package, ignoring pinned versions in any existing output file. Implies <code>--refresh-package</code></p>
</dd><dt id="uv-pip-install--user"><a href="#uv-pip-install--user"><code>--user</code></a></dt><dt id="uv-pip-install--verbose"><a href="#uv-pip-install--verbose"><code>--verbose</code></a>, <code>-v</code></dt><dd><p>Use verbose output.</p>
Expand Down
7 changes: 7 additions & 0 deletions uv.schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading