From 2182f8145d0cd1737f5a365a74ee7a3aedcdb017 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Fri, 31 Jan 2025 07:29:47 +1100 Subject: [PATCH 01/12] restrict where we run test_torchinductor tests --- recipe/meta.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index e8c57a42d..849b36b29 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -450,7 +450,9 @@ outputs: "test/test_nn.py", "test/test_torch.py", "test/test_xnnpack_integration.py", - ] + (cuda_compiler_version != "None") * ["test/inductor/test_torchinductor.py"]) %} + ]) %} + # test_torchinductor adds >4h in test runtime in emulation; not supported yet for 3.13 + {% set tests = tests ~ " test/inductor/test_torchinductor.py" %} # [py<313 and not aarch64] {% set skips = "(TestTorch and test_print)" %} # tolerance violation with openblas From 7c4fed7ccac5f221d91e49ae532f9a8ac48ea394 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Fri, 31 Jan 2025 07:35:54 +1100 Subject: [PATCH 02/12] temporary: skip CPU build --- recipe/meta.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 849b36b29..6d199f4d6 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -76,6 +76,8 @@ build: number: {{ build }} # cuda 11.8 was dropped due to maintenance effort, see discussion in #177 skip: true # [cuda_compiler_version == "11.8"] + # temporary skip to avoid wasting resources while unbreak CUDA builds + skip: true # [cuda_compiler_version == "None"] # This logic allows two rc variants to be defined in the conda_build_config, but only one to actually be built. # We want to be able to define two variants in the cbc so we can assign different labels to each in the upload channel # (by zipping is_rc with channel_targets). This prevents rc builds being used unless specifically requested. From ef1444368302254a012920a823dcfb00de9c0778 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Fri, 31 Jan 2025 10:34:54 +1100 Subject: [PATCH 03/12] skip two more failing tests --- recipe/meta.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 6d199f4d6..401437005 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -484,8 +484,12 @@ outputs: {% set skips = skips ~ " or test_ctc_loss_cudnn_tensor_cuda " %} # [unix and cuda_compiler_version != "None"] {% set skips = skips ~ " or (TestTorch and test_index_add_correctness)" %} # [unix and cuda_compiler_version != "None"] # These tests require higher-resource or more recent GPUs than the CI provides - {% set skips = skips ~ " or (TritonCodeGenTests and test_sdpa_inference_mode_aot_compile)" %} # [unix and cuda_compiler_version != "None"] - {% set skips = skips ~ " or (TestNN and test_grid_sample)" %} # [unix and cuda_compiler_version != "None"] + {% set skips = skips ~ " or test_sdpa_inference_mode_aot_compile" %} # [linux and cuda_compiler_version != "None"] + {% set skips = skips ~ " or (TestNN and test_grid_sample)" %} # [linux and cuda_compiler_version != "None"] + # don't mess with tests that rely on GPU failure handling + {% set skips = skips ~ " or test_indirect_device_assert" %} # [linux and cuda_compiler_version != "None"] + # test that fails to find temporary resource + {% set skips = skips ~ " or (GPUTests and test_scatter_reduce2)" %} # [linux and cuda_compiler_version != "None"] # MKL problems {% set skips = skips ~ " or (TestLinalgCPU and test_inverse_errors_large_cpu)" %} # [unix and blas_impl == "mkl" and cuda_compiler_version != "None"] # these tests are failing with low -n values From cb26d9c166da5f660bc94ac46e0d89b0d3ec155a Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Thu, 30 Jan 2025 13:17:32 +1100 Subject: [PATCH 04/12] Revert "skip test failures with CUDA due to non-unique temporaries" This reverts commit 53ab2c8cfc99ea8fc0bdec628a6910b663ba0f90. --- recipe/meta.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 401437005..7f301d50e 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -476,9 +476,6 @@ outputs: # may crash spuriously {% set skips = skips ~ " or (TestAutograd and test_profiler_seq_nr)" %} {% set skips = skips ~ " or (TestAutograd and test_profiler_propagation)" %} - # tests that fail due to resource clean-up issues (non-unique temporary libraries), see - # https://github.com/conda-forge/pytorch-cpu-feedstock/pull/318#issuecomment-2620080859 - {% set skips = skips ~ " or test_mutable_custom_op_fixed_layout" %} # [cuda_compiler_version != "None"] # trivial accuracy problems {% set skips = skips ~ " or test_BCELoss_weights_no_reduce_cuda" %} # [unix and cuda_compiler_version != "None"] {% set skips = skips ~ " or test_ctc_loss_cudnn_tensor_cuda " %} # [unix and cuda_compiler_version != "None"] From cf50bea1f728486238dd5db210bdb1d2d2afced1 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Thu, 30 Jan 2025 13:25:56 +1100 Subject: [PATCH 05/12] make temporary library names unique in failing tests --- recipe/meta.yaml | 1 + ...-of-python-3-and-error-without-numpy.patch | 2 +- recipe/patches/0002-Help-find-numpy.patch | 2 +- ...03-Add-USE_SYSTEM_NVTX-option-138287.patch | 2 +- .../patches/0004-Update-sympy-version.patch | 2 +- .../0005-Fix-duplicate-linker-script.patch | 2 +- ...kle-error-in-serialization.py-136034.patch | 2 +- ...verwrite-ld-with-environment-variabl.patch | 2 +- ...-Allow-overriding-CUDA-related-paths.patch | 2 +- ...st-test_linalg.py-for-NumPy-2-136800.patch | 2 +- ...est-failures-in-test_torch.py-137740.patch | 2 +- ...AS_USE_CBLAS_DOT-for-OpenBLAS-builds.patch | 2 +- recipe/patches/0012-fix-issue-142484.patch | 2 +- recipe/patches/0013-Fix-FindOpenBLAS.patch | 2 +- ...Enable-Python-3.13-on-windows-138095.patch | 2 +- ...tils.cpp_extension.include_paths-use.patch | 2 +- ...oint-include-paths-to-PREFIX-include.patch | 2 +- ...nda-prefix-to-inductor-include-paths.patch | 2 +- ...E_DIR-relative-to-TORCH_INSTALL_PREF.patch | 2 +- ...ON-lib-from-CMake-install-TARGETS-di.patch | 2 +- ...e-in-test_mutable_custom_op_fixed_la.patch | 35 +++++++++++++++++++ 21 files changed, 55 insertions(+), 19 deletions(-) create mode 100644 recipe/patches/0020-make-library-name-in-test_mutable_custom_op_fixed_la.patch diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 7f301d50e..947e66d94 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -70,6 +70,7 @@ source: - patches/0017-Add-conda-prefix-to-inductor-include-paths.patch - patches/0018-make-ATEN_INCLUDE_DIR-relative-to-TORCH_INSTALL_PREF.patch - patches/0019-remove-DESTINATION-lib-from-CMake-install-TARGETS-di.patch # [win] + - patches/0020-make-library-name-in-test_mutable_custom_op_fixed_la.patch - patches_submodules/0001-remove-DESTINATION-lib-from-CMake-install-directives.patch # [win] build: diff --git a/recipe/patches/0001-Force-usage-of-python-3-and-error-without-numpy.patch b/recipe/patches/0001-Force-usage-of-python-3-and-error-without-numpy.patch index 7c03260ab..b5519b816 100644 --- a/recipe/patches/0001-Force-usage-of-python-3-and-error-without-numpy.patch +++ b/recipe/patches/0001-Force-usage-of-python-3-and-error-without-numpy.patch @@ -1,7 +1,7 @@ From f3a0f9aab6dce56eea590b946f60256014b61bf7 Mon Sep 17 00:00:00 2001 From: Mark Harfouche Date: Sun, 1 Sep 2024 17:35:40 -0400 -Subject: [PATCH 01/19] Force usage of python 3 and error without numpy +Subject: [PATCH 01/20] Force usage of python 3 and error without numpy --- cmake/Dependencies.cmake | 6 +++--- diff --git a/recipe/patches/0002-Help-find-numpy.patch b/recipe/patches/0002-Help-find-numpy.patch index 694d04758..833af9f1d 100644 --- a/recipe/patches/0002-Help-find-numpy.patch +++ b/recipe/patches/0002-Help-find-numpy.patch @@ -1,7 +1,7 @@ From 21c30036b5b86f403c0cf4426165d9a6a50edb1a Mon Sep 17 00:00:00 2001 From: Mark Harfouche Date: Tue, 1 Oct 2024 00:28:40 -0400 -Subject: [PATCH 02/19] Help find numpy +Subject: [PATCH 02/20] Help find numpy --- tools/setup_helpers/cmake.py | 6 ++++++ diff --git a/recipe/patches/0003-Add-USE_SYSTEM_NVTX-option-138287.patch b/recipe/patches/0003-Add-USE_SYSTEM_NVTX-option-138287.patch index 92a497dbb..a4c44e015 100644 --- a/recipe/patches/0003-Add-USE_SYSTEM_NVTX-option-138287.patch +++ b/recipe/patches/0003-Add-USE_SYSTEM_NVTX-option-138287.patch @@ -1,7 +1,7 @@ From d1826af525db41eda5020a1404f5d5521d67a5dc Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Sat, 19 Oct 2024 04:26:01 +0000 -Subject: [PATCH 03/19] Add USE_SYSTEM_NVTX option (#138287) +Subject: [PATCH 03/20] Add USE_SYSTEM_NVTX option (#138287) ## Summary diff --git a/recipe/patches/0004-Update-sympy-version.patch b/recipe/patches/0004-Update-sympy-version.patch index 92340dba8..81a66b3f5 100644 --- a/recipe/patches/0004-Update-sympy-version.patch +++ b/recipe/patches/0004-Update-sympy-version.patch @@ -1,7 +1,7 @@ From e3219c5fe8834753b0cf9e92be4d1ef1e874f370 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Thu, 17 Oct 2024 15:04:05 -0700 -Subject: [PATCH 04/19] Update sympy version +Subject: [PATCH 04/20] Update sympy version --- setup.py | 2 +- diff --git a/recipe/patches/0005-Fix-duplicate-linker-script.patch b/recipe/patches/0005-Fix-duplicate-linker-script.patch index 1d2e52e7e..cb09dcdfb 100644 --- a/recipe/patches/0005-Fix-duplicate-linker-script.patch +++ b/recipe/patches/0005-Fix-duplicate-linker-script.patch @@ -1,7 +1,7 @@ From 08a1f44fbc81324aa98d720dfb7b87a261923ac2 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Sun, 3 Nov 2024 01:12:36 -0700 -Subject: [PATCH 05/19] Fix duplicate linker script +Subject: [PATCH 05/20] Fix duplicate linker script --- setup.py | 4 +++- diff --git a/recipe/patches/0006-fix-3.13-pickle-error-in-serialization.py-136034.patch b/recipe/patches/0006-fix-3.13-pickle-error-in-serialization.py-136034.patch index 5d0c8ccf6..326e6285f 100644 --- a/recipe/patches/0006-fix-3.13-pickle-error-in-serialization.py-136034.patch +++ b/recipe/patches/0006-fix-3.13-pickle-error-in-serialization.py-136034.patch @@ -1,7 +1,7 @@ From 15df314a41c69a31c0443254d5552aa1b39d708d Mon Sep 17 00:00:00 2001 From: William Wen Date: Fri, 13 Sep 2024 13:02:33 -0700 -Subject: [PATCH 06/19] fix 3.13 pickle error in serialization.py (#136034) +Subject: [PATCH 06/20] fix 3.13 pickle error in serialization.py (#136034) Error encountered when adding dynamo 3.13 support. Pull Request resolved: https://github.com/pytorch/pytorch/pull/136034 diff --git a/recipe/patches/0007-Allow-users-to-overwrite-ld-with-environment-variabl.patch b/recipe/patches/0007-Allow-users-to-overwrite-ld-with-environment-variabl.patch index e6dcc5afe..ad215aa93 100644 --- a/recipe/patches/0007-Allow-users-to-overwrite-ld-with-environment-variabl.patch +++ b/recipe/patches/0007-Allow-users-to-overwrite-ld-with-environment-variabl.patch @@ -1,7 +1,7 @@ From 655f694854c3eafdd631235b60bc6c1b279218ed Mon Sep 17 00:00:00 2001 From: Mark Harfouche Date: Thu, 3 Oct 2024 22:49:56 -0400 -Subject: [PATCH 07/19] Allow users to overwrite ld with environment variables +Subject: [PATCH 07/20] Allow users to overwrite ld with environment variables This should help in the case of cross compilation. diff --git a/recipe/patches/0008-Allow-overriding-CUDA-related-paths.patch b/recipe/patches/0008-Allow-overriding-CUDA-related-paths.patch index 8c366b3dc..fbfe05607 100644 --- a/recipe/patches/0008-Allow-overriding-CUDA-related-paths.patch +++ b/recipe/patches/0008-Allow-overriding-CUDA-related-paths.patch @@ -1,7 +1,7 @@ From f03bf82d9da9cccb2cf4d4833c1a6349622dc37d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Wed, 27 Nov 2024 13:47:23 +0100 -Subject: [PATCH 08/19] Allow overriding CUDA-related paths +Subject: [PATCH 08/20] Allow overriding CUDA-related paths --- cmake/Modules/FindCUDAToolkit.cmake | 2 +- diff --git a/recipe/patches/0009-Fix-test-test_linalg.py-for-NumPy-2-136800.patch b/recipe/patches/0009-Fix-test-test_linalg.py-for-NumPy-2-136800.patch index 4d11b1b6b..580fe42a0 100644 --- a/recipe/patches/0009-Fix-test-test_linalg.py-for-NumPy-2-136800.patch +++ b/recipe/patches/0009-Fix-test-test_linalg.py-for-NumPy-2-136800.patch @@ -1,7 +1,7 @@ From 4b1faf6ba142953ce2730766db44f8d98d161ef0 Mon Sep 17 00:00:00 2001 From: Haifeng Jin Date: Tue, 1 Oct 2024 07:53:24 +0000 -Subject: [PATCH 09/19] Fix test/test_linalg.py for NumPy 2 (#136800) +Subject: [PATCH 09/20] Fix test/test_linalg.py for NumPy 2 (#136800) Related to #107302. diff --git a/recipe/patches/0010-Fixes-NumPy-2-test-failures-in-test_torch.py-137740.patch b/recipe/patches/0010-Fixes-NumPy-2-test-failures-in-test_torch.py-137740.patch index 9a7572a3c..6495b150c 100644 --- a/recipe/patches/0010-Fixes-NumPy-2-test-failures-in-test_torch.py-137740.patch +++ b/recipe/patches/0010-Fixes-NumPy-2-test-failures-in-test_torch.py-137740.patch @@ -1,7 +1,7 @@ From 032b9be9ca7f9ae174e75554cecc82600ea3ef54 Mon Sep 17 00:00:00 2001 From: Haifeng Jin Date: Sat, 12 Oct 2024 02:40:17 +0000 -Subject: [PATCH 10/19] Fixes NumPy 2 test failures in test_torch.py (#137740) +Subject: [PATCH 10/20] Fixes NumPy 2 test failures in test_torch.py (#137740) Related to #107302 diff --git a/recipe/patches/0011-Use-BLAS_USE_CBLAS_DOT-for-OpenBLAS-builds.patch b/recipe/patches/0011-Use-BLAS_USE_CBLAS_DOT-for-OpenBLAS-builds.patch index 7202c4afd..193ce159b 100644 --- a/recipe/patches/0011-Use-BLAS_USE_CBLAS_DOT-for-OpenBLAS-builds.patch +++ b/recipe/patches/0011-Use-BLAS_USE_CBLAS_DOT-for-OpenBLAS-builds.patch @@ -1,7 +1,7 @@ From 56f1528fa072023fb2724d5abf8790f2f6cc3aaa Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Wed, 18 Dec 2024 03:59:00 +0000 -Subject: [PATCH 11/19] Use BLAS_USE_CBLAS_DOT for OpenBLAS builds +Subject: [PATCH 11/20] Use BLAS_USE_CBLAS_DOT for OpenBLAS builds There are two calling conventions for *dotu functions diff --git a/recipe/patches/0012-fix-issue-142484.patch b/recipe/patches/0012-fix-issue-142484.patch index 675b7545c..00f1e3d22 100644 --- a/recipe/patches/0012-fix-issue-142484.patch +++ b/recipe/patches/0012-fix-issue-142484.patch @@ -1,7 +1,7 @@ From beba58d724cc1bd7ca73660b0a5ad9e61ae0c562 Mon Sep 17 00:00:00 2001 From: "Zheng, Zhaoqiong" Date: Fri, 27 Dec 2024 13:49:36 +0800 -Subject: [PATCH 12/19] fix issue 142484 +Subject: [PATCH 12/20] fix issue 142484 From https://github.com/pytorch/pytorch/pull/143894 --- diff --git a/recipe/patches/0013-Fix-FindOpenBLAS.patch b/recipe/patches/0013-Fix-FindOpenBLAS.patch index ef18af042..f539d0a65 100644 --- a/recipe/patches/0013-Fix-FindOpenBLAS.patch +++ b/recipe/patches/0013-Fix-FindOpenBLAS.patch @@ -1,7 +1,7 @@ From 816a248a4425a97350959e412666e6db9012a52e Mon Sep 17 00:00:00 2001 From: Bas Zalmstra Date: Thu, 16 May 2024 10:46:49 +0200 -Subject: [PATCH 13/19] Fix FindOpenBLAS +Subject: [PATCH 13/20] Fix FindOpenBLAS --- cmake/Modules/FindOpenBLAS.cmake | 15 +++++++++------ diff --git a/recipe/patches/0014-CD-Enable-Python-3.13-on-windows-138095.patch b/recipe/patches/0014-CD-Enable-Python-3.13-on-windows-138095.patch index 3a258d8f5..7a2df88fb 100644 --- a/recipe/patches/0014-CD-Enable-Python-3.13-on-windows-138095.patch +++ b/recipe/patches/0014-CD-Enable-Python-3.13-on-windows-138095.patch @@ -1,7 +1,7 @@ From db896f927403f55a18f931b18a6469cb4e37d322 Mon Sep 17 00:00:00 2001 From: atalman Date: Tue, 12 Nov 2024 12:28:10 +0000 -Subject: [PATCH 14/19] CD Enable Python 3.13 on windows (#138095) +Subject: [PATCH 14/20] CD Enable Python 3.13 on windows (#138095) Adding CD windows. Part of: https://github.com/pytorch/pytorch/issues/130249 Builder PR landed with smoke test: https://github.com/pytorch/builder/pull/2035 diff --git a/recipe/patches/0015-simplify-torch.utils.cpp_extension.include_paths-use.patch b/recipe/patches/0015-simplify-torch.utils.cpp_extension.include_paths-use.patch index 95f926922..3736ca781 100644 --- a/recipe/patches/0015-simplify-torch.utils.cpp_extension.include_paths-use.patch +++ b/recipe/patches/0015-simplify-torch.utils.cpp_extension.include_paths-use.patch @@ -1,7 +1,7 @@ From 33790dfbf966e7d8ea4ff6798d2ff92474d84079 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Thu, 23 Jan 2025 22:46:58 +1100 -Subject: [PATCH 15/19] simplify torch.utils.cpp_extension.include_paths; use +Subject: [PATCH 15/20] simplify torch.utils.cpp_extension.include_paths; use it in cpp_builder The /TH headers have not existed since pytorch 1.11 diff --git a/recipe/patches/0016-point-include-paths-to-PREFIX-include.patch b/recipe/patches/0016-point-include-paths-to-PREFIX-include.patch index 84b211d11..764e24af5 100644 --- a/recipe/patches/0016-point-include-paths-to-PREFIX-include.patch +++ b/recipe/patches/0016-point-include-paths-to-PREFIX-include.patch @@ -1,7 +1,7 @@ From 799f6fa59dac93dabbbcf72d46f4e1334e3d65d9 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Thu, 23 Jan 2025 22:58:14 +1100 -Subject: [PATCH 16/19] point include paths to $PREFIX/include +Subject: [PATCH 16/20] point include paths to $PREFIX/include --- torch/utils/cpp_extension.py | 9 +++++++++ diff --git a/recipe/patches/0017-Add-conda-prefix-to-inductor-include-paths.patch b/recipe/patches/0017-Add-conda-prefix-to-inductor-include-paths.patch index fc36f27f4..e2111c54d 100644 --- a/recipe/patches/0017-Add-conda-prefix-to-inductor-include-paths.patch +++ b/recipe/patches/0017-Add-conda-prefix-to-inductor-include-paths.patch @@ -1,7 +1,7 @@ From 9f73a02bacf9680833ac64657fde6762d33ab200 Mon Sep 17 00:00:00 2001 From: Daniel Petry Date: Tue, 21 Jan 2025 17:45:23 -0600 -Subject: [PATCH 17/19] Add conda prefix to inductor include paths +Subject: [PATCH 17/20] Add conda prefix to inductor include paths Currently inductor doesn't look in conda's includes and libs. This results in errors when it tries to compile, if system versions are being used of diff --git a/recipe/patches/0018-make-ATEN_INCLUDE_DIR-relative-to-TORCH_INSTALL_PREF.patch b/recipe/patches/0018-make-ATEN_INCLUDE_DIR-relative-to-TORCH_INSTALL_PREF.patch index cc7e33dd8..028d79be3 100644 --- a/recipe/patches/0018-make-ATEN_INCLUDE_DIR-relative-to-TORCH_INSTALL_PREF.patch +++ b/recipe/patches/0018-make-ATEN_INCLUDE_DIR-relative-to-TORCH_INSTALL_PREF.patch @@ -1,7 +1,7 @@ From b0cfa0f728e96a3a9d6f7434e2c02d74d6daa9a9 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Tue, 28 Jan 2025 14:15:34 +1100 -Subject: [PATCH 18/19] make ATEN_INCLUDE_DIR relative to TORCH_INSTALL_PREFIX +Subject: [PATCH 18/20] make ATEN_INCLUDE_DIR relative to TORCH_INSTALL_PREFIX we cannot set CMAKE_INSTALL_PREFIX without the pytorch build complaining, but we can use TORCH_INSTALL_PREFIX, which is set correctly relative to our CMake files already: diff --git a/recipe/patches/0019-remove-DESTINATION-lib-from-CMake-install-TARGETS-di.patch b/recipe/patches/0019-remove-DESTINATION-lib-from-CMake-install-TARGETS-di.patch index 4357adb4e..7aa411927 100644 --- a/recipe/patches/0019-remove-DESTINATION-lib-from-CMake-install-TARGETS-di.patch +++ b/recipe/patches/0019-remove-DESTINATION-lib-from-CMake-install-TARGETS-di.patch @@ -1,7 +1,7 @@ From f7db4cbfb0af59027ed8bdcd0387dba6fbcb1192 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Tue, 28 Jan 2025 10:58:29 +1100 -Subject: [PATCH 19/19] remove `DESTINATION lib` from CMake `install(TARGETS` +Subject: [PATCH 19/20] remove `DESTINATION lib` from CMake `install(TARGETS` directives Suggested-By: Silvio Traversaro diff --git a/recipe/patches/0020-make-library-name-in-test_mutable_custom_op_fixed_la.patch b/recipe/patches/0020-make-library-name-in-test_mutable_custom_op_fixed_la.patch new file mode 100644 index 000000000..523d92ccb --- /dev/null +++ b/recipe/patches/0020-make-library-name-in-test_mutable_custom_op_fixed_la.patch @@ -0,0 +1,35 @@ +From 79ee5dcac30f2eba891af961f7649d15dfc6ce63 Mon Sep 17 00:00:00 2001 +From: "H. Vetinari" +Date: Thu, 30 Jan 2025 13:23:14 +1100 +Subject: [PATCH 20/20] make library name in + `test_mutable_custom_op_fixed_layout{,2}` unique + +Suggested-By: Daniel Petry +--- + test/inductor/test_torchinductor.py | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/test/inductor/test_torchinductor.py b/test/inductor/test_torchinductor.py +index 610f5d27332..28f85e228d2 100644 +--- a/test/inductor/test_torchinductor.py ++++ b/test/inductor/test_torchinductor.py +@@ -10628,7 +10628,8 @@ class CommonTemplate: + @requires_gpu() + @config.patch(implicit_fallbacks=True) + def test_mutable_custom_op_fixed_layout2(self): +- with torch.library._scoped_library("mylib", "DEF") as lib: ++ unique_lib_name = f"mylib_{id(self)}" # Make unique name using test instance id ++ with torch.library._scoped_library(unique_lib_name, "DEF") as lib: + mod = nn.Conv2d(3, 128, 1, stride=1, bias=False).to(device=GPU_TYPE) + inp = torch.rand(2, 3, 128, 128, device=GPU_TYPE) + expected_stride = mod(inp).clone().stride() +@@ -10681,7 +10682,8 @@ class CommonTemplate: + + @config.patch(implicit_fallbacks=True) + def test_mutable_custom_op_fixed_layout(self): +- with torch.library._scoped_library("mylib", "DEF") as lib: ++ unique_lib_name = f"mylib_{id(self)}" # Make unique name using test instance id ++ with torch.library._scoped_library(unique_lib_name, "DEF") as lib: + lib.define( + "copy_(Tensor(a!) dst, Tensor src) -> ()", + tags=torch.Tag.needs_fixed_stride_order, From a4a6ef674ad4c640b5596a9c2aa9618187808166 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Thu, 30 Jan 2025 13:32:50 +1100 Subject: [PATCH 06/12] collect USE_* variables in `bld.bat` --- recipe/bld.bat | 48 +++++++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/recipe/bld.bat b/recipe/bld.bat index 5f6f57c68..c9e38bd84 100644 --- a/recipe/bld.bat +++ b/recipe/bld.bat @@ -27,10 +27,6 @@ if "%blas_impl%" == "generic" ( SET BLAS=MKL ) -@REM TODO(baszalmstra): Figure out if we need these flags -SET "USE_NUMA=0" -SET "USE_ITT=0" - if "%PKG_NAME%" == "pytorch" ( set "PIP_ACTION=install" @REM We build libtorch for a specific python version. @@ -64,8 +60,27 @@ if "%PKG_NAME%" == "pytorch" ( set "PIP_ACTION=wheel" ) +set "BUILD_CUSTOM_PROTOBUF=OFF" +set "USE_LITE_PROTO=ON" + +@REM TODO(baszalmstra): Figure out if we need these flags +SET "USE_ITT=0" +SET "USE_NUMA=0" + +@REM TODO(baszalmstra): There are linker errors because of mixing Intel OpenMP (iomp) and Microsoft OpenMP (vcomp) +set "USE_OPENMP=OFF" + +@REM Use our Pybind11, Eigen, sleef +set USE_SYSTEM_EIGEN_INSTALL=1 +set USE_SYSTEM_PYBIND11=1 +set USE_SYSTEM_SLEEF=1 + if not "%cuda_compiler_version%" == "None" ( set USE_CUDA=1 + set USE_STATIC_CUDNN=0 + @REM NCCL is not available on windows + set USE_NCCL=0 + set USE_STATIC_NCCL=0 @REM set CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v%desired_cuda% @REM set CUDA_BIN_PATH=%CUDA_PATH%\bin @@ -74,39 +89,29 @@ if not "%cuda_compiler_version%" == "None" ( set TORCH_NVCC_FLAGS=-Xfatbin -compress-all - set USE_STATIC_CUDNN=0 set MAGMA_HOME=%PREFIX% - @REM NCCL is not available on windows - set USE_NCCL=0 - set USE_STATIC_NCCL=0 - set MAGMA_HOME=%LIBRARY_PREFIX% set "PATH=%CUDA_BIN_PATH%;%PATH%" set CUDNN_INCLUDE_DIR=%LIBRARY_PREFIX%\include - ) else ( set USE_CUDA=0 + @REM MKLDNN is an Apache-2.0 licensed library for DNNs and is used + @REM for CPU builds. Not to be confused with MKL. + set "USE_MKLDNN=1" + @REM On windows, env vars are case-insensitive and setup.py @REM passes all env vars starting with CUDA_*, CMAKE_* to @REM to cmake set "cuda_compiler_version=" set "cuda_compiler=" set "CUDA_VERSION=" - - @REM MKLDNN is an Apache-2.0 licensed library for DNNs and is used - @REM for CPU builds. Not to be confused with MKL. - set "USE_MKLDNN=1" ) set DISTUTILS_USE_SDK=1 -@REM Use our Pybind11, Eigen -set USE_SYSTEM_PYBIND11=1 -set USE_SYSTEM_EIGEN_INSTALL=1 - set CMAKE_INCLUDE_PATH=%LIBRARY_PREFIX%\include set LIB=%LIBRARY_PREFIX%\lib;%LIB% @@ -126,17 +131,10 @@ set "INSTALL_TEST=0" set "BUILD_TEST=0" set "libuv_ROOT=%LIBRARY_PREFIX%" -set "USE_SYSTEM_SLEEF=ON" @REM uncomment to debug cmake build @REM set "CMAKE_VERBOSE_MAKEFILE=1" -set "BUILD_CUSTOM_PROTOBUF=OFF" -set "USE_LITE_PROTO=ON" - -@REM TODO(baszalmstra): There are linker errors because of mixing Intel OpenMP (iomp) and Microsoft OpenMP (vcomp) -set "USE_OPENMP=OFF" - @REM The activation script for cuda-nvcc doesnt add the CUDA_CFLAGS on windows. @REM Therefore we do this manually here. See: @REM https://github.com/conda-forge/cuda-nvcc-feedstock/issues/47 From 061b9c63b8ad6ff599e7b73201b531c263865071 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Thu, 30 Jan 2025 13:33:48 +1100 Subject: [PATCH 07/12] clean up CUDA option handling in `bld.bat` --- recipe/bld.bat | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/recipe/bld.bat b/recipe/bld.bat index c9e38bd84..87fe94e3f 100644 --- a/recipe/bld.bat +++ b/recipe/bld.bat @@ -85,16 +85,11 @@ if not "%cuda_compiler_version%" == "None" ( @REM set CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v%desired_cuda% @REM set CUDA_BIN_PATH=%CUDA_PATH%\bin - set TORCH_CUDA_ARCH_LIST=5.0;6.0;6.1;7.0;7.5;8.0;8.6;8.9;9.0+PTX - - set TORCH_NVCC_FLAGS=-Xfatbin -compress-all - - set MAGMA_HOME=%PREFIX% + set "TORCH_CUDA_ARCH_LIST=5.0;6.0;6.1;7.0;7.5;8.0;8.6;8.9;9.0+PTX" + set "TORCH_NVCC_FLAGS=-Xfatbin -compress-all" set MAGMA_HOME=%LIBRARY_PREFIX% - set "PATH=%CUDA_BIN_PATH%;%PATH%" - set CUDNN_INCLUDE_DIR=%LIBRARY_PREFIX%\include ) else ( set USE_CUDA=0 From 67583a643938d3eb729cddb15671ab6d8e04cbec Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Thu, 30 Jan 2025 13:39:53 +1100 Subject: [PATCH 08/12] first attempt at patching `find_package(CUDA)` --- recipe/meta.yaml | 1 + ...-of-python-3-and-error-without-numpy.patch | 2 +- recipe/patches/0002-Help-find-numpy.patch | 2 +- ...03-Add-USE_SYSTEM_NVTX-option-138287.patch | 2 +- .../patches/0004-Update-sympy-version.patch | 2 +- .../0005-Fix-duplicate-linker-script.patch | 2 +- ...kle-error-in-serialization.py-136034.patch | 2 +- ...verwrite-ld-with-environment-variabl.patch | 2 +- ...-Allow-overriding-CUDA-related-paths.patch | 2 +- ...st-test_linalg.py-for-NumPy-2-136800.patch | 2 +- ...est-failures-in-test_torch.py-137740.patch | 2 +- ...AS_USE_CBLAS_DOT-for-OpenBLAS-builds.patch | 2 +- recipe/patches/0012-fix-issue-142484.patch | 2 +- recipe/patches/0013-Fix-FindOpenBLAS.patch | 2 +- ...Enable-Python-3.13-on-windows-138095.patch | 2 +- ...tils.cpp_extension.include_paths-use.patch | 2 +- ...oint-include-paths-to-PREFIX-include.patch | 2 +- ...nda-prefix-to-inductor-include-paths.patch | 2 +- ...E_DIR-relative-to-TORCH_INSTALL_PREF.patch | 2 +- ...ON-lib-from-CMake-install-TARGETS-di.patch | 2 +- ...e-in-test_mutable_custom_op_fixed_la.patch | 2 +- ...-find_package-CUDA-in-caffe2-CMake-m.patch | 216 ++++++++++++++++++ 22 files changed, 237 insertions(+), 20 deletions(-) create mode 100644 recipe/patches/0021-avoid-deprecated-find_package-CUDA-in-caffe2-CMake-m.patch diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 947e66d94..e34a1e440 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -71,6 +71,7 @@ source: - patches/0018-make-ATEN_INCLUDE_DIR-relative-to-TORCH_INSTALL_PREF.patch - patches/0019-remove-DESTINATION-lib-from-CMake-install-TARGETS-di.patch # [win] - patches/0020-make-library-name-in-test_mutable_custom_op_fixed_la.patch + - patches/0021-avoid-deprecated-find_package-CUDA-in-caffe2-CMake-m.patch - patches_submodules/0001-remove-DESTINATION-lib-from-CMake-install-directives.patch # [win] build: diff --git a/recipe/patches/0001-Force-usage-of-python-3-and-error-without-numpy.patch b/recipe/patches/0001-Force-usage-of-python-3-and-error-without-numpy.patch index b5519b816..fda50bccf 100644 --- a/recipe/patches/0001-Force-usage-of-python-3-and-error-without-numpy.patch +++ b/recipe/patches/0001-Force-usage-of-python-3-and-error-without-numpy.patch @@ -1,7 +1,7 @@ From f3a0f9aab6dce56eea590b946f60256014b61bf7 Mon Sep 17 00:00:00 2001 From: Mark Harfouche Date: Sun, 1 Sep 2024 17:35:40 -0400 -Subject: [PATCH 01/20] Force usage of python 3 and error without numpy +Subject: [PATCH 01/21] Force usage of python 3 and error without numpy --- cmake/Dependencies.cmake | 6 +++--- diff --git a/recipe/patches/0002-Help-find-numpy.patch b/recipe/patches/0002-Help-find-numpy.patch index 833af9f1d..d660deda0 100644 --- a/recipe/patches/0002-Help-find-numpy.patch +++ b/recipe/patches/0002-Help-find-numpy.patch @@ -1,7 +1,7 @@ From 21c30036b5b86f403c0cf4426165d9a6a50edb1a Mon Sep 17 00:00:00 2001 From: Mark Harfouche Date: Tue, 1 Oct 2024 00:28:40 -0400 -Subject: [PATCH 02/20] Help find numpy +Subject: [PATCH 02/21] Help find numpy --- tools/setup_helpers/cmake.py | 6 ++++++ diff --git a/recipe/patches/0003-Add-USE_SYSTEM_NVTX-option-138287.patch b/recipe/patches/0003-Add-USE_SYSTEM_NVTX-option-138287.patch index a4c44e015..d44513d49 100644 --- a/recipe/patches/0003-Add-USE_SYSTEM_NVTX-option-138287.patch +++ b/recipe/patches/0003-Add-USE_SYSTEM_NVTX-option-138287.patch @@ -1,7 +1,7 @@ From d1826af525db41eda5020a1404f5d5521d67a5dc Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Sat, 19 Oct 2024 04:26:01 +0000 -Subject: [PATCH 03/20] Add USE_SYSTEM_NVTX option (#138287) +Subject: [PATCH 03/21] Add USE_SYSTEM_NVTX option (#138287) ## Summary diff --git a/recipe/patches/0004-Update-sympy-version.patch b/recipe/patches/0004-Update-sympy-version.patch index 81a66b3f5..a73a73994 100644 --- a/recipe/patches/0004-Update-sympy-version.patch +++ b/recipe/patches/0004-Update-sympy-version.patch @@ -1,7 +1,7 @@ From e3219c5fe8834753b0cf9e92be4d1ef1e874f370 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Thu, 17 Oct 2024 15:04:05 -0700 -Subject: [PATCH 04/20] Update sympy version +Subject: [PATCH 04/21] Update sympy version --- setup.py | 2 +- diff --git a/recipe/patches/0005-Fix-duplicate-linker-script.patch b/recipe/patches/0005-Fix-duplicate-linker-script.patch index cb09dcdfb..49e6d72b4 100644 --- a/recipe/patches/0005-Fix-duplicate-linker-script.patch +++ b/recipe/patches/0005-Fix-duplicate-linker-script.patch @@ -1,7 +1,7 @@ From 08a1f44fbc81324aa98d720dfb7b87a261923ac2 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Sun, 3 Nov 2024 01:12:36 -0700 -Subject: [PATCH 05/20] Fix duplicate linker script +Subject: [PATCH 05/21] Fix duplicate linker script --- setup.py | 4 +++- diff --git a/recipe/patches/0006-fix-3.13-pickle-error-in-serialization.py-136034.patch b/recipe/patches/0006-fix-3.13-pickle-error-in-serialization.py-136034.patch index 326e6285f..99baed0a5 100644 --- a/recipe/patches/0006-fix-3.13-pickle-error-in-serialization.py-136034.patch +++ b/recipe/patches/0006-fix-3.13-pickle-error-in-serialization.py-136034.patch @@ -1,7 +1,7 @@ From 15df314a41c69a31c0443254d5552aa1b39d708d Mon Sep 17 00:00:00 2001 From: William Wen Date: Fri, 13 Sep 2024 13:02:33 -0700 -Subject: [PATCH 06/20] fix 3.13 pickle error in serialization.py (#136034) +Subject: [PATCH 06/21] fix 3.13 pickle error in serialization.py (#136034) Error encountered when adding dynamo 3.13 support. Pull Request resolved: https://github.com/pytorch/pytorch/pull/136034 diff --git a/recipe/patches/0007-Allow-users-to-overwrite-ld-with-environment-variabl.patch b/recipe/patches/0007-Allow-users-to-overwrite-ld-with-environment-variabl.patch index ad215aa93..ae6a94cd8 100644 --- a/recipe/patches/0007-Allow-users-to-overwrite-ld-with-environment-variabl.patch +++ b/recipe/patches/0007-Allow-users-to-overwrite-ld-with-environment-variabl.patch @@ -1,7 +1,7 @@ From 655f694854c3eafdd631235b60bc6c1b279218ed Mon Sep 17 00:00:00 2001 From: Mark Harfouche Date: Thu, 3 Oct 2024 22:49:56 -0400 -Subject: [PATCH 07/20] Allow users to overwrite ld with environment variables +Subject: [PATCH 07/21] Allow users to overwrite ld with environment variables This should help in the case of cross compilation. diff --git a/recipe/patches/0008-Allow-overriding-CUDA-related-paths.patch b/recipe/patches/0008-Allow-overriding-CUDA-related-paths.patch index fbfe05607..b52d15880 100644 --- a/recipe/patches/0008-Allow-overriding-CUDA-related-paths.patch +++ b/recipe/patches/0008-Allow-overriding-CUDA-related-paths.patch @@ -1,7 +1,7 @@ From f03bf82d9da9cccb2cf4d4833c1a6349622dc37d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Wed, 27 Nov 2024 13:47:23 +0100 -Subject: [PATCH 08/20] Allow overriding CUDA-related paths +Subject: [PATCH 08/21] Allow overriding CUDA-related paths --- cmake/Modules/FindCUDAToolkit.cmake | 2 +- diff --git a/recipe/patches/0009-Fix-test-test_linalg.py-for-NumPy-2-136800.patch b/recipe/patches/0009-Fix-test-test_linalg.py-for-NumPy-2-136800.patch index 580fe42a0..7d9d1ab50 100644 --- a/recipe/patches/0009-Fix-test-test_linalg.py-for-NumPy-2-136800.patch +++ b/recipe/patches/0009-Fix-test-test_linalg.py-for-NumPy-2-136800.patch @@ -1,7 +1,7 @@ From 4b1faf6ba142953ce2730766db44f8d98d161ef0 Mon Sep 17 00:00:00 2001 From: Haifeng Jin Date: Tue, 1 Oct 2024 07:53:24 +0000 -Subject: [PATCH 09/20] Fix test/test_linalg.py for NumPy 2 (#136800) +Subject: [PATCH 09/21] Fix test/test_linalg.py for NumPy 2 (#136800) Related to #107302. diff --git a/recipe/patches/0010-Fixes-NumPy-2-test-failures-in-test_torch.py-137740.patch b/recipe/patches/0010-Fixes-NumPy-2-test-failures-in-test_torch.py-137740.patch index 6495b150c..c28fe93aa 100644 --- a/recipe/patches/0010-Fixes-NumPy-2-test-failures-in-test_torch.py-137740.patch +++ b/recipe/patches/0010-Fixes-NumPy-2-test-failures-in-test_torch.py-137740.patch @@ -1,7 +1,7 @@ From 032b9be9ca7f9ae174e75554cecc82600ea3ef54 Mon Sep 17 00:00:00 2001 From: Haifeng Jin Date: Sat, 12 Oct 2024 02:40:17 +0000 -Subject: [PATCH 10/20] Fixes NumPy 2 test failures in test_torch.py (#137740) +Subject: [PATCH 10/21] Fixes NumPy 2 test failures in test_torch.py (#137740) Related to #107302 diff --git a/recipe/patches/0011-Use-BLAS_USE_CBLAS_DOT-for-OpenBLAS-builds.patch b/recipe/patches/0011-Use-BLAS_USE_CBLAS_DOT-for-OpenBLAS-builds.patch index 193ce159b..c7b201b6b 100644 --- a/recipe/patches/0011-Use-BLAS_USE_CBLAS_DOT-for-OpenBLAS-builds.patch +++ b/recipe/patches/0011-Use-BLAS_USE_CBLAS_DOT-for-OpenBLAS-builds.patch @@ -1,7 +1,7 @@ From 56f1528fa072023fb2724d5abf8790f2f6cc3aaa Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Wed, 18 Dec 2024 03:59:00 +0000 -Subject: [PATCH 11/20] Use BLAS_USE_CBLAS_DOT for OpenBLAS builds +Subject: [PATCH 11/21] Use BLAS_USE_CBLAS_DOT for OpenBLAS builds There are two calling conventions for *dotu functions diff --git a/recipe/patches/0012-fix-issue-142484.patch b/recipe/patches/0012-fix-issue-142484.patch index 00f1e3d22..db13f7aca 100644 --- a/recipe/patches/0012-fix-issue-142484.patch +++ b/recipe/patches/0012-fix-issue-142484.patch @@ -1,7 +1,7 @@ From beba58d724cc1bd7ca73660b0a5ad9e61ae0c562 Mon Sep 17 00:00:00 2001 From: "Zheng, Zhaoqiong" Date: Fri, 27 Dec 2024 13:49:36 +0800 -Subject: [PATCH 12/20] fix issue 142484 +Subject: [PATCH 12/21] fix issue 142484 From https://github.com/pytorch/pytorch/pull/143894 --- diff --git a/recipe/patches/0013-Fix-FindOpenBLAS.patch b/recipe/patches/0013-Fix-FindOpenBLAS.patch index f539d0a65..49d43f905 100644 --- a/recipe/patches/0013-Fix-FindOpenBLAS.patch +++ b/recipe/patches/0013-Fix-FindOpenBLAS.patch @@ -1,7 +1,7 @@ From 816a248a4425a97350959e412666e6db9012a52e Mon Sep 17 00:00:00 2001 From: Bas Zalmstra Date: Thu, 16 May 2024 10:46:49 +0200 -Subject: [PATCH 13/20] Fix FindOpenBLAS +Subject: [PATCH 13/21] Fix FindOpenBLAS --- cmake/Modules/FindOpenBLAS.cmake | 15 +++++++++------ diff --git a/recipe/patches/0014-CD-Enable-Python-3.13-on-windows-138095.patch b/recipe/patches/0014-CD-Enable-Python-3.13-on-windows-138095.patch index 7a2df88fb..af8083761 100644 --- a/recipe/patches/0014-CD-Enable-Python-3.13-on-windows-138095.patch +++ b/recipe/patches/0014-CD-Enable-Python-3.13-on-windows-138095.patch @@ -1,7 +1,7 @@ From db896f927403f55a18f931b18a6469cb4e37d322 Mon Sep 17 00:00:00 2001 From: atalman Date: Tue, 12 Nov 2024 12:28:10 +0000 -Subject: [PATCH 14/20] CD Enable Python 3.13 on windows (#138095) +Subject: [PATCH 14/21] CD Enable Python 3.13 on windows (#138095) Adding CD windows. Part of: https://github.com/pytorch/pytorch/issues/130249 Builder PR landed with smoke test: https://github.com/pytorch/builder/pull/2035 diff --git a/recipe/patches/0015-simplify-torch.utils.cpp_extension.include_paths-use.patch b/recipe/patches/0015-simplify-torch.utils.cpp_extension.include_paths-use.patch index 3736ca781..6cf5ea9c5 100644 --- a/recipe/patches/0015-simplify-torch.utils.cpp_extension.include_paths-use.patch +++ b/recipe/patches/0015-simplify-torch.utils.cpp_extension.include_paths-use.patch @@ -1,7 +1,7 @@ From 33790dfbf966e7d8ea4ff6798d2ff92474d84079 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Thu, 23 Jan 2025 22:46:58 +1100 -Subject: [PATCH 15/20] simplify torch.utils.cpp_extension.include_paths; use +Subject: [PATCH 15/21] simplify torch.utils.cpp_extension.include_paths; use it in cpp_builder The /TH headers have not existed since pytorch 1.11 diff --git a/recipe/patches/0016-point-include-paths-to-PREFIX-include.patch b/recipe/patches/0016-point-include-paths-to-PREFIX-include.patch index 764e24af5..ed6b74f62 100644 --- a/recipe/patches/0016-point-include-paths-to-PREFIX-include.patch +++ b/recipe/patches/0016-point-include-paths-to-PREFIX-include.patch @@ -1,7 +1,7 @@ From 799f6fa59dac93dabbbcf72d46f4e1334e3d65d9 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Thu, 23 Jan 2025 22:58:14 +1100 -Subject: [PATCH 16/20] point include paths to $PREFIX/include +Subject: [PATCH 16/21] point include paths to $PREFIX/include --- torch/utils/cpp_extension.py | 9 +++++++++ diff --git a/recipe/patches/0017-Add-conda-prefix-to-inductor-include-paths.patch b/recipe/patches/0017-Add-conda-prefix-to-inductor-include-paths.patch index e2111c54d..aff55f95d 100644 --- a/recipe/patches/0017-Add-conda-prefix-to-inductor-include-paths.patch +++ b/recipe/patches/0017-Add-conda-prefix-to-inductor-include-paths.patch @@ -1,7 +1,7 @@ From 9f73a02bacf9680833ac64657fde6762d33ab200 Mon Sep 17 00:00:00 2001 From: Daniel Petry Date: Tue, 21 Jan 2025 17:45:23 -0600 -Subject: [PATCH 17/20] Add conda prefix to inductor include paths +Subject: [PATCH 17/21] Add conda prefix to inductor include paths Currently inductor doesn't look in conda's includes and libs. This results in errors when it tries to compile, if system versions are being used of diff --git a/recipe/patches/0018-make-ATEN_INCLUDE_DIR-relative-to-TORCH_INSTALL_PREF.patch b/recipe/patches/0018-make-ATEN_INCLUDE_DIR-relative-to-TORCH_INSTALL_PREF.patch index 028d79be3..426e6015d 100644 --- a/recipe/patches/0018-make-ATEN_INCLUDE_DIR-relative-to-TORCH_INSTALL_PREF.patch +++ b/recipe/patches/0018-make-ATEN_INCLUDE_DIR-relative-to-TORCH_INSTALL_PREF.patch @@ -1,7 +1,7 @@ From b0cfa0f728e96a3a9d6f7434e2c02d74d6daa9a9 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Tue, 28 Jan 2025 14:15:34 +1100 -Subject: [PATCH 18/20] make ATEN_INCLUDE_DIR relative to TORCH_INSTALL_PREFIX +Subject: [PATCH 18/21] make ATEN_INCLUDE_DIR relative to TORCH_INSTALL_PREFIX we cannot set CMAKE_INSTALL_PREFIX without the pytorch build complaining, but we can use TORCH_INSTALL_PREFIX, which is set correctly relative to our CMake files already: diff --git a/recipe/patches/0019-remove-DESTINATION-lib-from-CMake-install-TARGETS-di.patch b/recipe/patches/0019-remove-DESTINATION-lib-from-CMake-install-TARGETS-di.patch index 7aa411927..789509862 100644 --- a/recipe/patches/0019-remove-DESTINATION-lib-from-CMake-install-TARGETS-di.patch +++ b/recipe/patches/0019-remove-DESTINATION-lib-from-CMake-install-TARGETS-di.patch @@ -1,7 +1,7 @@ From f7db4cbfb0af59027ed8bdcd0387dba6fbcb1192 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Tue, 28 Jan 2025 10:58:29 +1100 -Subject: [PATCH 19/20] remove `DESTINATION lib` from CMake `install(TARGETS` +Subject: [PATCH 19/21] remove `DESTINATION lib` from CMake `install(TARGETS` directives Suggested-By: Silvio Traversaro diff --git a/recipe/patches/0020-make-library-name-in-test_mutable_custom_op_fixed_la.patch b/recipe/patches/0020-make-library-name-in-test_mutable_custom_op_fixed_la.patch index 523d92ccb..392ce265e 100644 --- a/recipe/patches/0020-make-library-name-in-test_mutable_custom_op_fixed_la.patch +++ b/recipe/patches/0020-make-library-name-in-test_mutable_custom_op_fixed_la.patch @@ -1,7 +1,7 @@ From 79ee5dcac30f2eba891af961f7649d15dfc6ce63 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Thu, 30 Jan 2025 13:23:14 +1100 -Subject: [PATCH 20/20] make library name in +Subject: [PATCH 20/21] make library name in `test_mutable_custom_op_fixed_layout{,2}` unique Suggested-By: Daniel Petry diff --git a/recipe/patches/0021-avoid-deprecated-find_package-CUDA-in-caffe2-CMake-m.patch b/recipe/patches/0021-avoid-deprecated-find_package-CUDA-in-caffe2-CMake-m.patch new file mode 100644 index 000000000..690dd90fc --- /dev/null +++ b/recipe/patches/0021-avoid-deprecated-find_package-CUDA-in-caffe2-CMake-m.patch @@ -0,0 +1,216 @@ +From befd57c110928ddaebec95cb54b6e6f2e3df2e22 Mon Sep 17 00:00:00 2001 +From: "H. Vetinari" +Date: Thu, 30 Jan 2025 08:33:44 +1100 +Subject: [PATCH 21/21] avoid deprecated `find_package(CUDA)` in caffe2 CMake + metadata + +--- + caffe2/CMakeLists.txt | 14 ++++++------- + cmake/Summary.cmake | 10 +++++----- + cmake/TorchConfig.cmake.in | 2 +- + cmake/public/cuda.cmake | 40 +++++++++++++++----------------------- + 4 files changed, 29 insertions(+), 37 deletions(-) + +diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt +index b51c7cc637b..6e107b5b02a 100644 +--- a/caffe2/CMakeLists.txt ++++ b/caffe2/CMakeLists.txt +@@ -906,25 +906,25 @@ if(USE_ROCM) + "$<$:ATen/core/ATen_pch.h>") + endif() + elseif(USE_CUDA) +- set(CUDA_LINK_LIBRARIES_KEYWORD PRIVATE) ++ set(CUDAToolkit_LINK_LIBRARIES_KEYWORD PRIVATE) + list(APPEND Caffe2_GPU_SRCS ${GENERATED_CXX_TORCH_CUDA}) +- if(CUDA_SEPARABLE_COMPILATION) ++ if(CUDAToolkit_SEPARABLE_COMPILATION) + # Separate compilation fails when kernels using `thrust::sort_by_key` + # are linked with the rest of CUDA code. Workaround by linking them separately. + add_library(torch_cuda ${Caffe2_GPU_SRCS} ${Caffe2_GPU_CU_SRCS}) +- set_property(TARGET torch_cuda PROPERTY CUDA_SEPARABLE_COMPILATION ON) ++ set_property(TARGET torch_cuda PROPERTY CUDAToolkit_SEPARABLE_COMPILATION ON) + + add_library(torch_cuda_w_sort_by_key OBJECT + ${Caffe2_GPU_SRCS_W_SORT_BY_KEY} + ${Caffe2_GPU_CU_SRCS_W_SORT_BY_KEY}) +- set_property(TARGET torch_cuda_w_sort_by_key PROPERTY CUDA_SEPARABLE_COMPILATION OFF) ++ set_property(TARGET torch_cuda_w_sort_by_key PROPERTY CUDAToolkit_SEPARABLE_COMPILATION OFF) + target_link_libraries(torch_cuda PRIVATE torch_cuda_w_sort_by_key) + else() + add_library(torch_cuda + ${Caffe2_GPU_SRCS} ${Caffe2_GPU_SRCS_W_SORT_BY_KEY} + ${Caffe2_GPU_CU_SRCS} ${Caffe2_GPU_CU_SRCS_W_SORT_BY_KEY}) + endif() +- set(CUDA_LINK_LIBRARIES_KEYWORD) ++ set(CUDAToolkit_LINK_LIBRARIES_KEYWORD) + torch_compile_options(torch_cuda) # see cmake/public/utils.cmake + target_compile_definitions(torch_cuda PRIVATE USE_CUDA) + +@@ -973,12 +973,12 @@ elseif(USE_CUDA) + torch_cuda + ) + if($ENV{ATEN_STATIC_CUDA}) +- if(CUDA_VERSION_MAJOR LESS_EQUAL 11) ++ if(CUDAToolkit_VERSION_MAJOR LESS_EQUAL 11) + target_link_libraries(torch_cuda_linalg PRIVATE + CUDA::cusolver_static + ${CUDAToolkit_LIBRARY_DIR}/liblapack_static.a # needed for libcusolver_static + ) +- elseif(CUDA_VERSION_MAJOR GREATER_EQUAL 12) ++ elseif(CUDAToolkit_VERSION_MAJOR GREATER_EQUAL 12) + target_link_libraries(torch_cuda_linalg PRIVATE + CUDA::cusolver_static + ${CUDAToolkit_LIBRARY_DIR}/libcusolver_lapack_static.a # needed for libcusolver_static +diff --git a/cmake/Summary.cmake b/cmake/Summary.cmake +index d51c451589c..154f04a89dd 100644 +--- a/cmake/Summary.cmake ++++ b/cmake/Summary.cmake +@@ -76,7 +76,7 @@ function(caffe2_print_configuration_summary) + message(STATUS " USE_CUSPARSELT : ${USE_CUSPARSELT}") + message(STATUS " USE_CUDSS : ${USE_CUDSS}") + message(STATUS " USE_CUFILE : ${USE_CUFILE}") +- message(STATUS " CUDA version : ${CUDA_VERSION}") ++ message(STATUS " CUDA version : ${CUDAToolkit_VERSION}") + message(STATUS " USE_FLASH_ATTENTION : ${USE_FLASH_ATTENTION}") + message(STATUS " USE_MEM_EFF_ATTENTION : ${USE_MEM_EFF_ATTENTION}") + if(${USE_CUDNN}) +@@ -88,7 +88,7 @@ function(caffe2_print_configuration_summary) + if(${USE_CUFILE}) + message(STATUS " cufile library : ${CUDA_cuFile_LIBRARY}") + endif() +- message(STATUS " CUDA root directory : ${CUDA_TOOLKIT_ROOT_DIR}") ++ message(STATUS " CUDA root directory : ${CUDAToolkit_ROOT}") + message(STATUS " CUDA library : ${CUDA_cuda_driver_LIBRARY}") + message(STATUS " cudart library : ${CUDA_cudart_LIBRARY}") + message(STATUS " cublas library : ${CUDA_cublas_LIBRARY}") +@@ -108,12 +108,12 @@ function(caffe2_print_configuration_summary) + message(STATUS " cuDSS library : ${__tmp}") + endif() + message(STATUS " nvrtc : ${CUDA_nvrtc_LIBRARY}") +- message(STATUS " CUDA include path : ${CUDA_INCLUDE_DIRS}") +- message(STATUS " NVCC executable : ${CUDA_NVCC_EXECUTABLE}") ++ message(STATUS " CUDA include path : ${CUDATookit_INCLUDE_DIRS}") ++ message(STATUS " NVCC executable : ${CUDATookit_NVCC_EXECUTABLE}") + message(STATUS " CUDA compiler : ${CMAKE_CUDA_COMPILER}") + message(STATUS " CUDA flags : ${CMAKE_CUDA_FLAGS}") + message(STATUS " CUDA host compiler : ${CMAKE_CUDA_HOST_COMPILER}") +- message(STATUS " CUDA --device-c : ${CUDA_SEPARABLE_COMPILATION}") ++ message(STATUS " CUDA --device-c : ${CUDATookit_SEPARABLE_COMPILATION}") + message(STATUS " USE_TENSORRT : ${USE_TENSORRT}") + if(${USE_TENSORRT}) + message(STATUS " TensorRT runtime library: ${TENSORRT_LIBRARY}") +diff --git a/cmake/TorchConfig.cmake.in b/cmake/TorchConfig.cmake.in +index cba4d929855..da904fc6a18 100644 +--- a/cmake/TorchConfig.cmake.in ++++ b/cmake/TorchConfig.cmake.in +@@ -125,7 +125,7 @@ if(@USE_CUDA@) + find_library(CAFFE2_NVRTC_LIBRARY caffe2_nvrtc PATHS "${TORCH_INSTALL_PREFIX}/lib") + list(APPEND TORCH_CUDA_LIBRARIES ${CAFFE2_NVRTC_LIBRARY}) + else() +- set(TORCH_CUDA_LIBRARIES ${CUDA_NVRTC_LIB}) ++ set(TORCH_CUDA_LIBRARIES CUDA::nvrtc) + endif() + if(TARGET torch::nvtoolsext) + list(APPEND TORCH_CUDA_LIBRARIES torch::nvtoolsext) +diff --git a/cmake/public/cuda.cmake b/cmake/public/cuda.cmake +index 152fbdbe6dd..13bae9b6227 100644 +--- a/cmake/public/cuda.cmake ++++ b/cmake/public/cuda.cmake +@@ -26,8 +26,8 @@ if(NOT MSVC) + endif() + + # Find CUDA. +-find_package(CUDA) +-if(NOT CUDA_FOUND) ++find_package(CUDAToolkit) ++if(NOT CUDAToolkit_FOUND) + message(WARNING + "Caffe2: CUDA cannot be found. Depending on whether you are building " + "Caffe2 or a Caffe2 dependent library, the next warning / error will " +@@ -36,8 +36,6 @@ if(NOT CUDA_FOUND) + return() + endif() + +-# Enable CUDA language support +-set(CUDAToolkit_ROOT "${CUDA_TOOLKIT_ROOT_DIR}") + # Pass clang as host compiler, which according to the docs + # Must be done before CUDA language is enabled, see + # https://cmake.org/cmake/help/v3.15/variable/CMAKE_CUDA_HOST_COMPILER.html +@@ -56,24 +54,18 @@ if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0) + cmake_policy(SET CMP0074 NEW) + endif() + +-find_package(CUDAToolkit REQUIRED) ++find_package(CUDAToolkit REQUIRED COMPONENTS cudart nvrtc REQUIRED) + + cmake_policy(POP) + +-if(NOT CMAKE_CUDA_COMPILER_VERSION VERSION_EQUAL CUDAToolkit_VERSION) +- message(FATAL_ERROR "Found two conflicting CUDA versions:\n" +- "V${CMAKE_CUDA_COMPILER_VERSION} in '${CUDA_INCLUDE_DIRS}' and\n" +- "V${CUDAToolkit_VERSION} in '${CUDAToolkit_INCLUDE_DIRS}'") +-endif() +- +-message(STATUS "Caffe2: CUDA detected: " ${CUDA_VERSION}) +-message(STATUS "Caffe2: CUDA nvcc is: " ${CUDA_NVCC_EXECUTABLE}) +-message(STATUS "Caffe2: CUDA toolkit directory: " ${CUDA_TOOLKIT_ROOT_DIR}) +-if(CUDA_VERSION VERSION_LESS 11.0) ++message(STATUS "Caffe2: CUDA detected: " ${CUDAToolkit_VERSION}) ++message(STATUS "Caffe2: CUDA nvcc is: " ${CUDAToolkit_NVCC_EXECUTABLE}) ++message(STATUS "Caffe2: CUDA toolkit directory: " ${CUDAToolkit_ROOT}) ++if(CUDAToolkit_VERSION VERSION_LESS 11.0) + message(FATAL_ERROR "PyTorch requires CUDA 11.0 or above.") + endif() + +-if(CUDA_FOUND) ++if(CUDAToolkit_FOUND) + # Sometimes, we may mismatch nvcc with the CUDA headers we are + # compiling with, e.g., if a ccache nvcc is fed to us by CUDA_NVCC_EXECUTABLE + # but the PATH is not consistent with CUDA_HOME. It's better safe +@@ -97,8 +89,8 @@ if(CUDA_FOUND) + ) + if(NOT CMAKE_CROSSCOMPILING) + try_run(run_result compile_result ${PROJECT_RANDOM_BINARY_DIR} ${file} +- CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${CUDA_INCLUDE_DIRS}" +- LINK_LIBRARIES ${CUDA_LIBRARIES} ++ CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${CUDAToolkit_INCLUDE_DIRS}" ++ LINK_LIBRARIES ${CUDAToolkit_LIBRARIES} + RUN_OUTPUT_VARIABLE cuda_version_from_header + COMPILE_OUTPUT_VARIABLE output_var + ) +@@ -106,20 +98,20 @@ if(CUDA_FOUND) + message(FATAL_ERROR "Caffe2: Couldn't determine version from header: " ${output_var}) + endif() + message(STATUS "Caffe2: Header version is: " ${cuda_version_from_header}) +- if(NOT cuda_version_from_header STREQUAL ${CUDA_VERSION_STRING}) ++ if(NOT cuda_version_from_header STREQUAL "${CUDAToolkit_VERSION}") + # Force CUDA to be processed for again next time + # TODO: I'm not sure if this counts as an implementation detail of + # FindCUDA +- set(${cuda_version_from_findcuda} ${CUDA_VERSION_STRING}) ++ set(${cuda_version_from_findcuda} "${CUDAToolkit_VERSION}") + unset(CUDA_TOOLKIT_ROOT_DIR_INTERNAL CACHE) + # Not strictly necessary, but for good luck. +- unset(CUDA_VERSION CACHE) ++ unset(CUDAToolkit_VERSION CACHE) + # Error out + message(FATAL_ERROR "FindCUDA says CUDA version is ${cuda_version_from_findcuda} (usually determined by nvcc), " + "but the CUDA headers say the version is ${cuda_version_from_header}. This often occurs " + "when you set both CUDA_HOME and CUDA_NVCC_EXECUTABLE to " + "non-standard locations, without also setting PATH to point to the correct nvcc. " +- "Perhaps, try re-running this command again with PATH=${CUDA_TOOLKIT_ROOT_DIR}/bin:$PATH. " ++ "Perhaps, try re-running this command again with PATH=${CUDAToolkit_ROOT}/bin:$PATH. " + "See above log messages for more diagnostics, and see https://github.com/pytorch/pytorch/issues/8092 for more details.") + endif() + endif() +@@ -128,8 +120,8 @@ endif() + # ---[ CUDA libraries wrapper + + # find lbnvrtc.so +-set(CUDA_NVRTC_LIB "${CUDA_nvrtc_LIBRARY}" CACHE FILEPATH "") +-if(CUDA_NVRTC_LIB AND NOT CUDA_NVRTC_SHORTHASH) ++get_target_property(CUDA_NVRTC_LIB cuda::nvrtc INTERFACE_LINK_LIBRARIES) ++if(NOT CUDA_NVRTC_SHORTHASH) + find_package(Python COMPONENTS Interpreter) + execute_process( + COMMAND Python::Interpreter -c From 309bfbc35b11d9f481f1ebbbe0251303f8138f6c Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Thu, 30 Jan 2025 23:33:17 +1100 Subject: [PATCH 09/12] delete an unnecessary check --- ...-find_package-CUDA-in-caffe2-CMake-m.patch | 45 +++++++++---------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/recipe/patches/0021-avoid-deprecated-find_package-CUDA-in-caffe2-CMake-m.patch b/recipe/patches/0021-avoid-deprecated-find_package-CUDA-in-caffe2-CMake-m.patch index 690dd90fc..2f066a39a 100644 --- a/recipe/patches/0021-avoid-deprecated-find_package-CUDA-in-caffe2-CMake-m.patch +++ b/recipe/patches/0021-avoid-deprecated-find_package-CUDA-in-caffe2-CMake-m.patch @@ -1,15 +1,15 @@ -From befd57c110928ddaebec95cb54b6e6f2e3df2e22 Mon Sep 17 00:00:00 2001 +From 012e72268018aeb5d728898222e19634f131762a Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Thu, 30 Jan 2025 08:33:44 +1100 Subject: [PATCH 21/21] avoid deprecated `find_package(CUDA)` in caffe2 CMake metadata --- - caffe2/CMakeLists.txt | 14 ++++++------- - cmake/Summary.cmake | 10 +++++----- + caffe2/CMakeLists.txt | 14 +++++------ + cmake/Summary.cmake | 10 ++++---- cmake/TorchConfig.cmake.in | 2 +- - cmake/public/cuda.cmake | 40 +++++++++++++++----------------------- - 4 files changed, 29 insertions(+), 37 deletions(-) + cmake/public/cuda.cmake | 48 ++++++++++---------------------------- + 4 files changed, 25 insertions(+), 49 deletions(-) diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt index b51c7cc637b..6e107b5b02a 100644 @@ -113,7 +113,7 @@ index cba4d929855..da904fc6a18 100644 if(TARGET torch::nvtoolsext) list(APPEND TORCH_CUDA_LIBRARIES torch::nvtoolsext) diff --git a/cmake/public/cuda.cmake b/cmake/public/cuda.cmake -index 152fbdbe6dd..13bae9b6227 100644 +index 152fbdbe6dd..50d37f4d6d0 100644 --- a/cmake/public/cuda.cmake +++ b/cmake/public/cuda.cmake @@ -26,8 +26,8 @@ if(NOT MSVC) @@ -178,32 +178,29 @@ index 152fbdbe6dd..13bae9b6227 100644 RUN_OUTPUT_VARIABLE cuda_version_from_header COMPILE_OUTPUT_VARIABLE output_var ) -@@ -106,20 +98,20 @@ if(CUDA_FOUND) +@@ -106,30 +98,14 @@ if(CUDA_FOUND) message(FATAL_ERROR "Caffe2: Couldn't determine version from header: " ${output_var}) endif() message(STATUS "Caffe2: Header version is: " ${cuda_version_from_header}) - if(NOT cuda_version_from_header STREQUAL ${CUDA_VERSION_STRING}) -+ if(NOT cuda_version_from_header STREQUAL "${CUDAToolkit_VERSION}") - # Force CUDA to be processed for again next time - # TODO: I'm not sure if this counts as an implementation detail of - # FindCUDA +- # Force CUDA to be processed for again next time +- # TODO: I'm not sure if this counts as an implementation detail of +- # FindCUDA - set(${cuda_version_from_findcuda} ${CUDA_VERSION_STRING}) -+ set(${cuda_version_from_findcuda} "${CUDAToolkit_VERSION}") - unset(CUDA_TOOLKIT_ROOT_DIR_INTERNAL CACHE) - # Not strictly necessary, but for good luck. +- unset(CUDA_TOOLKIT_ROOT_DIR_INTERNAL CACHE) +- # Not strictly necessary, but for good luck. - unset(CUDA_VERSION CACHE) -+ unset(CUDAToolkit_VERSION CACHE) - # Error out - message(FATAL_ERROR "FindCUDA says CUDA version is ${cuda_version_from_findcuda} (usually determined by nvcc), " - "but the CUDA headers say the version is ${cuda_version_from_header}. This often occurs " - "when you set both CUDA_HOME and CUDA_NVCC_EXECUTABLE to " - "non-standard locations, without also setting PATH to point to the correct nvcc. " +- # Error out +- message(FATAL_ERROR "FindCUDA says CUDA version is ${cuda_version_from_findcuda} (usually determined by nvcc), " +- "but the CUDA headers say the version is ${cuda_version_from_header}. This often occurs " +- "when you set both CUDA_HOME and CUDA_NVCC_EXECUTABLE to " +- "non-standard locations, without also setting PATH to point to the correct nvcc. " - "Perhaps, try re-running this command again with PATH=${CUDA_TOOLKIT_ROOT_DIR}/bin:$PATH. " -+ "Perhaps, try re-running this command again with PATH=${CUDAToolkit_ROOT}/bin:$PATH. " - "See above log messages for more diagnostics, and see https://github.com/pytorch/pytorch/issues/8092 for more details.") - endif() +- "See above log messages for more diagnostics, and see https://github.com/pytorch/pytorch/issues/8092 for more details.") +- endif() endif() -@@ -128,8 +120,8 @@ endif() + endif() + # ---[ CUDA libraries wrapper # find lbnvrtc.so From e1b9c92087290dfb8c8b9774e366fb28a51f7bf2 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Fri, 31 Jan 2025 07:50:07 +1100 Subject: [PATCH 10/12] vendor CMake's cuda_select_nvcc_arch_flags --- recipe/meta.yaml | 1 + ...-find_package-CUDA-in-caffe2-CMake-m.patch | 149 +++++++++++++++++- recipe/third_party/CMake/Copyright.txt | 136 ++++++++++++++++ 3 files changed, 280 insertions(+), 6 deletions(-) create mode 100644 recipe/third_party/CMake/Copyright.txt diff --git a/recipe/meta.yaml b/recipe/meta.yaml index e34a1e440..6d4907c3b 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -553,6 +553,7 @@ about: license_file: - LICENSE - NOTICE + - third_party/CMake/Copyright.txt summary: PyTorch is an optimized tensor library for deep learning using GPUs and CPUs. description: | PyTorch is a Python package that provides two high-level features: diff --git a/recipe/patches/0021-avoid-deprecated-find_package-CUDA-in-caffe2-CMake-m.patch b/recipe/patches/0021-avoid-deprecated-find_package-CUDA-in-caffe2-CMake-m.patch index 2f066a39a..eff7150b8 100644 --- a/recipe/patches/0021-avoid-deprecated-find_package-CUDA-in-caffe2-CMake-m.patch +++ b/recipe/patches/0021-avoid-deprecated-find_package-CUDA-in-caffe2-CMake-m.patch @@ -1,15 +1,17 @@ -From 012e72268018aeb5d728898222e19634f131762a Mon Sep 17 00:00:00 2001 +From 6ec9f719d4e0cc1f572fc334fbbfac89a3c2b7a9 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Thu, 30 Jan 2025 08:33:44 +1100 Subject: [PATCH 21/21] avoid deprecated `find_package(CUDA)` in caffe2 CMake metadata +vendor the not-available-anymore function torch_cuda_get_nvcc_gencode_flag from CMake --- - caffe2/CMakeLists.txt | 14 +++++------ - cmake/Summary.cmake | 10 ++++---- - cmake/TorchConfig.cmake.in | 2 +- - cmake/public/cuda.cmake | 48 ++++++++++---------------------------- - 4 files changed, 25 insertions(+), 49 deletions(-) + caffe2/CMakeLists.txt | 14 ++--- + cmake/Summary.cmake | 10 +-- + cmake/TorchConfig.cmake.in | 2 +- + cmake/public/cuda.cmake | 48 ++++---------- + cmake/public/utils.cmake | 124 +++++++++++++++++++++++++++++++++++++ + 5 files changed, 149 insertions(+), 49 deletions(-) diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt index b51c7cc637b..6e107b5b02a 100644 @@ -211,3 +213,138 @@ index 152fbdbe6dd..50d37f4d6d0 100644 find_package(Python COMPONENTS Interpreter) execute_process( COMMAND Python::Interpreter -c +diff --git a/cmake/public/utils.cmake b/cmake/public/utils.cmake +index c6647eb457c..de066549f26 100644 +--- a/cmake/public/utils.cmake ++++ b/cmake/public/utils.cmake +@@ -306,6 +306,130 @@ macro(torch_hip_get_arch_list store_var) + string(REPLACE " " ";" ${store_var} "${_TMP}") + endmacro() + ++# torch_cuda_get_nvcc_gencode_flag is part of find_package(CUDA), but not find_package(CUDAToolkit); ++# vendor it from https://github.com/Kitware/CMake/blob/master/Modules/FindCUDA/select_compute_arch.cmake ++################################################################################################ ++# Function for selecting GPU arch flags for nvcc based on CUDA architectures from parameter list ++# Usage: ++# SELECT_NVCC_ARCH_FLAGS(out_variable [list of CUDA compute archs]) ++function(CUDA_SELECT_NVCC_ARCH_FLAGS out_variable) ++ set(CUDA_ARCH_LIST "${ARGN}") ++ ++ if("X${CUDA_ARCH_LIST}" STREQUAL "X" ) ++ set(CUDA_ARCH_LIST "Auto") ++ endif() ++ ++ set(cuda_arch_bin) ++ set(cuda_arch_ptx) ++ ++ if("${CUDA_ARCH_LIST}" STREQUAL "All") ++ set(CUDA_ARCH_LIST ${CUDA_KNOWN_GPU_ARCHITECTURES}) ++ elseif("${CUDA_ARCH_LIST}" STREQUAL "Common") ++ set(CUDA_ARCH_LIST ${CUDA_COMMON_GPU_ARCHITECTURES}) ++ elseif("${CUDA_ARCH_LIST}" STREQUAL "Auto") ++ CUDA_DETECT_INSTALLED_GPUS(CUDA_ARCH_LIST) ++ message(STATUS "Autodetected CUDA architecture(s): ${CUDA_ARCH_LIST}") ++ endif() ++ ++ # Now process the list and look for names ++ string(REGEX REPLACE "[ \t]+" ";" CUDA_ARCH_LIST "${CUDA_ARCH_LIST}") ++ list(REMOVE_DUPLICATES CUDA_ARCH_LIST) ++ foreach(arch_name ${CUDA_ARCH_LIST}) ++ set(arch_bin) ++ set(arch_ptx) ++ set(add_ptx FALSE) ++ # Check to see if we are compiling PTX ++ if(arch_name MATCHES "(.*)\\+PTX$") ++ set(add_ptx TRUE) ++ set(arch_name ${CMAKE_MATCH_1}) ++ endif() ++ if(arch_name MATCHES "^([0-9]\\.[0-9](\\([0-9]\\.[0-9]\\))?)$") ++ set(arch_bin ${CMAKE_MATCH_1}) ++ set(arch_ptx ${arch_bin}) ++ else() ++ # Look for it in our list of known architectures ++ if(${arch_name} STREQUAL "Fermi") ++ set(arch_bin 2.0 "2.1(2.0)") ++ elseif(${arch_name} STREQUAL "Kepler+Tegra") ++ set(arch_bin 3.2) ++ elseif(${arch_name} STREQUAL "Kepler+Tesla") ++ set(arch_bin 3.7) ++ elseif(${arch_name} STREQUAL "Kepler") ++ set(arch_bin 3.0 3.5) ++ set(arch_ptx 3.5) ++ elseif(${arch_name} STREQUAL "Maxwell+Tegra") ++ set(arch_bin 5.3) ++ elseif(${arch_name} STREQUAL "Maxwell") ++ set(arch_bin 5.0 5.2) ++ set(arch_ptx 5.2) ++ elseif(${arch_name} STREQUAL "Pascal") ++ set(arch_bin 6.0 6.1) ++ set(arch_ptx 6.1) ++ elseif(${arch_name} STREQUAL "Volta") ++ set(arch_bin 7.0 7.0) ++ set(arch_ptx 7.0) ++ elseif(${arch_name} STREQUAL "Turing") ++ set(arch_bin 7.5) ++ set(arch_ptx 7.5) ++ elseif(${arch_name} STREQUAL "Ampere") ++ set(arch_bin 8.0) ++ set(arch_ptx 8.0) ++ else() ++ message(SEND_ERROR "Unknown CUDA Architecture Name ${arch_name} in CUDA_SELECT_NVCC_ARCH_FLAGS") ++ endif() ++ endif() ++ if(NOT arch_bin) ++ message(SEND_ERROR "arch_bin wasn't set for some reason") ++ endif() ++ list(APPEND cuda_arch_bin ${arch_bin}) ++ if(add_ptx) ++ if (NOT arch_ptx) ++ set(arch_ptx ${arch_bin}) ++ endif() ++ list(APPEND cuda_arch_ptx ${arch_ptx}) ++ endif() ++ endforeach() ++ ++ # remove dots and convert to lists ++ string(REGEX REPLACE "\\." "" cuda_arch_bin "${cuda_arch_bin}") ++ string(REGEX REPLACE "\\." "" cuda_arch_ptx "${cuda_arch_ptx}") ++ string(REGEX MATCHALL "[0-9()]+" cuda_arch_bin "${cuda_arch_bin}") ++ string(REGEX MATCHALL "[0-9]+" cuda_arch_ptx "${cuda_arch_ptx}") ++ ++ if(cuda_arch_bin) ++ list(REMOVE_DUPLICATES cuda_arch_bin) ++ endif() ++ if(cuda_arch_ptx) ++ list(REMOVE_DUPLICATES cuda_arch_ptx) ++ endif() ++ ++ set(nvcc_flags "") ++ set(nvcc_archs_readable "") ++ ++ # Tell NVCC to add binaries for the specified GPUs ++ foreach(arch ${cuda_arch_bin}) ++ if(arch MATCHES "([0-9]+)\\(([0-9]+)\\)") ++ # User explicitly specified ARCH for the concrete CODE ++ list(APPEND nvcc_flags -gencode arch=compute_${CMAKE_MATCH_2},code=sm_${CMAKE_MATCH_1}) ++ list(APPEND nvcc_archs_readable sm_${CMAKE_MATCH_1}) ++ else() ++ # User didn't explicitly specify ARCH for the concrete CODE, we assume ARCH=CODE ++ list(APPEND nvcc_flags -gencode arch=compute_${arch},code=sm_${arch}) ++ list(APPEND nvcc_archs_readable sm_${arch}) ++ endif() ++ endforeach() ++ ++ # Tell NVCC to add PTX intermediate code for the specified architectures ++ foreach(arch ${cuda_arch_ptx}) ++ list(APPEND nvcc_flags -gencode arch=compute_${arch},code=compute_${arch}) ++ list(APPEND nvcc_archs_readable compute_${arch}) ++ endforeach() ++ ++ string(REPLACE ";" " " nvcc_archs_readable "${nvcc_archs_readable}") ++ set(${out_variable} ${nvcc_flags} PARENT_SCOPE) ++ set(${out_variable}_readable ${nvcc_archs_readable} PARENT_SCOPE) ++endfunction() ++ + ############################################################################## + # Get the NVCC arch flags specified by TORCH_CUDA_ARCH_LIST and CUDA_ARCH_NAME. + # Usage: diff --git a/recipe/third_party/CMake/Copyright.txt b/recipe/third_party/CMake/Copyright.txt new file mode 100644 index 000000000..f32a818aa --- /dev/null +++ b/recipe/third_party/CMake/Copyright.txt @@ -0,0 +1,136 @@ +CMake - Cross Platform Makefile Generator +Copyright 2000-2025 Kitware, Inc. and Contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +* Neither the name of Kitware, Inc. nor the names of Contributors + may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------------ + +The following individuals and institutions are among the Contributors: + +* Aaron C. Meadows +* Adriaan de Groot +* Aleksey Avdeev +* Alexander Neundorf +* Alexander Smorkalov +* Alexey Sokolov +* Alex Merry +* Alex Turbov +* Andreas Pakulat +* Andreas Schneider +* André Rigland Brodtkorb +* Axel Huebl, Helmholtz-Zentrum Dresden - Rossendorf +* Benjamin Eikel +* Bjoern Ricks +* Brad Hards +* Christopher Harvey +* Christoph Grüninger +* Clement Creusot +* Daniel Blezek +* Daniel Pfeifer +* Dawid Wróbel +* Enrico Scholz +* Eran Ifrah +* Esben Mose Hansen, Ange Optimization ApS +* Geoffrey Viola +* Google Inc +* Gregor Jasny +* Helio Chissini de Castro +* Ilya Lavrenov +* Insight Software Consortium +* Intel Corporation +* Jan Woetzel +* Jordan Williams +* Julien Schueller +* Kelly Thompson +* Konstantin Podsvirov +* Laurent Montel +* Mario Bensi +* Martin Gräßlin +* Mathieu Malaterre +* Matthaeus G. Chajdas +* Matthias Kretz +* Matthias Maennich +* Michael Hirsch, Ph.D. +* Michael Stürmer +* Miguel A. Figueroa-Villanueva +* Mike Durso +* Mike Jackson +* Mike McQuaid +* Nicolas Bock +* Nicolas Despres +* Nikita Krupen'ko +* NVIDIA Corporation +* OpenGamma Ltd. +* Patrick Stotko +* Per Øyvind Karlsen +* Peter Collingbourne +* Petr Gotthard +* Philip Lowman +* Philippe Proulx +* Raffi Enficiaud, Max Planck Society +* Raumfeld +* Roger Leigh +* Rolf Eike Beer +* Roman Donchenko +* Roman Kharitonov +* Ruslan Baratov +* Sebastian Holtermann +* Stephen Kelly +* Sylvain Joubert +* The Qt Company Ltd. +* Thomas Sondergaard +* Tobias Hunger +* Todd Gamblin +* Tristan Carel +* University of Dundee +* Vadim Zhukov +* Will Dicharry + +See version control history for details of individual contributions. + +The above copyright and license notice applies to distributions of +CMake in source and binary form. Third-party software packages supplied +with CMake under compatible licenses provide their own copyright notices +documented in corresponding subdirectories or source files. + +------------------------------------------------------------------------------ + +CMake was initially developed by Kitware with the following sponsorship: + + * National Library of Medicine at the National Institutes of Health + as part of the Insight Segmentation and Registration Toolkit (ITK). + + * US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel + Visualization Initiative. + + * National Alliance for Medical Image Computing (NAMIC) is funded by the + National Institutes of Health through the NIH Roadmap for Medical Research, + Grant U54 EB005149. + + * Kitware, Inc. From 1202e6a309842b9f5be69ae988f46f3a0a6d6e0f Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Fri, 31 Jan 2025 08:37:57 +1100 Subject: [PATCH 11/12] fix a casing error in CMake --- ...oid-deprecated-find_package-CUDA-in-caffe2-CMake-m.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recipe/patches/0021-avoid-deprecated-find_package-CUDA-in-caffe2-CMake-m.patch b/recipe/patches/0021-avoid-deprecated-find_package-CUDA-in-caffe2-CMake-m.patch index eff7150b8..428f5fd2e 100644 --- a/recipe/patches/0021-avoid-deprecated-find_package-CUDA-in-caffe2-CMake-m.patch +++ b/recipe/patches/0021-avoid-deprecated-find_package-CUDA-in-caffe2-CMake-m.patch @@ -1,4 +1,4 @@ -From 6ec9f719d4e0cc1f572fc334fbbfac89a3c2b7a9 Mon Sep 17 00:00:00 2001 +From 3bbff0ff28062788f8d05c5c24323de317911375 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Thu, 30 Jan 2025 08:33:44 +1100 Subject: [PATCH 21/21] avoid deprecated `find_package(CUDA)` in caffe2 CMake @@ -115,7 +115,7 @@ index cba4d929855..da904fc6a18 100644 if(TARGET torch::nvtoolsext) list(APPEND TORCH_CUDA_LIBRARIES torch::nvtoolsext) diff --git a/cmake/public/cuda.cmake b/cmake/public/cuda.cmake -index 152fbdbe6dd..50d37f4d6d0 100644 +index 152fbdbe6dd..0d1aeffc59f 100644 --- a/cmake/public/cuda.cmake +++ b/cmake/public/cuda.cmake @@ -26,8 +26,8 @@ if(NOT MSVC) @@ -208,7 +208,7 @@ index 152fbdbe6dd..50d37f4d6d0 100644 # find lbnvrtc.so -set(CUDA_NVRTC_LIB "${CUDA_nvrtc_LIBRARY}" CACHE FILEPATH "") -if(CUDA_NVRTC_LIB AND NOT CUDA_NVRTC_SHORTHASH) -+get_target_property(CUDA_NVRTC_LIB cuda::nvrtc INTERFACE_LINK_LIBRARIES) ++get_target_property(CUDA_NVRTC_LIB CUDA::nvrtc INTERFACE_LINK_LIBRARIES) +if(NOT CUDA_NVRTC_SHORTHASH) find_package(Python COMPONENTS Interpreter) execute_process( From 8591bb6f9cdb2d3a57d2a9728ac5c10b24500ca5 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Fri, 31 Jan 2025 08:38:01 +1100 Subject: [PATCH 12/12] add zlib --- recipe/meta.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 6d4907c3b..b6c307ab1 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -181,6 +181,7 @@ requirements: - typing_extensions - pybind11 - eigen + - zlib run: # GPU requirements without run_exports - {{ pin_compatible('cudnn') }} # [cuda_compiler_version != "None"]