Skip to content
Draft
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
8 changes: 4 additions & 4 deletions .github/workflows/conda-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,31 +70,31 @@ jobs:
DOCKER_IMAGE: quay.io/condaforge/linux-anvil-x86_64:alma9
tools_install_dir: ~/miniforge3
build_workspace_dir: build_artifacts
- CONFIG: linux_aarch64_c_compiler_version13c_stdlib_version2.17channel_targetsconda-forge_maincuda_compiler_version12.9cxx_compiler_version13is_rcFalse
- CONFIG: linux_aarch64_arm_variant_typesbsac_compiler_version13c_stdlib_version2.17channel_targetsconda-forge_maincuda_compiler_version12.9cxx_compiler_version13is_rcFalse
STORE_BUILD_ARTIFACTS: False
UPLOAD_PACKAGES: True
os: ubuntu
runs_on: ['namespace-profile-16cpu-on-linux-64']
DOCKER_IMAGE: quay.io/condaforge/linux-anvil-x86_64:alma9
tools_install_dir: ~/miniforge3
build_workspace_dir: build_artifacts
- CONFIG: linux_aarch64_c_compiler_version13c_stdlib_version2.17channel_targetsconda-forge_maincuda_compiler_versionNonecxx_compiler_version13is_rcFalse
- CONFIG: linux_aarch64_arm_variant_typesbsac_compiler_version13c_stdlib_version2.17channel_targetsconda-forge_maincuda_compiler_versionNonecxx_compiler_version13is_rcFalse
STORE_BUILD_ARTIFACTS: False
UPLOAD_PACKAGES: True
os: ubuntu
runs_on: ['namespace-profile-16cpu-on-linux-64']
DOCKER_IMAGE: quay.io/condaforge/linux-anvil-x86_64:alma9
tools_install_dir: ~/miniforge3
build_workspace_dir: build_artifacts
- CONFIG: linux_aarch64_c_compiler_version13c_stdlib_version2.28channel_targetsconda-forge_maincuda_compiler_version13.0cxx_compiler_version13is_rcFalse
- CONFIG: linux_aarch64_arm_variant_typesbsac_compiler_version13c_stdlib_version2.28channel_targetsconda-forge_maincuda_compiler_version13.0cxx_compiler_version13is_rcFalse
STORE_BUILD_ARTIFACTS: False
UPLOAD_PACKAGES: True
os: ubuntu
runs_on: ['namespace-profile-16cpu-on-linux-64']
DOCKER_IMAGE: quay.io/condaforge/linux-anvil-x86_64:alma9
tools_install_dir: ~/miniforge3
build_workspace_dir: build_artifacts
- CONFIG: linux_aarch64_c_compiler_version14c_stdlib_version2.34channel_targetsconda-forge_maincuda_compiler_version12.9cxx_compiler_version14is_rcFalse
- CONFIG: linux_aarch64_arm_variant_typetegrac_compiler_version14c_stdlib_version2.34channel_targetsconda-forge_maincuda_compiler_version12.9cxx_compiler_version14is_rcFalse
STORE_BUILD_ARTIFACTS: False
UPLOAD_PACKAGES: True
os: ubuntu
Expand Down
5 changes: 5 additions & 0 deletions recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ export PACKAGE_TYPE=conda
# remove pyproject.toml to avoid installing deps from pip
rm -rf pyproject.toml

# remove runtime pin for setuptools, upstream added it to workaround
# breakage from transitive dependencies using pkg_resources. we can handle
# these dependencies directly in conda-forge.
sed -i -e '/setuptools<82/d' setup.py

# uncomment to debug cmake build
# export CMAKE_VERBOSE_MAKEFILE=1

Expand Down
54 changes: 35 additions & 19 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# if you wish to build release candidate number X, append the version string with ".rcX"
{% set version = "2.10.0" %}
{% set build = 4 %}
# if you wish to build release candidate number X, append the version string with "-rcX"
{% set version = "2.11.0" %}
{% set build = 0 %}

