Prep for 2.3 changeover

Signed-off-by: Tom Rix <trix@redhat.com>
This commit is contained in:
Tom Rix 2024-03-12 10:05:39 -04:00
commit dc89ef898a
24 changed files with 11 additions and 600 deletions

View file

@ -1,169 +0,0 @@
From 24cf0294a67d89ad70367940eea872162b44482c Mon Sep 17 00:00:00 2001
From: Tom Rix <trix@redhat.com>
Date: Sat, 23 Sep 2023 10:18:52 -0700
Subject: [PATCH] Prepare pytorch cmake for fedora
Use the system fmt
Remove foxi use
Remove warnings/errors for clang 17
fxdiv is not a library
build type is RelWithDebInfo
use system pthreadpool
Signed-off-by: Tom Rix <trix@redhat.com>
---
CMakeLists.txt | 6 +++---
.../native/quantized/cpu/qnnpack/CMakeLists.txt | 3 ---
c10/CMakeLists.txt | 2 +-
caffe2/CMakeLists.txt | 6 +-----
cmake/Dependencies.cmake | 16 +---------------
test/cpp/tensorexpr/CMakeLists.txt | 2 +-
torch/CMakeLists.txt | 2 +-
7 files changed, 8 insertions(+), 29 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3a48eaf4e2..902ee70fd1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -682,7 +682,7 @@ set(CAFFE2_ALLOWLIST "" CACHE STRING "A allowlist file of files that one should
# Set default build type
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "Build type not set - defaulting to Release")
- set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build from: Debug Release RelWithDebInfo MinSizeRel Coverage." FORCE)
+ set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build from: Debug Release RelWithDebInfo MinSizeRel Coverage." FORCE)
endif()
# The below means we are cross compiling for arm64 or x86_64 on MacOSX
@@ -917,8 +917,8 @@ if(NOT MSVC)
string(APPEND CMAKE_LINKER_FLAGS_DEBUG " -fno-omit-frame-pointer -O0")
append_cxx_flag_if_supported("-fno-math-errno" CMAKE_CXX_FLAGS)
append_cxx_flag_if_supported("-fno-trapping-math" CMAKE_CXX_FLAGS)
- append_cxx_flag_if_supported("-Werror=format" CMAKE_CXX_FLAGS)
- append_cxx_flag_if_supported("-Werror=cast-function-type" CMAKE_CXX_FLAGS)
+# append_cxx_flag_if_supported("-Werror=format" CMAKE_CXX_FLAGS)
+# append_cxx_flag_if_supported("-Werror=cast-function-type" CMAKE_CXX_FLAGS)
else()
# skip unwanted includes from windows.h
add_compile_definitions(WIN32_LEAN_AND_MEAN)
diff --git a/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt b/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt
index fd6b7ff551..218c8e9b2a 100644
--- a/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt
+++ b/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt
@@ -393,10 +393,7 @@ elseif(NOT TARGET fxdiv AND USE_SYSTEM_FXDIV)
if(NOT FXDIV_HDR)
message(FATAL_ERROR "Cannot find fxdiv")
endif()
- add_library(fxdiv STATIC "${FXDIV_HDR}")
- set_property(TARGET fxdiv PROPERTY LINKER_LANGUAGE C)
endif()
-target_link_libraries(pytorch_qnnpack PRIVATE fxdiv)
# ---[ Configure psimd
if(NOT TARGET psimd AND NOT USE_SYSTEM_PSIMD)
diff --git a/c10/CMakeLists.txt b/c10/CMakeLists.txt
index feebad7cbb..7c029cd88d 100644
--- a/c10/CMakeLists.txt
+++ b/c10/CMakeLists.txt
@@ -87,7 +87,7 @@ endif()
if(${USE_GLOG})
target_link_libraries(c10 PUBLIC glog::glog)
endif()
-target_link_libraries(c10 PRIVATE fmt::fmt-header-only)
+target_link_libraries(c10 PRIVATE fmt)
find_package(Backtrace)
if(Backtrace_FOUND)
diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt
index 74d0d55719..b975d388a7 100644
--- a/caffe2/CMakeLists.txt
+++ b/caffe2/CMakeLists.txt
@@ -107,7 +107,7 @@ endif()
# Note: the folders that are being commented out have not been properly
# addressed yet.
-if(NOT MSVC AND USE_XNNPACK)
+if(NOT MSVC AND USE_XNNPACK AND NOT USE_SYSTEM_FXDIV)
if(NOT TARGET fxdiv)
set(FXDIV_BUILD_TESTS OFF CACHE BOOL "")
set(FXDIV_BUILD_BENCHMARKS OFF CACHE BOOL "")
@@ -1022,10 +1022,6 @@ elseif(USE_CUDA)
endif()
endif()
-if(NOT MSVC AND USE_XNNPACK)
- TARGET_LINK_LIBRARIES(torch_cpu PRIVATE fxdiv)
-endif()
-
# ==========================================================
# formerly-libtorch flags
# ==========================================================
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
index c3abce52e4..21b40f3a88 100644
--- a/cmake/Dependencies.cmake
+++ b/cmake/Dependencies.cmake
@@ -1555,7 +1555,6 @@ if(CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO AND NOT INTERN_DISABLE_ONNX)
set_target_properties(onnx_proto PROPERTIES CXX_STANDARD 17)
endif()
endif()
- add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../third_party/foxi EXCLUDE_FROM_ALL)
add_definitions(-DONNX_NAMESPACE=${ONNX_NAMESPACE})
if(NOT USE_SYSTEM_ONNX)
@@ -1588,8 +1587,6 @@ if(CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO AND NOT INTERN_DISABLE_ONNX)
message("-- Found onnx: ${ONNX_LIBRARY} ${ONNX_PROTO_LIBRARY}")
list(APPEND Caffe2_DEPENDENCY_LIBS onnx_proto onnx)
endif()
- include_directories(${FOXI_INCLUDE_DIRS})
- list(APPEND Caffe2_DEPENDENCY_LIBS foxi_loader)
# Recover the build shared libs option.
set(BUILD_SHARED_LIBS ${TEMP_BUILD_SHARED_LIBS})
endif()
@@ -1834,18 +1831,7 @@ endif()
#
set(TEMP_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libs" FORCE)
-add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/fmt)
-
-# Disable compiler feature checks for `fmt`.
-#
-# CMake compiles a little program to check compiler features. Some of our build
-# configurations (notably the mobile build analyzer) will populate
-# CMAKE_CXX_FLAGS in ways that break feature checks. Since we already know
-# `fmt` is compatible with a superset of the compilers that PyTorch is, it
-# shouldn't be too bad to just disable the checks.
-set_target_properties(fmt-header-only PROPERTIES INTERFACE_COMPILE_FEATURES "")
-
-list(APPEND Caffe2_DEPENDENCY_LIBS fmt::fmt-header-only)
+list(APPEND Caffe2_DEPENDENCY_LIBS fmt)
set(BUILD_SHARED_LIBS ${TEMP_BUILD_SHARED_LIBS} CACHE BOOL "Build shared libs" FORCE)
# ---[ Kineto
diff --git a/test/cpp/tensorexpr/CMakeLists.txt b/test/cpp/tensorexpr/CMakeLists.txt
index 7dff70630d..90b1003591 100644
--- a/test/cpp/tensorexpr/CMakeLists.txt
+++ b/test/cpp/tensorexpr/CMakeLists.txt
@@ -54,7 +54,7 @@ target_include_directories(tutorial_tensorexpr PRIVATE ${ATen_CPU_INCLUDE})
# pthreadpool header. For some build environment we need add the dependency
# explicitly.
if(USE_PTHREADPOOL)
- target_link_libraries(test_tensorexpr PRIVATE pthreadpool_interface)
+ target_link_libraries(test_tensorexpr PRIVATE pthreadpool)
endif()
if(USE_CUDA)
target_link_libraries(test_tensorexpr PRIVATE
diff --git a/torch/CMakeLists.txt b/torch/CMakeLists.txt
index 62ee4c12a9..8d5375f320 100644
--- a/torch/CMakeLists.txt
+++ b/torch/CMakeLists.txt
@@ -84,7 +84,7 @@ set(TORCH_PYTHON_LINK_LIBRARIES
python::python
pybind::pybind11
shm
- fmt::fmt-header-only
+ fmt
ATEN_CPU_FILES_GEN_LIB)
if(USE_ASAN AND TARGET Sanitizer::address)
--
2.42.1

View file

@ -1,36 +0,0 @@
From 1d35a0b1f5cb39fd0c44a486157dc739a02c71b6 Mon Sep 17 00:00:00 2001
From: Tom Rix <trix@redhat.com>
Date: Wed, 20 Dec 2023 11:23:18 -0500
Subject: [PATCH] add rocm_version fallback
Signed-off-by: Tom Rix <trix@redhat.com>
---
torch/utils/hipify/cuda_to_hip_mappings.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/torch/utils/hipify/cuda_to_hip_mappings.py b/torch/utils/hipify/cuda_to_hip_mappings.py
index 73586440e7..9354057a39 100644
--- a/torch/utils/hipify/cuda_to_hip_mappings.py
+++ b/torch/utils/hipify/cuda_to_hip_mappings.py
@@ -57,6 +57,18 @@ if os.path.isfile(rocm_version_h):
if match:
patch = int(match.group(1))
rocm_version = (major, minor, patch)
+else:
+ try:
+ hip_version = subprocess.check_output(["hipconfig", "--version"]).decode("utf-8")
+ hip_split = hip_version.split('.')
+ rocm_version = (int(hip_split[0]), int(hip_split[1]), 0)
+ except subprocess.CalledProcessError:
+ print(f"Warning: hipconfig --version failed")
+ except (FileNotFoundError, PermissionError, NotADirectoryError):
+ # Do not print warning. This is okay. This file can also be imported for non-ROCm builds.
+ pass
+
+
# List of math functions that should be replaced inside device code only.
MATH_TRANSPILATIONS = collections.OrderedDict(
--
2.43.0

View file

@ -1,28 +0,0 @@
From 06499575b177a218846f0e43ff4bc77d245f207f Mon Sep 17 00:00:00 2001
From: Tom Rix <trix@redhat.com>
Date: Fri, 1 Dec 2023 09:38:05 -0500
Subject: [PATCH] disable as-needed for libtorch
Signed-off-by: Tom Rix <trix@redhat.com>
---
caffe2/CMakeLists.txt | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt
index b975d388a7..5e9fd3b3f3 100644
--- a/caffe2/CMakeLists.txt
+++ b/caffe2/CMakeLists.txt
@@ -914,6 +914,10 @@ if(HAVE_SOVERSION)
VERSION ${TORCH_VERSION} SOVERSION ${TORCH_SOVERSION})
endif()
+# Disable global as-needed
+set_target_properties(torch PROPERTIES LINK_FLAGS -Wl,--no-as-needed)
+
+
if(USE_ROCM)
filter_list(__caffe2_hip_srcs_cpp Caffe2_HIP_SRCS "\\.(cu|hip)$")
set_source_files_properties(${__caffe2_hip_srcs_cpp} PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1)
--
2.42.1

View file

@ -1,27 +0,0 @@
From cef92207b79ad53e3fcc1b0e22ba91cb9422968c Mon Sep 17 00:00:00 2001
From: Tom Rix <trix@redhat.com>
Date: Sat, 18 Nov 2023 09:38:52 -0500
Subject: [PATCH] python-torch link with python
Signed-off-by: Tom Rix <trix@redhat.com>
---
torch/CMakeLists.txt | 3 +++
1 file changed, 3 insertions(+)
diff --git a/torch/CMakeLists.txt b/torch/CMakeLists.txt
index 8d5375f320..6f8c7b65c4 100644
--- a/torch/CMakeLists.txt
+++ b/torch/CMakeLists.txt
@@ -312,6 +312,9 @@ add_dependencies(torch_python torch_python_stubs)
add_dependencies(torch_python flatbuffers)
+# Unresolved syms in -lpython
+target_link_libraries(torch_python PUBLIC ${PYTHON_LIBRARIES})
+
if(USE_PRECOMPILED_HEADERS)
target_precompile_headers(torch_python PRIVATE
"$<$<COMPILE_LANGUAGE:CXX>:ATen/ATen.h>")
--
2.42.1

View file

@ -1,33 +0,0 @@
From f70ef37d0b3c780fd17be199e66a81ffa679f93e Mon Sep 17 00:00:00 2001
From: Tom Rix <trix@redhat.com>
Date: Sat, 18 Nov 2023 12:05:43 -0500
Subject: [PATCH] python-torch remove ubuntu specific linking
Signed-off-by: Tom Rix <trix@redhat.com>
---
CMakeLists.txt | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 86c34984b2..f7c4a7b05f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -479,9 +479,12 @@ option(BUILD_EXECUTORCH "Master flag to build Executorch" ON)
# This is a fix for a rare build issue on Ubuntu:
# symbol lookup error: miniconda3/envs/pytorch-py3.7/lib/libmkl_intel_lp64.so: undefined symbol: mkl_blas_dsyrk
# https://software.intel.com/en-us/articles/symbol-lookup-error-when-linking-intel-mkl-with-gcc-on-ubuntu
-if(LINUX)
- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-as-needed")
-endif()
+
+# This is not ubuntu!
+# if(LINUX)
+# set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-as-needed")
+# endif()
+set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--as-needed")
if(MSVC)
set(CMAKE_NINJA_CMCLDEPS_RC OFF)
--
2.42.1

View file

@ -1,26 +0,0 @@
From 527d1ce24a06a14788ca5fc2411985d7c1cb2923 Mon Sep 17 00:00:00 2001
From: Tom Rix <trix@redhat.com>
Date: Fri, 13 Oct 2023 05:35:19 -0700
Subject: [PATCH] pytorch use SO version by default
Signed-off-by: Tom Rix <trix@redhat.com>
---
CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 902ee70fd1..86c34984b2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -340,7 +340,7 @@ option(USE_TBB "Use TBB (Deprecated)" OFF)
cmake_dependent_option(
USE_SYSTEM_TBB "Use system-provided Intel TBB." OFF "USE_TBB" OFF)
option(ONNX_ML "Enable traditional ONNX ML API." ON)
-option(HAVE_SOVERSION "Whether to add SOVERSION to the shared objects" OFF)
+option(HAVE_SOVERSION "Whether to add SOVERSION to the shared objects" ON)
option(BUILD_LIBTORCH_CPU_WITH_DEBUG "Enable RelWithDebInfo for libtorch_cpu target only" OFF)
cmake_dependent_option(USE_CCACHE "Attempt using CCache to wrap the compilation" ON "UNIX" OFF)
option(WERROR "Build with -Werror supported by the compiler" OFF)
--
2.42.1

View file

@ -1,32 +0,0 @@
From c47c6e202d60ccac15aa36698bd4788415a9416b Mon Sep 17 00:00:00 2001
From: Tom Rix <trix@redhat.com>
Date: Sat, 25 Nov 2023 16:46:17 -0500
Subject: [PATCH] torch sane version
---
tools/generate_torch_version.py | 1 +
version.txt | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/generate_torch_version.py b/tools/generate_torch_version.py
index d90d3646ab..11d5bbeba5 100644
--- a/tools/generate_torch_version.py
+++ b/tools/generate_torch_version.py
@@ -42,6 +42,7 @@ def get_tag(pytorch_root: Union[str, Path]) -> str:
def get_torch_version(sha: Optional[str] = None) -> str:
pytorch_root = Path(__file__).parent.parent
version = open(pytorch_root / "version.txt").read().strip()
+ return version
if os.getenv("PYTORCH_BUILD_VERSION"):
assert os.getenv("PYTORCH_BUILD_NUMBER") is not None
diff --git a/version.txt b/version.txt
index ecaf4eea7c..7ec1d6db40 100644
--- a/version.txt
+++ b/version.txt
@@ -1,1 +1,1 @@
-2.1.0a0
+2.1.2
--
2.42.1

View file

@ -1,39 +0,0 @@
From 587a8b10bd3f7a68275356ee6eb6bb43ed711ba2 Mon Sep 17 00:00:00 2001
From: Tom Rix <trix@redhat.com>
Date: Fri, 29 Sep 2023 06:19:29 -0700
Subject: [PATCH 2/6] Regenerate flatbuffer header
For this error
torch/csrc/jit/serialization/mobile_bytecode_generated.h:12:41:
error: static assertion failed: Non-compatible flatbuffers version included
12 | FLATBUFFERS_VERSION_MINOR == 3 &&
PyTorch is expecting 23.3.3, what f38 has
Rawhide is at 23.5.26
Regenerate with
flatc --cpp --gen-mutable --no-prefix --scoped-enums mobile_bytecode.fbs
Signed-off-by: Tom Rix <trix@redhat.com>
---
torch/csrc/jit/serialization/mobile_bytecode_generated.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/torch/csrc/jit/serialization/mobile_bytecode_generated.h b/torch/csrc/jit/serialization/mobile_bytecode_generated.h
index cffe8bc7a6..83575e4c19 100644
--- a/torch/csrc/jit/serialization/mobile_bytecode_generated.h
+++ b/torch/csrc/jit/serialization/mobile_bytecode_generated.h
@@ -9,8 +9,8 @@
// Ensure the included flatbuffers.h is the same version as when this file was
// generated, otherwise it may not be compatible.
static_assert(FLATBUFFERS_VERSION_MAJOR == 23 &&
- FLATBUFFERS_VERSION_MINOR == 3 &&
- FLATBUFFERS_VERSION_REVISION == 3,
+ FLATBUFFERS_VERSION_MINOR == 5 &&
+ FLATBUFFERS_VERSION_REVISION == 26,
"Non-compatible flatbuffers version included");
namespace torch {
--
2.41.0

View file

@ -1,73 +0,0 @@
From bb52aeacc6dfab2355249b7b5beb72c2761ec319 Mon Sep 17 00:00:00 2001
From: Tom Rix <trix@redhat.com>
Date: Fri, 29 Sep 2023 06:25:23 -0700
Subject: [PATCH 3/6] Stub in kineto ActivityType
There is an error with kineto is not used, the shim still
requires the ActivityTYpe.h header to get the enum Activity type.
So cut-n-paste just enough of the header in to do this.
Signed-off-by: Tom Rix <trix@redhat.com>
---
torch/csrc/profiler/kineto_shim.h | 44 +++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/torch/csrc/profiler/kineto_shim.h b/torch/csrc/profiler/kineto_shim.h
index 2a410719a1..7d6525befd 100644
--- a/torch/csrc/profiler/kineto_shim.h
+++ b/torch/csrc/profiler/kineto_shim.h
@@ -12,7 +12,51 @@
#undef USE_KINETO
#endif
+#ifdef USE_KINETO
#include <ActivityType.h>
+#else
+namespace libkineto {
+// copied from header
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+// Note : All activity types are not enabled by default. Please add them
+// at correct position in the enum
+enum class ActivityType {
+ // Activity types enabled by default
+ CPU_OP = 0, // cpu side ops
+ USER_ANNOTATION,
+ GPU_USER_ANNOTATION,
+ GPU_MEMCPY,
+ GPU_MEMSET,
+ CONCURRENT_KERNEL, // on-device kernels
+ EXTERNAL_CORRELATION,
+ CUDA_RUNTIME, // host side cuda runtime events
+ CUDA_DRIVER, // host side cuda driver events
+ CPU_INSTANT_EVENT, // host side point-like events
+ PYTHON_FUNCTION,
+ OVERHEAD, // CUPTI induced overhead events sampled from its overhead API.
+
+ // Optional Activity types
+ CUDA_SYNC, // synchronization events between runtime and kernels
+ GLOW_RUNTIME, // host side glow runtime events
+ MTIA_RUNTIME, // host side MTIA runtime events
+ CUDA_PROFILER_RANGE, // CUPTI Profiler range for performance metrics
+ MTIA_CCP_EVENTS, // MTIA ondevice CCP events
+ HPU_OP, // HPU host side runtime event
+ XPU_RUNTIME, // host side xpu runtime events
+
+ ENUM_COUNT, // This is to add buffer and not used for any profiling logic. Add your new type before it.
+ OPTIONAL_ACTIVITY_TYPE_START = CUDA_SYNC,
+};
+}
+
+#endif
#include <torch/csrc/Export.h>
#include <torch/csrc/profiler/api.h>
--
2.41.0

View file

@ -1,45 +0,0 @@
From fcf3cd70229cdc729d05ddab081ac886c9db6bd7 Mon Sep 17 00:00:00 2001
From: Tom Rix <trix@redhat.com>
Date: Fri, 29 Sep 2023 13:58:28 -0700
Subject: [PATCH] torch python 3.12 changes
Signed-off-by: Tom Rix <trix@redhat.com>
---
functorch/csrc/dim/dim.cpp | 6 ++++++
torch/csrc/dynamo/cpython_defs.h | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/functorch/csrc/dim/dim.cpp b/functorch/csrc/dim/dim.cpp
index b611dc3e8c2..c7009478aee 100644
--- a/functorch/csrc/dim/dim.cpp
+++ b/functorch/csrc/dim/dim.cpp
@@ -10,7 +10,13 @@
// Many APIs have changed/don't exist anymore
#if IS_PYTHON_3_12_PLUS
+#include "dim.h"
+
// Re-enable this some day
+PyObject* Dim_init() {
+ PyErr_SetString(PyExc_RuntimeError, "First class dim doesn't work with python 3.12");
+ return nullptr;
+}
#else
diff --git a/torch/csrc/dynamo/cpython_defs.h b/torch/csrc/dynamo/cpython_defs.h
index f0a0e1a88e2..f58becd246e 100644
--- a/torch/csrc/dynamo/cpython_defs.h
+++ b/torch/csrc/dynamo/cpython_defs.h
@@ -6,7 +6,7 @@
// should go in cpython_defs.c. Copying is required when, e.g.,
// we need to call internal CPython functions that are not exposed.
-#if IS_PYTHON_3_11_PLUS && !(IS_PYTHON_3_12_PLUS)
+#if IS_PYTHON_3_11_PLUS
#include <internal/pycore_frame.h>
--
2.43.0

View file

@ -1,25 +0,0 @@
From fc0d4ce06fecbd2bcd10fb13c515dc6625260870 Mon Sep 17 00:00:00 2001
From: Tom Rix <trix@redhat.com>
Date: Fri, 29 Sep 2023 17:21:13 -0700
Subject: [PATCH 5/6] disable submodule search
---
setup.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.py b/setup.py
index 17bf16b89a..b8c8ae5506 100644
--- a/setup.py
+++ b/setup.py
@@ -452,7 +452,7 @@ def mirror_files_into_torchgen():
def build_deps():
report("-- Building version " + version)
- check_submodules()
+ # check_submodules()
check_pydep("yaml", "pyyaml")
build_caffe2(
--
2.41.0

View file

@ -4,17 +4,17 @@
%global forgeurl https://github.com/pytorch/pytorch
# So pre releases can be tried
%bcond_without gitcommit
%bcond_with gitcommit
%if %{with gitcommit}
# The top of tree ~3/7/24
%global commit0 975d4284250170602db60adfda5eb1664a3b8acc
%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
%global pypi_version 2.3.0
%global date0 20240307
%else
%global pypi_version 2.1.2
%global commit0 975d4284250170602db60adfda5eb1664a3b8acc
%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
%global date0 20240307
%endif
%global pypi_version 2.3.0
# For -test subpackage
# suitable only for local testing
@ -37,9 +37,6 @@
%global rocm_default_gpu default
%bcond_without rocm_loop
# For testing openmp
%bcond_without openmp
%bcond_with foxi
# For testing caffe2
%if 0%{?fedora}
@ -62,7 +59,7 @@
%endif
Name: python-%{pypi_name}
Version: %{pypi_version}
Version: %{pypi_version}^git%{date0}.%{shortcommit0}
Release: %autorelease
Summary: PyTorch AI/ML framework
# See license.txt for license details
@ -73,7 +70,8 @@ URL: https://pytorch.org/
Source0: %{forgeurl}/archive/%{commit0}/pytorch-%{shortcommit0}.tar.gz
Source100: pyproject.toml
%else
Source0: %{forgeurl}/releases/download/v%{version}/pytorch-v%{version}.tar.gz
Source0: %{forgeurl}/archive/%{commit0}/pytorch-%{shortcommit0}.tar.gz
Source100: pyproject.toml
%endif
Source1: https://github.com/google/flatbuffers/archive/refs/tags/v23.3.3.tar.gz
Source2: https://github.com/pybind/pybind11/archive/refs/tags/v2.11.1.tar.gz
@ -85,8 +83,6 @@ Source10: https://github.com/NVIDIA/cudnn-frontend/archive/refs/tags/v%{cu
Source11: https://github.com/NVIDIA/cutlass/archive/refs/tags/v%{cul_ver}.tar.gz
%endif
%if %{with gitcommit}
Patch0: 0001-no-third_party-foxi.patch
Patch1: 0001-no-third_party-fmt.patch
Patch2: 0001-no-third_party-FXdiv.patch
@ -104,37 +100,6 @@ Patch101: 0001-cuda-hip-signatures.patch
Patch102: 0001-silence-an-assert.patch
Patch103: 0001-can-not-use-with-c-files.patch
Patch104: 0001-use-any-hip.patch
%endif
%else
# Misc cmake changes that would be difficult to upstream
# * Use the system fmt
# * Remove foxi use
# * Remove warnings/errors for clang 17
# * fxdiv is not a library on Fedora
Patch0: 0001-Prepare-pytorch-cmake-for-fedora.patch
# https://github.com/pytorch/pytorch/pull/111048
Patch2: 0003-Stub-in-kineto-ActivityType.patch
# PyTorch has not fully baked 3.12 support because 3.12 is so new
Patch3: 0004-torch-python-3.12-changes.patch
# Short circuit looking for things that can not be downloade by mock
Patch4: 0005-disable-submodule-search.patch
# libtorch_python.so: undefined symbols: Py*
Patch6: 0001-python-torch-link-with-python.patch
# E: unused-direct-shlib-dependency libshm.so.2.1.0 libtorch.so.2.1
# turn on as-needed globally
Patch7: 0001-python-torch-remove-ubuntu-specific-linking.patch
# Tries to use git and is confused by tarball
Patch8: 0001-torch-sane-version.patch
# libtorch is a wrapper so turn off as-needed locally
# resolves this rpmlint
# E: shared-library-without-dependency-information libtorch.so.2.1.0
# causes these
# E: unused-direct-shlib-dependency libtorch.so.2.1.0 libtorch_cpu.so.2.1
# etc.
# As a wrapper library, this should be the expected behavior.
Patch9: 0001-disable-as-needed-for-libtorch.patch
%endif
# Limit to these because they are well behaved with clang
@ -159,6 +124,7 @@ BuildRequires: gloo-devel
%endif
BuildRequires: ninja-build
BuildRequires: onnx-devel
BuildRequires: libomp-devel
BuildRequires: openblas-devel
BuildRequires: pocketfft-devel
BuildRequires: protobuf-devel
@ -169,11 +135,7 @@ BuildRequires: python3-pyyaml
BuildRequires: python3-typing-extensions
BuildRequires: sleef-devel
BuildRequires: valgrind-devel
%if %{with gitcommit}
BuildRequires: xnnpack-devel = 0.0^git20240229.fcbf55a
%else
BuildRequires: xnnpack-devel = 0.0^git20221221.51a9875
%endif
BuildRequires: python3-devel
BuildRequires: python3dist(filelock)
@ -189,12 +151,7 @@ BuildRequires: python3dist(fsspec)
BuildRequires: python3dist(sympy)
%endif
%if %{with openmp}
BuildRequires: libomp-devel
%endif
%if %{with rocm}
BuildRequires: compiler-rt
BuildRequires: hipblas-devel
%if %{with hipblaslt}
BuildRequires: hipblaslt-devel
@ -204,7 +161,6 @@ BuildRequires: hipfft-devel
BuildRequires: hiprand-devel
BuildRequires: hipsparse-devel
BuildRequires: hipsolver-devel
BuildRequires: lld
BuildRequires: miopen-devel
BuildRequires: rocblas-devel
BuildRequires: rocrand-devel
@ -291,7 +247,6 @@ Requires: python3-%{pypi_name}%{?_isa} = %{version}-%{release}
%prep
%if %{with gitcommit}
%autosetup -p1 -n pytorch-%{commit0}
# Remove bundled egg-info
@ -299,11 +254,6 @@ rm -rf %{pypi_name}.egg-info
# Overwrite with a git checkout of the pyproject.toml
cp %{SOURCE100} .
%else
%autosetup -p1 -n pytorch-v%{version}
%endif
tar xf %{SOURCE1}
cp -r flatbuffers-23.3.3/* third_party/flatbuffers/
@ -462,7 +412,7 @@ export USE_MKLDNN=OFF
export USE_NCCL=OFF
export USE_NNPACK=OFF
export USE_NUMPY=ON
export USE_OPENMP=OFF
export USE_OPENMP=ON
export USE_PYTORCH_QNNPACK=OFF
export USE_QNNPACK=OFF
export USE_ROCM=OFF
@ -496,10 +446,6 @@ export USE_CUDA=ON
export USE_DISTRIBUTED=ON
%endif
%if %{with openmp}
export USE_OPENMP=ON
%endif
%if %{with test}
export BUILD_TEST=ON
%endif
@ -602,8 +548,6 @@ done
%{_libdir}/rocm/gfx*/lib64/*
%endif
%changelog
%autochangelog