From 21b2f190ff92279cb3e997b0b29761008f8aa51d Mon Sep 17 00:00:00 2001 From: gouzil <66515297+gouzil@users.noreply.github.com> Date: Tue, 23 Apr 2024 13:23:37 +0800 Subject: [PATCH] [cmake] update pybind11 v2.10.3 to v2.12.0 (#63741) --- cmake/external/pybind11.cmake | 15 --------------- patches/pybind/cast.h.patch | 15 --------------- third_party/pybind | 2 +- 3 files changed, 1 insertion(+), 31 deletions(-) delete mode 100644 patches/pybind/cast.h.patch diff --git a/cmake/external/pybind11.cmake b/cmake/external/pybind11.cmake index dcb890b294cfb..c4d63589383ae 100644 --- a/cmake/external/pybind11.cmake +++ b/cmake/external/pybind11.cmake @@ -17,25 +17,11 @@ include(ExternalProject) set(PYBIND_PREFIX_DIR ${THIRD_PARTY_PATH}/pybind) set(PYBIND_SOURCE_DIR ${PYBIND_PREFIX_DIR}/src/extern_pybind) set(PYBIND_INCLUDE_DIR ${PYBIND_SOURCE_DIR}/include) -set(PYBIND_TAG v2.10.3) set(SOURCE_DIR ${PADDLE_SOURCE_DIR}/third_party/pybind) set(SOURCE_INCLUDE_DIR ${SOURCE_DIR}/include) include_directories(${PYBIND_INCLUDE_DIR}) -set(PYBIND_PATCH_COMMAND "") -if(NOT WIN32) - file(TO_NATIVE_PATH ${PADDLE_SOURCE_DIR}/patches/pybind/cast.h.patch - native_dst) - # Note: [Why calling some `git` commands before `patch`?] - # Paddle's CI uses cache to accelerate the make process. However, error might raise when patch codes in two scenarios: - # 1. Patch to the wrong version: the tag version of CI's cache falls behind PYBIND_TAG, use `git checkout ${PYBIND_TAG}` to solve this. - # 2. Patch twice: the tag version of cache == PYBIND_TAG, but patch has already applied to cache. - set(PYBIND_PATCH_COMMAND - git checkout -- . && git checkout ${PYBIND_TAG} && patch -Nd - ${SOURCE_INCLUDE_DIR}/pybind11 < ${native_dst}) -endif() - ExternalProject_Add( extern_pybind ${EXTERNAL_PROJECT_LOG_ARGS} ${SHALLOW_CLONE} @@ -47,7 +33,6 @@ ExternalProject_Add( # third-party library version changes cannot be incorporated. # reference: https://cmake.org/cmake/help/latest/module/ExternalProject.html UPDATE_COMMAND "" - PATCH_COMMAND ${PYBIND_PATCH_COMMAND} CONFIGURE_COMMAND "" # I intentionally preserved an extern_pybind/include/pybind11 directory # to site-packages, so that you could discern that you intended to diff --git a/patches/pybind/cast.h.patch b/patches/pybind/cast.h.patch deleted file mode 100644 index ebd65571ebf82..0000000000000 --- a/patches/pybind/cast.h.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h -index 3a404602..9054478c 100644 ---- a/include/pybind11/cast.h -+++ b/include/pybind11/cast.h -@@ -42,7 +42,9 @@ using make_caster = type_caster>; - // Shortcut for calling a caster's `cast_op_type` cast operator for casting a type_caster to a T - template - typename make_caster::template cast_op_type cast_op(make_caster &caster) { -- return caster.operator typename make_caster::template cast_op_type(); -+ // https://github.com/pybind/pybind11/issues/4606 with CUDA 12 -+ //return caster.operator typename make_caster::template cast_op_type(); -+ return caster; - } - template - typename make_caster::template cast_op_type::type> diff --git a/third_party/pybind b/third_party/pybind index 0bd8896a4010f..3e9dfa2866941 160000 --- a/third_party/pybind +++ b/third_party/pybind @@ -1 +1 @@ -Subproject commit 0bd8896a4010f2d91b2340570c24fa08606ec406 +Subproject commit 3e9dfa2866941655c56877882565e7577de6fc7b