# Use a higher build number for the CUDA variant, to ensure that it's
# preferred by conda's solver, and it's preferentially
Expand All @@ -25,11 +25,11 @@ package:
source:
{% if "rc" in version %}
- url: https://download.pytorch.org/source_code/test/pytorch-v{{ version }}.tar.gz
sha256: f35b2d7839b284410e5be9ec2eeb7a3049e09c1b8f6a871d3f2cad495d93dcd6
sha256: 3035931fff5b79e0300db69b0249e0c9c7ea5b394f451cb80e0280cbc2affcc2
{% else %}
# The "pytorch-v" tarballs contain submodules; the "pytorch-" ones don't.
- url: https://github.com/pytorch/pytorch/releases/download/v{{ version }}/pytorch-v{{ version }}.tar.gz
sha256: fa8ccbe87f83f48735505371c1c313b4aa6db400b0ae4f8a02844d1e150c695f
sha256: ab3fde9e7e382f45ac942be6ea2c2ef362c5ccd6f55ed6d5f35e6ea81d3ab88e
{% endif %}
patches:
- patches/0001-Force-usage-of-python-3-and-error-without-numpy.patch
Expand All @@ -50,12 +50,11 @@ source:
# backport https://github.com/pytorch/pytorch/pull/166824
- patches/0011-Add-USE_SYSTEM-options-for-KLEIDI-CUDNN_FRONTEND-CUT.patch
- patches/0012-Fix-building-kineto-against-system-fmt.patch
# backport https://github.com/pytorch/pytorch/pull/159828
- patches/0013-Attempt-to-fix-torch.backends.cudnn.rnn-import.patch
- patches/0014-Use-Intel-LLVM-openmp.patch
# backport https://github.com/pytorch/pytorch/pull/174647
- patches/0015-Fix-ICE-in-GCC-14-with-arm.patch
- patches/0016-for-win-CUDA-remove-USE_CUDA-guard-for-skip-in-compi.patch # [cuda_compiler_version != "None"]
# backport https://github.com/pytorch/pytorch/pull/175283
- patches/0017-Ensure-test_tensorinv-uses-well-conditioned-inputs-1.patch
- patches/0018-Declare-_tryToInferTypeImpl-with-TORCH_PYTHON_API.patch
- patches_submodules/tensorpipe/0001-switch-away-from-find_package-CUDA.patch

