mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Revert "Update pybind11 submodule to 3.0.1 (#160754)"
This reverts commit 660b0b8128.
Reverted https://github.com/pytorch/pytorch/pull/160754 on behalf of https://github.com/atalman due to please see https://github.com/pytorch/pytorch/pull/160754#issuecomment-3226051449 ([comment](https://github.com/pytorch/pytorch/pull/160754#issuecomment-3226078102))
This commit is contained in:
parent
1ce423274d
commit
1b34e04485
|
|
@ -57,7 +57,7 @@ if [ ! -f setup.py ]; then
|
||||||
cd python
|
cd python
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pip_install pybind11==3.0.1
|
pip_install pybind11==2.13.6
|
||||||
|
|
||||||
# TODO: remove patch setup.py once we have a proper fix for https://github.com/triton-lang/triton/issues/4527
|
# TODO: remove patch setup.py once we have a proper fix for https://github.com/triton-lang/triton/issues/4527
|
||||||
as_jenkins sed -i -e 's/https:\/\/tritonlang.blob.core.windows.net\/llvm-builds/https:\/\/oaitriton.blob.core.windows.net\/public\/llvm-builds/g' setup.py
|
as_jenkins sed -i -e 's/https:\/\/tritonlang.blob.core.windows.net\/llvm-builds/https:\/\/oaitriton.blob.core.windows.net\/public\/llvm-builds/g' setup.py
|
||||||
|
|
|
||||||
|
|
@ -300,3 +300,24 @@ except RuntimeError as e:
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Check for C++ ABI compatibility to GCC-11 - GCC 13
|
||||||
|
###############################################################################
|
||||||
|
if [[ "$(uname)" == 'Linux' && "$PACKAGE_TYPE" == 'manywheel' ]]; then
|
||||||
|
pushd /tmp
|
||||||
|
# Per https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html
|
||||||
|
# gcc-11 is ABI16, gcc-13 is ABI18, gcc-14 is ABI19
|
||||||
|
# gcc 11 - CUDA 11.8, xpu, rocm
|
||||||
|
# gcc 13 - CUDA 12.6, 12.8 and cpu
|
||||||
|
# Please see issue for reference: https://github.com/pytorch/pytorch/issues/152426
|
||||||
|
if [[ "$(uname -m)" == "s390x" ]]; then
|
||||||
|
cxx_abi="19"
|
||||||
|
elif [[ "$DESIRED_CUDA" != 'xpu' && "$DESIRED_CUDA" != 'rocm'* ]]; then
|
||||||
|
cxx_abi="18"
|
||||||
|
else
|
||||||
|
cxx_abi="16"
|
||||||
|
fi
|
||||||
|
python -c "import torch; exit(0 if torch._C._PYBIND11_BUILD_ABI == '_cxxabi10${cxx_abi}' else 1)"
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
|
|
||||||
2
.github/workflows/build-triton-wheel.yml
vendored
2
.github/workflows/build-triton-wheel.yml
vendored
|
|
@ -145,7 +145,7 @@ jobs:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker exec -t "${container_name}" yum install -y zlib-devel zip
|
docker exec -t "${container_name}" yum install -y zlib-devel zip
|
||||||
docker exec -t "${container_name}" "${PYTHON_EXECUTABLE}" -m pip install -U setuptools==78.1.0 pybind11==3.0.1 auditwheel wheel
|
docker exec -t "${container_name}" "${PYTHON_EXECUTABLE}" -m pip install -U setuptools==78.1.0 pybind11==2.13.1 auditwheel wheel
|
||||||
set +e
|
set +e
|
||||||
docker exec -t "${container_name}" command -v pip
|
docker exec -t "${container_name}" command -v pip
|
||||||
has_pip=$?
|
has_pip=$?
|
||||||
|
|
|
||||||
2
.github/workflows/test-check-binary.yml
vendored
2
.github/workflows/test-check-binary.yml
vendored
|
|
@ -30,7 +30,7 @@ jobs:
|
||||||
name: Test check_binary.sh for Linux CUDA
|
name: Test check_binary.sh for Linux CUDA
|
||||||
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
|
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
|
||||||
with:
|
with:
|
||||||
runner: linux.g4dn.4xlarge.nvidia.gpu
|
runner: linux.4xlarge.nvidia.gpu
|
||||||
docker-image: python:3.11
|
docker-image: python:3.11
|
||||||
docker-build-dir: "skip-docker-build"
|
docker-build-dir: "skip-docker-build"
|
||||||
script: |
|
script: |
|
||||||
|
|
|
||||||
|
|
@ -519,13 +519,6 @@ Attempted to call function marked as skipped
|
||||||
first_graph_break = next(iter(counters["graph_break"].keys()))
|
first_graph_break = next(iter(counters["graph_break"].keys()))
|
||||||
|
|
||||||
first_graph_break = re.sub(r"mylib(_v\d+)?", "mylib", first_graph_break)
|
first_graph_break = re.sub(r"mylib(_v\d+)?", "mylib", first_graph_break)
|
||||||
# HACK: this patches around the fact that PyBind11 improperly sets the
|
|
||||||
# __qualname__ attribute on functions and methods; see
|
|
||||||
# https://github.com/pybind/pybind11/issues/5774. This should be removed if
|
|
||||||
# that issue is fixed.
|
|
||||||
first_graph_break = re.sub(
|
|
||||||
r"pybind11_detail_function_record_v[^ .]+", "PyCapsule", first_graph_break
|
|
||||||
)
|
|
||||||
|
|
||||||
self.assertExpectedInline(
|
self.assertExpectedInline(
|
||||||
first_graph_break,
|
first_graph_break,
|
||||||
|
|
|
||||||
|
|
@ -191,16 +191,6 @@ class ProfilerTree:
|
||||||
name,
|
name,
|
||||||
)
|
)
|
||||||
|
|
||||||
# HACK: this patches around the fact that PyBind11 improperly sets the
|
|
||||||
# __qualname__ attribute on functions and methods; see
|
|
||||||
# https://github.com/pybind/pybind11/issues/5774. This should be removed if
|
|
||||||
# that issue is fixed.
|
|
||||||
name = re.sub(
|
|
||||||
r"pybind11_builtins\.pybind11_detail_function_record_v[^ .]+",
|
|
||||||
"PyCapsule",
|
|
||||||
name,
|
|
||||||
)
|
|
||||||
|
|
||||||
return re.sub("object at 0x[0-9a-fA-F]+>", "object at 0xXXXXXXXXXXXX>", name)
|
return re.sub("object at 0x[0-9a-fA-F]+>", "object at 0xXXXXXXXXXXXX>", name)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
|
||||||
2
third_party/pybind11
vendored
2
third_party/pybind11
vendored
|
|
@ -1 +1 @@
|
||||||
Subproject commit f5fbe867d2d26e4a0a9177a51f6e568868ad3dc8
|
Subproject commit a2e59f0e7065404b44dfe92a28aca47ba1378dc4
|
||||||
|
|
@ -1362,7 +1362,7 @@ static PyObject* THPModule_qEngine(PyObject* _unused, PyObject* noargs) {
|
||||||
static PyObject* THPModule_supportedQEngines(
|
static PyObject* THPModule_supportedQEngines(
|
||||||
PyObject* _unused,
|
PyObject* _unused,
|
||||||
PyObject* noargs) {
|
PyObject* noargs) {
|
||||||
const auto& qengines = at::globalContext().supportedQEngines();
|
auto qengines = at::globalContext().supportedQEngines();
|
||||||
auto list =
|
auto list =
|
||||||
THPObjectPtr(PyList_New(static_cast<Py_ssize_t>(qengines.size())));
|
THPObjectPtr(PyList_New(static_cast<Py_ssize_t>(qengines.size())));
|
||||||
if (!list)
|
if (!list)
|
||||||
|
|
@ -2473,16 +2473,13 @@ Call this whenever a new thread is created in order to propagate values from
|
||||||
});
|
});
|
||||||
|
|
||||||
py_module.def(
|
py_module.def(
|
||||||
"_get_fp32_precision_getter",
|
"_get_fp32_precision_getter", [](std::string backend, std::string op) {
|
||||||
[](const std::string& backend, const std::string& op) {
|
|
||||||
return at::globalContext().float32Precision(backend, op);
|
return at::globalContext().float32Precision(backend, op);
|
||||||
});
|
});
|
||||||
|
|
||||||
py_module.def(
|
py_module.def(
|
||||||
"_set_fp32_precision_setter",
|
"_set_fp32_precision_setter",
|
||||||
[](const std::string& backend,
|
[](std::string backend, std::string op, std::string precision) {
|
||||||
const std::string& op,
|
|
||||||
const std::string& precision) {
|
|
||||||
at::globalContext().setFloat32Precision(backend, op, precision);
|
at::globalContext().setFloat32Precision(backend, op, precision);
|
||||||
return precision;
|
return precision;
|
||||||
});
|
});
|
||||||
|
|
@ -2604,6 +2601,30 @@ Call this whenever a new thread is created in order to propagate values from
|
||||||
|
|
||||||
ASSERT_TRUE(set_module_attr("_GLIBCXX_USE_CXX11_ABI", Py_True));
|
ASSERT_TRUE(set_module_attr("_GLIBCXX_USE_CXX11_ABI", Py_True));
|
||||||
|
|
||||||
|
// See note [Pybind11 ABI constants]
|
||||||
|
#define SET_STR_DEFINE(name) \
|
||||||
|
ASSERT_TRUE(set_module_attr("_" #name, THPUtils_packString(name)))
|
||||||
|
|
||||||
|
#ifdef PYBIND11_COMPILER_TYPE
|
||||||
|
SET_STR_DEFINE(PYBIND11_COMPILER_TYPE);
|
||||||
|
#else
|
||||||
|
ASSERT_TRUE(
|
||||||
|
set_module_attr("_" C10_STRINGIZE(PYBIND11_COMPILER_TYPE), Py_None));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PYBIND11_STDLIB
|
||||||
|
SET_STR_DEFINE(PYBIND11_STDLIB);
|
||||||
|
#else
|
||||||
|
ASSERT_TRUE(set_module_attr("_" C10_STRINGIZE(PYBIND11_STDLIB), Py_None));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PYBIND11_BUILD_ABI
|
||||||
|
SET_STR_DEFINE(PYBIND11_BUILD_ABI);
|
||||||
|
#else
|
||||||
|
ASSERT_TRUE(set_module_attr("_" C10_STRINGIZE(PYBIND11_BUILD_ABI), Py_None));
|
||||||
|
#endif
|
||||||
|
#undef SET_STR_DEFINE
|
||||||
|
|
||||||
py_module.def(
|
py_module.def(
|
||||||
"_set_conj", [](const at::Tensor& x, bool conj) { x._set_conj(conj); });
|
"_set_conj", [](const at::Tensor& x, bool conj) { x._set_conj(conj); });
|
||||||
py_module.def(
|
py_module.def(
|
||||||
|
|
|
||||||
|
|
@ -689,6 +689,15 @@ class BuildExtension(build_ext):
|
||||||
# min supported CPython version.
|
# min supported CPython version.
|
||||||
# See https://docs.python.org/3/c-api/stable.html#c.Py_LIMITED_API
|
# See https://docs.python.org/3/c-api/stable.html#c.Py_LIMITED_API
|
||||||
self._add_compile_flag(extension, f'-DPy_LIMITED_API={min_supported_cpython}')
|
self._add_compile_flag(extension, f'-DPy_LIMITED_API={min_supported_cpython}')
|
||||||
|
else:
|
||||||
|
# pybind11 is not CPython API stable so don't add these flags used when
|
||||||
|
# compiling pybind11 when pybind11 is not even used. otherwise, the build
|
||||||
|
# logs are confusing.
|
||||||
|
# See note [Pybind11 ABI constants]
|
||||||
|
for name in ["COMPILER_TYPE", "STDLIB", "BUILD_ABI"]:
|
||||||
|
val = getattr(torch._C, f"_PYBIND11_{name}")
|
||||||
|
if val is not None and not IS_WINDOWS:
|
||||||
|
self._add_compile_flag(extension, f'-DPYBIND11_{name}="{val}"')
|
||||||
self._define_torch_extension_name(extension)
|
self._define_torch_extension_name(extension)
|
||||||
|
|
||||||
if 'nvcc_dlink' in extension.extra_compile_args:
|
if 'nvcc_dlink' in extension.extra_compile_args:
|
||||||
|
|
@ -1705,6 +1714,25 @@ def load(name,
|
||||||
is_standalone,
|
is_standalone,
|
||||||
keep_intermediates=keep_intermediates)
|
keep_intermediates=keep_intermediates)
|
||||||
|
|
||||||
|
def _get_pybind11_abi_build_flags():
|
||||||
|
# Note [Pybind11 ABI constants]
|
||||||
|
#
|
||||||
|
# Pybind11 before 2.4 used to build an ABI strings using the following pattern:
|
||||||
|
# f"__pybind11_internals_v{PYBIND11_INTERNALS_VERSION}{PYBIND11_INTERNALS_KIND}{PYBIND11_BUILD_TYPE}__"
|
||||||
|
# Since 2.4 compier type, stdlib and build abi parameters are also encoded like this:
|
||||||
|
# f"__pybind11_internals_v{PYBIND11_INTERNALS_VERSION}{PYBIND11_INTERNALS_KIND}{PYBIND11_COMPILER_TYPE}{PYBIND11_STDLIB}{PYBIND11_BUILD_ABI}{PYBIND11_BUILD_TYPE}__"
|
||||||
|
#
|
||||||
|
# This was done in order to further narrow down the chances of compiler ABI incompatibility
|
||||||
|
# that can cause a hard to debug segfaults.
|
||||||
|
# For PyTorch extensions we want to relax those restrictions and pass compiler, stdlib and abi properties
|
||||||
|
# captured during PyTorch native library compilation in torch/csrc/Module.cpp
|
||||||
|
|
||||||
|
abi_cflags = []
|
||||||
|
for pname in ["COMPILER_TYPE", "STDLIB", "BUILD_ABI"]:
|
||||||
|
pval = getattr(torch._C, f"_PYBIND11_{pname}")
|
||||||
|
if pval is not None and not IS_WINDOWS:
|
||||||
|
abi_cflags.append(f'-DPYBIND11_{pname}=\\"{pval}\\"')
|
||||||
|
return abi_cflags
|
||||||
|
|
||||||
def check_compiler_is_gcc(compiler):
|
def check_compiler_is_gcc(compiler):
|
||||||
if not IS_LINUX:
|
if not IS_LINUX:
|
||||||
|
|
@ -1835,6 +1863,7 @@ def _check_and_build_extension_h_precompiler_headers(
|
||||||
common_cflags += ['-DTORCH_API_INCLUDE_EXTENSION_H']
|
common_cflags += ['-DTORCH_API_INCLUDE_EXTENSION_H']
|
||||||
|
|
||||||
common_cflags += ['-std=c++17', '-fPIC']
|
common_cflags += ['-std=c++17', '-fPIC']
|
||||||
|
common_cflags += [f"{x}" for x in _get_pybind11_abi_build_flags()]
|
||||||
common_cflags_str = listToString(common_cflags)
|
common_cflags_str = listToString(common_cflags)
|
||||||
|
|
||||||
pch_cmd = format_precompiler_header_cmd(compiler, head_file, head_file_pch, common_cflags_str, torch_include_dirs_str, extra_cflags_str, extra_include_paths_str)
|
pch_cmd = format_precompiler_header_cmd(compiler, head_file, head_file_pch, common_cflags_str, torch_include_dirs_str, extra_cflags_str, extra_include_paths_str)
|
||||||
|
|
@ -2669,6 +2698,8 @@ def _write_ninja_file_to_build_library(path,
|
||||||
common_cflags.append(f'-DTORCH_EXTENSION_NAME={name}')
|
common_cflags.append(f'-DTORCH_EXTENSION_NAME={name}')
|
||||||
common_cflags.append('-DTORCH_API_INCLUDE_EXTENSION_H')
|
common_cflags.append('-DTORCH_API_INCLUDE_EXTENSION_H')
|
||||||
|
|
||||||
|
common_cflags += [f"{x}" for x in _get_pybind11_abi_build_flags()]
|
||||||
|
|
||||||
# Windows does not understand `-isystem` and quotes flags later.
|
# Windows does not understand `-isystem` and quotes flags later.
|
||||||
if IS_WINDOWS:
|
if IS_WINDOWS:
|
||||||
common_cflags += [f'-I{include}' for include in user_includes + system_includes]
|
common_cflags += [f'-I{include}' for include in user_includes + system_includes]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user