Update pybind11 submodule to 3.0.1 (#160754)

Upgrade to PyBind11 v3. This allows us to strip out our own (possibly broken?) handling of the C++ ABI when building extensions, in favor of the more-complete PyBind11 internal handling.

Fixes a few test failures due to https://github.com/pybind/pybind11/issues/5774, which effectively makes the `__qualname__` attribute of functions platform-dependent.

Test plan: CI

Pull Request resolved: https://github.com/pytorch/pytorch/pull/160754
Approved by: https://github.com/Skylion007
This commit is contained in:
Benjamin Glass
2025-08-25 19:41:26 +00:00
committed by PyTorch MergeBot
parent 089ad1d88b
commit 660b0b8128
9 changed files with 27 additions and 83 deletions

View File

@ -1362,7 +1362,7 @@ static PyObject* THPModule_qEngine(PyObject* _unused, PyObject* noargs) {
static PyObject* THPModule_supportedQEngines(
PyObject* _unused,
PyObject* noargs) {
auto qengines = at::globalContext().supportedQEngines();
const auto& qengines = at::globalContext().supportedQEngines();
auto list =
THPObjectPtr(PyList_New(static_cast<Py_ssize_t>(qengines.size())));
if (!list)
@ -2481,13 +2481,16 @@ Call this whenever a new thread is created in order to propagate values from
});
py_module.def(
"_get_fp32_precision_getter", [](std::string backend, std::string op) {
"_get_fp32_precision_getter",
[](const std::string& backend, const std::string& op) {
return at::globalContext().float32Precision(backend, op);
});
py_module.def(
"_set_fp32_precision_setter",
[](std::string backend, std::string op, std::string precision) {
[](const std::string& backend,
const std::string& op,
const std::string& precision) {
at::globalContext().setFloat32Precision(backend, op, precision);
return precision;
});
@ -2609,30 +2612,6 @@ 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));
// 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(
"_set_conj", [](const at::Tensor& x, bool conj) { x._set_conj(conj); });
py_module.def(