build:
Expand Down Expand Up @@ -132,13 +131,14 @@ requirements:
- libcusparse-dev
- libmagma-devel
- nccl # [linux]
- nccl <2.29 # [linux and cuda_compiler_version=="12.9" and arm_variant_type!="tegra"]
- nvtx-c
{% endif %}
# other requirements
- python 3.12
- numpy *
- pip
- setuptools
- setuptools <82
- pyyaml
- requests
- six
Expand Down Expand Up @@ -278,13 +278,14 @@ outputs:
- libcusparse-dev
- libmagma-devel
- nccl # [linux]
- nccl <2.29 # [linux and cuda_compiler_version=="12.9" and arm_variant_type!="tegra"]
- nvtx-c
{% endif %}
# other requirements
- python
- numpy
- pip
- setuptools
- setuptools <82
- pyyaml
- requests
- six
Expand Down Expand Up @@ -325,11 +326,9 @@ outputs:
- pybind11
# https://github.com/pytorch/pytorch/pull/175115
- pybind11 <3.0.2
- setuptools
- setuptools <82
- sympy >=1.13.3
- typing_extensions >=4.10.0
# see https://github.com/conda-forge/sympy-feedstock/issues/67
- mpmath <1.4
run_constrained:
# https://github.com/conda-forge/pytorch-cpu-feedstock/issues/65
- pytorch-cpu {{ version }} # [cuda_compiler_version == "None"]
Expand Down Expand Up @@ -517,6 +516,23 @@ outputs:
{% set skips = skips ~ " or test_qengine" %} # [osx and arm64]
# flaky failure on osx
{% set skips = skips ~ " or test_LayerNorm_numeric_mps" %} # [osx and arm64]
# precision errors
{% set skips = skips ~ " or test_forward_nn_Linear" %} # [osx and arm64]
{% set skips = skips ~ " or test_forward_nn_TransformerEncoderLayer_train_mode_mps_float16" %} # [osx and arm64]
{% set skips = skips ~ " or test_non_contiguous_tensors_nn_GRUCell_mps" %} # [osx and arm64]
{% set skips = skips ~ " or test_non_contiguous_tensors_nn_GRU_eval_mode_mps" %} # [osx and arm64]
{% set skips = skips ~ " or test_non_contiguous_tensors_nn_GRU_train_mode_mps" %} # [osx and arm64]
{% set skips = skips ~ " or test_non_contiguous_tensors_nn_LSTMCell_mps" %} # [osx and arm64]
{% set skips = skips ~ " or test_non_contiguous_tensors_nn_Linear_mps" %} # [osx and arm64]
{% set skips = skips ~ " or test_non_contiguous_tensors_nn_MultiheadAttention_eval_mode_mps_float16" %} # [osx and arm64]
{% set skips = skips ~ " or test_non_contiguous_tensors_nn_MultiheadAttention_train_mode_mps_float16" %} # [osx and arm64]
{% set skips = skips ~ " or test_non_contiguous_tensors_nn_RNNCell_mps" %} # [osx and arm64]
{% set skips = skips ~ " or test_non_contiguous_tensors_nn_RNN_eval_mode_mps" %} # [osx and arm64]
{% set skips = skips ~ " or test_non_contiguous_tensors_nn_RNN_train_mode_mps" %} # [osx and arm64]
{% set skips = skips ~ " or test_transformerencoderlayer_mps_float32" %} # [osx and arm64]
{% set skips = skips ~ " or test_transformerencoderlayer_gelu_mps_float32" %} # [osx and arm64]
{% set skips = skips ~ " or test_grad_nn_MultiheadAttention_eval_mode_cpu_float64" %} # [osx and arm64]
{% set skips = skips ~ " or test_non_contiguous_tensors_nn_CrossEntropyLoss_mps_float32" %} # [osx and arm64]
# some warning-related failure, maybe it's broken by --disable-warnings?
{% set skips = skips ~ " or test_cpp_warnings_have_python_context_cpu" %}
{% set skips = skips ~ " or test_cpp_warnings_have_python_context_cuda" %}
Expand All @@ -533,15 +549,15 @@ outputs:
# disable hypothesis because it randomly yields health check errors

# the opengpu server has a card with sm_70, an architecture dropped by CUDA 13.0
{% if (cuda_compiler_version or "0").split(".")[0]|int < 13 %}
- pytest {{ jobs }} {{ tests }} -k "not ({{ skips }})" -m "not hypothesis" --durations=50 --timeout=1200 --disable-warnings # [not aarch64 or py==312]
{% endif %}
- set ONEDNN_VERBOSE=all # [win]
- export ONEDNN_VERBOSE=all # [unix]
- pytest -v {{ jobs }} {{ tests }} -k "not ({{ skips }})" -m "not hypothesis" --durations=50 --timeout=1200 --disable-warnings --force-short-summary # [not aarch64 or py==312]

# regression test for https://github.com/conda-forge/pytorch-cpu-feedstock/issues/329, where we picked up
# duplicate `.pyc` files due to newest py-ver (3.13) in the build environment not matching the one in host;
# obviously this test can only be done for other python versions.
- test ! -f $SP_DIR/functorch/__pycache__/__init__.cpython-313.pyc # [py!=313 and unix]
- if exist %SP_DIR%\functorch\__pycache__\__init__.cpython-313.pyc exit 1 # [py!=313 and win]
- test ! -f $SP_DIR/functorch/__pycache__/__init__.cpython-314.pyc # [py!=314 and unix]
- if exist %SP_DIR%\functorch\__pycache__\__init__.cpython-314.pyc exit 1 # [py!=314 and win]

