PyTorch: add v2.6.0 (#48794)

This commit is contained in:
Adam J. Stewart 2025-02-06 13:32:53 +01:00 committed by GitHub
parent bb0517f4d9
commit 3c7392bbcc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 89 additions and 18 deletions

View File

@ -18,7 +18,8 @@ class Cpuinfo(CMakePackage):
license("BSD-2-Clause")
version("main", branch="main")
version("2024-09-06", commit="094fc30b9256f54dad5ad23bcbfb5de74781422f") # py-torch@2.5.1:
version("2024-09-26", commit="1e83a2fdd3102f65c6f1fb602c1b320486218a99") # py-torch@2.6:
version("2024-09-06", commit="094fc30b9256f54dad5ad23bcbfb5de74781422f") # py-torch@2.5.1
version("2024-08-30", commit="fa1c679da8d19e1d87f20175ae1ec10995cd3dd3") # py-torch@2.5.0
version("2023-11-04", commit="d6860c477c99f1fce9e28eb206891af3c0e1a1d7") # py-torch@2.3:2.4
version("2023-01-13", commit="6481e8bef08f606ddd627e4d3be89f64d62e1b8a") # py-torch@2.1:2.2

View File

@ -26,6 +26,7 @@ class PyPybind11(CMakePackage, PythonExtension):
maintainers("ax3l")
version("master", branch="master")
version("2.13.6", sha256="e08cb87f4773da97fa7b5f035de8763abc656d87d5773e62f6da0587d1f0ec20")
version("2.13.5", sha256="b1e209c42b3a9ed74da3e0b25a4f4cd478d89d5efbb48f04b277df427faf6252")
version("2.13.4", sha256="efc901aa0aab439a3fea6efeaf930b5a349fb06394bf845c64ce15a9cf8f0240")
version("2.13.3", sha256="6e7a84ec241544f2f5e30c7a82c09c81f0541dd14e9d9ef61051e07105f9c445")

View File

@ -17,13 +17,17 @@ class PyTorchNvidiaApex(PythonPackage, CudaPackage):
license("BSD-3-Clause")
version("master", branch="master")
version("24.04.01", sha256="065bc5c0146ee579d5db2b38ca3949da4dc799b871961a2c9eb19e18892166ce")
version(
"24.04.01",
sha256="065bc5c0146ee579d5db2b38ca3949da4dc799b871961a2c9eb19e18892166ce",
preferred=True,
)
version("23.08", tag="23.08")
version("23.07", tag="23.07")
version("23.06", tag="23.06")
version("23.05", tag="23.05")
version("22.03", tag="22.03")
version("2020-10-19", commit="8a1ed9e8d35dfad26fb973996319965e4224dcdd")
version("2020-10-19", commit="8a1ed9e8d35dfad26fb973996319965e4224dcdd", deprecated=True)
depends_on("c", type="build")
depends_on("cxx", type="build")
@ -75,6 +79,17 @@ class PyTorchNvidiaApex(PythonPackage, CudaPackage):
# https://github.com/NVIDIA/apex/issues/1498
# https://github.com/NVIDIA/apex/pull/1499
patch("1499.patch", when="@2020-10-19")
patch(
"https://github.com/NVIDIA/apex/pull/1879.patch?full_index=1",
sha256="8e2e21aa883d93e6c0ea0fecb812c8de906b2e77bcffeeb716adabd1dd76650e",
when="@23.05:2019",
)
patch(
"https://github.com/NVIDIA/apex/pull/1855.patch?full_index=1",
sha256="8481b1234a9ce1e8bef4e57a259d8528107761e1843777489e815ec3727397fd",
when="@:24.10",
)
conflicts(
"cuda_arch=none",

View File

@ -24,6 +24,7 @@ class PyTorch(PythonPackage, CudaPackage, ROCmPackage):
maintainers("adamjstewart")
version("main", branch="main")
version("2.6.0", tag="v2.6.0", commit="1eba9b3aa3c43f86f4a2c807ac8e12c4a7767340")
version("2.5.1", tag="v2.5.1", commit="a8d6afb511a69687bbb2b7e88a3cf67917e1697e")
version("2.5.0", tag="v2.5.0", commit="32f585d9346e316e554c8d9bf7548af9f62141fc")
version("2.4.1", tag="v2.4.1", commit="ee1b6804381c57161c477caa380a840a84167676")
@ -164,17 +165,18 @@ class PyTorch(PythonPackage, CudaPackage, ROCmPackage):
with default_args(type=("build", "run")):
# setup.py
depends_on("py-filelock", when="@2:")
depends_on("py-typing-extensions@4.10:", when="@2.6:")
depends_on("py-typing-extensions@4.8:", when="@2.2:")
depends_on("py-typing-extensions@3.6.2.1:", when="@1.7:")
depends_on("py-setuptools")
depends_on("py-sympy", when="@2:")
depends_on("py-networkx", when="@2:")
depends_on("py-jinja2", when="@2:")
depends_on("py-fsspec", when="@2.1:")
# pyproject.toml
depends_on("py-setuptools")
depends_on("py-astunparse", when="@1.13:")
depends_on("py-numpy@1.16.6:")
depends_on("py-numpy")
# https://github.com/pytorch/pytorch/issues/107302
depends_on("py-numpy@:1", when="@:2.2")
depends_on("py-pyyaml")
@ -188,15 +190,18 @@ class PyTorch(PythonPackage, CudaPackage, ROCmPackage):
# Third party dependencies
depends_on("fp16@2020-05-14", when="@1.6:")
depends_on("fxdiv@2020-04-17", when="@1.6:")
depends_on("nvtx@3.1.0", when="@2.6:")
# https://github.com/pytorch/pytorch/issues/60332
# depends_on("xnnpack@2024-02-29", when="@2.3:+xnnpack")
# depends_on("xnnpack@2024-11-08", when="@2.6:+xnnpack")
# depends_on("xnnpack@2024-02-29", when="@2.3:2.5+xnnpack")
# depends_on("xnnpack@2022-12-21", when="@2.0:2.2+xnnpack")
# depends_on("xnnpack@2022-02-16", when="@1.12:1+xnnpack")
# depends_on("xnnpack@2021-06-21", when="@1.10:1.11+xnnpack")
# depends_on("xnnpack@2021-02-22", when="@1.8:1.9+xnnpack")
# depends_on("xnnpack@2020-03-23", when="@1.6:1.7+xnnpack")
depends_on("benchmark", when="@1.6:+test")
depends_on("cpuinfo@2024-09-06", when="@2.5.1:")
depends_on("cpuinfo@2024-09-26", when="@2.6:")
depends_on("cpuinfo@2024-09-06", when="@2.5.1")
depends_on("cpuinfo@2024-08-30", when="@2.5.0")
depends_on("cpuinfo@2023-11-04", when="@2.3:2.4")
depends_on("cpuinfo@2023-01-13", when="@2.1:2.2")
@ -216,7 +221,8 @@ class PyTorch(PythonPackage, CudaPackage, ROCmPackage):
depends_on("gloo+libuv", when="@1.6: platform=darwin")
depends_on("nccl", when="+nccl+cuda")
# https://github.com/pytorch/pytorch/issues/60331
# depends_on("onnx@1.16.0", when="@2.3:")
# depends_on("onnx@1.17.0", when="@2.6:")
# depends_on("onnx@1.16.0", when="@2.3:2.5")
# depends_on("onnx@1.15.0", when="@2.2")
# depends_on("onnx@1.14.1", when="@2.1")
# depends_on("onnx@1.13.1", when="@2.0")
@ -242,7 +248,8 @@ class PyTorch(PythonPackage, CudaPackage, ROCmPackage):
depends_on("pthreadpool@2020-10-05", when="@1.8")
depends_on("pthreadpool@2020-06-15", when="@1.6:1.7")
with default_args(type=("build", "link", "run")):
depends_on("py-pybind11@2.13.5:", when="@2.5:")
depends_on("py-pybind11@2.13.6:", when="@2.6:")
depends_on("py-pybind11@2.13.5:", when="@2.5")
depends_on("py-pybind11@2.12.0:", when="@2.3:2.4")
depends_on("py-pybind11@2.11.0:", when="@2.1:2.2")
depends_on("py-pybind11@2.10.1:", when="@2.0")
@ -309,6 +316,14 @@ class PyTorch(PythonPackage, CudaPackage, ROCmPackage):
conflicts("%gcc@:9.3", when="@2.2:", msg="C++17 support required")
# https://github.com/pytorch/pytorch/issues/146239
patch(
"https://github.com/pytorch/pytorch/pull/140275.patch?full_index=1",
sha256="65f56305a27d47d7065711d1131c6ac1611fabcb55b129c27ed6beabe4b94fe0",
when="@2.6:",
reverse=True,
)
# https://github.com/pytorch/pytorch/issues/90448
patch(
"https://github.com/pytorch/pytorch/pull/97270.patch?full_index=1",
@ -343,6 +358,9 @@ class PyTorch(PythonPackage, CudaPackage, ROCmPackage):
# https://github.com/pytorch/pytorch/pull/35607
# https://github.com/pytorch/pytorch/pull/37865
patch("xnnpack.patch", when="@1.5")
# https://github.com/pytorch/pytorch/issues/141083
# https://github.com/google/XNNPACK/commit/5f23827e66cca435fa400b6e221892ac95af0079
patch("xnnpack2.patch", when="@2.6", working_dir="third_party/XNNPACK")
# Fixes build error when ROCm is enabled for pytorch-1.5 release
patch("rocm.patch", when="@1.5+rocm")
@ -672,6 +690,7 @@ def enable_or_disable(variant, keyword="USE", var=None):
env.set("USE_SYSTEM_FXDIV", "ON")
env.set("USE_SYSTEM_GLOO", "ON")
env.set("USE_SYSTEM_NCCL", "ON")
env.set("USE_SYSTEM_NVTX", "ON")
# https://github.com/pytorch/pytorch/issues/60331
# env.set("USE_SYSTEM_ONNX", "ON")
env.set("USE_SYSTEM_PSIMD", "ON")

View File

@ -0,0 +1,34 @@
diff --git a/src/reference/unary-elementwise.cc b/src/reference/unary-elementwise.cc
index bd95ded6c..da892d8be 100644
--- a/src/reference/unary-elementwise.cc
+++ b/src/reference/unary-elementwise.cc
@@ -127,6 +127,16 @@ struct ConvertOp {
}
};
+#ifdef XNN_HAVE_FLOAT16
+template <>
+struct ConvertOp<xnn_bfloat16, _Float16> {
+ explicit ConvertOp(const xnn_unary_uparams*) {}
+ _Float16 operator()(xnn_bfloat16 x) const {
+ return static_cast<_Float16>(static_cast<float>(x));
+ }
+};
+#endif
+
template <typename TIn, typename TOut>
const xnn_unary_elementwise_config* get_convert_config(
std::true_type /*input_quantized*/, std::true_type /*output_quantized*/) {
diff --git a/src/xnnpack/simd/s16-neon.h b/src/xnnpack/simd/s16-neon.h
index 4e8ebcfbd..e8392f4e9 100644
--- a/src/xnnpack/simd/s16-neon.h
+++ b/src/xnnpack/simd/s16-neon.h
@@ -70,7 +70,7 @@ static XNN_INLINE void xnn_store_tail_s16(int16_t* output, xnn_simd_s16_t v,
v_low = vget_high_s16(v);
}
if (num_elements & 2) {
- vst1_lane_s32((void*) output, vreinterpret_s32_s16(v_low), 0);
+ vst1_lane_s32((int32_t*) output, vreinterpret_s32_s16(v_low), 0);
output += 2;
v_low = vext_s16(v_low, v_low, 2);
}

View File

@ -17,6 +17,7 @@ class PyTorchaudio(PythonPackage):
maintainers("adamjstewart")
version("main", branch="main")
version("2.6.0", tag="v2.6.0", commit="d8831425203385077a03c1d92cfbbe3bf2106008")
version("2.5.1", tag="v2.5.1", commit="1661daf10599ca8889f092ec37814fabbe202bb0")
version("2.5.0", tag="v2.5.0", commit="56bc006d56a0d4960de6a1e0b6340cba4eda05cd")
version("2.4.1", tag="v2.4.1", commit="e8cbe17769796ce963fbc71b8990f1474774e6d2")
@ -66,7 +67,8 @@ class PyTorchaudio(PythonPackage):
with default_args(type=("build", "link", "run")):
# Based on PyPI wheel availability
depends_on("python@3.9:3.12", when="@2.5:")
depends_on("python@3.9:3.13", when="@2.6:")
depends_on("python@3.9:3.12", when="@2.5")
depends_on("python@3.8:3.12", when="@2.2:2.4")
depends_on("python@3.8:3.11", when="@2.0:2.1")
depends_on("python@:3.10", when="@0.12:0")
@ -74,6 +76,7 @@ class PyTorchaudio(PythonPackage):
depends_on("python@:3.8", when="@:0.7.0")
depends_on("py-torch@main", when="@main")
depends_on("py-torch@2.6.0", when="@2.6.0")
depends_on("py-torch@2.5.1", when="@2.5.1")
depends_on("py-torch@2.5.0", when="@2.5.0")
depends_on("py-torch@2.4.1", when="@2.4.1")
@ -126,7 +129,7 @@ class PyTorchaudio(PythonPackage):
patch(
"https://github.com/pytorch/audio/pull/3811.patch?full_index=1",
sha256="34dce3403abb03f62827e8a1efcdb2bf7742477a01f155ebb9c7fefe9588b132",
when="@2.2:",
when="@2.2:2.5",
)
conflicts("^cuda@12.5:", when="@:2.1")

View File

@ -18,6 +18,7 @@ class PyTorchvision(PythonPackage):
license("BSD-3-Clause")
version("main", branch="main")
version("0.21.0", sha256="0a4a967bbb7f9810f792cd0289a07fb98c8fb5d1303fae8b63e3a6b05d720058")
version("0.20.1", sha256="7e08c7f56e2c89859310e53d898f72bccc4987cd83e08cfd6303513da15a9e71")
version("0.20.0", sha256="b59d9896c5c957c6db0018754bbd17d079c5102b82b9be0b438553b40a7b6029")
version("0.19.1", sha256="083e75c467285595ec3eb3c7aa8493c19e53d7eb42f13046fb56a07c8897e5a8")
@ -85,8 +86,6 @@ class PyTorchvision(PythonPackage):
variant("png", default=True, description=desc.format("PNG"))
variant("jpeg", default=True, description=desc.format("JPEG"))
variant("webp", default=False, description=desc.format("WEBP"), when="@0.20:")
variant("heic", default=False, description=desc.format("HEIC"), when="@0.20:")
variant("avif", default=False, description=desc.format("AVIF"), when="@0.20:")
variant("nvjpeg", default=False, description=desc.format("NVJPEG"))
variant("video_codec", default=False, description=desc.format("video_codec"))
variant("ffmpeg", default=False, description=desc.format("FFMPEG"))
@ -97,8 +96,8 @@ class PyTorchvision(PythonPackage):
with default_args(type=("build", "link", "run")):
# Based on PyPI wheel availability
depends_on("python@3.9:3.13", when="@0.20:")
depends_on("python@3.8:3.12", when="@0.17:0.19")
depends_on("python@3.9:3.13", when="@0.21:")
depends_on("python@3.8:3.12", when="@0.17:0.20")
depends_on("python@3.8:3.11", when="@0.15:0.16")
depends_on("python@:3.10", when="@0.12:0.14")
depends_on("python@:3.9", when="@0.8.2:0.11")
@ -106,6 +105,7 @@ class PyTorchvision(PythonPackage):
# https://github.com/pytorch/vision#installation
depends_on("py-torch@main", when="@main")
depends_on("py-torch@2.6.0", when="@0.21.0")
depends_on("py-torch@2.5.1", when="@0.20.1")
depends_on("py-torch@2.5.0", when="@0.20.0")
depends_on("py-torch@2.4.1", when="@0.19.1")
@ -156,8 +156,6 @@ class PyTorchvision(PythonPackage):
depends_on("libpng@1.6:", when="+png")
depends_on("jpeg", when="+jpeg")
depends_on("libwebp", when="+webp")
depends_on("libheif", when="+heic")
depends_on("libavif", when="+avif")
depends_on("cuda", when="+nvjpeg")
depends_on("cuda", when="+video_codec")
depends_on("ffmpeg@3.1:", when="+ffmpeg")
@ -214,7 +212,7 @@ def setup_build_environment(self, env):
for gpu in ["cuda", "mps"]:
env.set(f"FORCE_{gpu.upper()}", int(f"+{gpu}" in self.spec["py-torch"]))
extensions = ["png", "jpeg", "webp", "heic", "avif", "nvjpeg", "video_codec", "ffmpeg"]
extensions = ["png", "jpeg", "webp", "nvjpeg", "video_codec", "ffmpeg"]
for extension in extensions:
env.set(f"TORCHVISION_USE_{extension.upper()}", int(f"+{extension}" in self.spec))