# test integrity of CMake metadata and ensure that THPLayoutType is visible as a symbol from libtorch_python
- cd cmake_test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 44659d96e67c15c4b626ae98046898f0de47d93b Mon Sep 17 00:00:00 2001
From 97ef248e4150e8cace5f21c8f8fa9eb87f768ff0 Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <h.vetinari@gmx.com>
Date: Thu, 23 Jan 2025 22:58:14 +1100
Subject: [PATCH 05/16] use our own PREFIX for include paths etc.
Subject: [PATCH 05/13] use our own PREFIX for include paths etc.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Expand Down Expand Up @@ -33,39 +33,40 @@ Co-Authored-By: Daniel Petry <dpetry@anaconda.com>
Co-Authored-By: Michał Górny <mgorny@quansight.com>
Co-Authored-By: Tobias Fischer <info@tobiasfischer.info>
---
cmake/TorchConfig.cmake.in | 7 ++++---
cmake/TorchConfig.cmake.in | 13 ++++++++++---
torch/_inductor/cpp_builder.py | 4 +++-
torch/utils/cpp_extension.py | 34 ++++++++++++++++++++--------------
3 files changed, 27 insertions(+), 18 deletions(-)
3 files changed, 33 insertions(+), 18 deletions(-)

diff --git a/cmake/TorchConfig.cmake.in b/cmake/TorchConfig.cmake.in
index 0b32ffa99ce..dcce7b38015 100644
index abf5c814911..475dc3b88ce 100644
--- a/cmake/TorchConfig.cmake.in
+++ b/cmake/TorchConfig.cmake.in
@@ -53,14 +53,15 @@ else()
@@ -53,9 +53,16 @@ else()
endif()

# Include directories.
-if(EXISTS "${TORCH_INSTALL_PREFIX}/include")
-set(TORCH_INCLUDE_DIRS
- ${TORCH_INSTALL_PREFIX}/include
- ${TORCH_INSTALL_PREFIX}/include/torch/csrc/api/include)
+if(EXISTS "${TORCH_INSTALL_PREFIX}/include/torch/csrc/api/include")
+ # top-level include directory
set(TORCH_INCLUDE_DIRS
- ${TORCH_INSTALL_PREFIX}/include
${TORCH_INSTALL_PREFIX}/include/torch/csrc/api/include)
else()
+ set(TORCH_INCLUDE_DIRS
+ ${TORCH_INSTALL_PREFIX}/include/torch/csrc/api/include)
+else()
+ # site-packages include directory
set(TORCH_INCLUDE_DIRS
${TORCH_INSTALL_PREFIX}/include
- ${TORCH_INSTALL_PREFIX}/include/torch/csrc/api/include)
+ set(TORCH_INCLUDE_DIRS
+ ${TORCH_INSTALL_PREFIX}/include
+ ${TORCH_INSTALL_PREFIX}/../../../../include/torch/csrc/api/include)
endif()
+endif()

# Library dependencies.
if(@BUILD_SHARED_LIBS@)
diff --git a/torch/_inductor/cpp_builder.py b/torch/_inductor/cpp_builder.py
index 6a6b7d15ae3..0a4724e5c17 100644
index 6dd6e0d2b5c..fbfa3175836 100644
--- a/torch/_inductor/cpp_builder.py
+++ b/torch/_inductor/cpp_builder.py
@@ -1520,10 +1520,12 @@ def get_cpp_torch_options(
@@ -1522,10 +1522,12 @@ def get_cpp_torch_options(
+ python_include_dirs
+ torch_include_dirs
+ omp_include_dir_paths
Expand All @@ -80,10 +81,10 @@ index 6a6b7d15ae3..0a4724e5c17 100644
passthrough_args = (
sys_libs_passthrough_args + isa_ps_args_build_flags + omp_passthrough_args
diff --git a/torch/utils/cpp_extension.py b/torch/utils/cpp_extension.py
index f29c382f0e3..d865df1684b 100644
index a63bff50d5e..7da14c2429c 100644
--- a/torch/utils/cpp_extension.py
+++ b/torch/utils/cpp_extension.py
@@ -1567,31 +1567,37 @@ def include_paths(device_type: str = "cpu", torch_include_dirs=True) -> list[str
@@ -1604,31 +1604,37 @@ def include_paths(device_type: str = "cpu", torch_include_dirs=True) -> list[str
Returns:
A list of include path strings.
"""
Expand Down

This file was deleted.

Loading
Loading