未验证 提交 883b6aba 编写于 作者: H haosicheng 提交者: GitHub

Expose xdnn headers files for custom op (#51055)

only when -DWITH_XDNN_API=ON, will those files be packed into whl
package
上级 3b7239dd
...@@ -71,5 +71,6 @@ env_dict={ ...@@ -71,5 +71,6 @@ env_dict={
'WIN32':'@WIN32@', 'WIN32':'@WIN32@',
'JIT_RELEASE_WHL':'@JIT_RELEASE_WHL@', 'JIT_RELEASE_WHL':'@JIT_RELEASE_WHL@',
'WITH_PSLIB':'@WITH_PSLIB@', 'WITH_PSLIB':'@WITH_PSLIB@',
'PYBIND_INCLUDE_DIR':'@PYBIND_INCLUDE_DIR@' 'PYBIND_INCLUDE_DIR':'@PYBIND_INCLUDE_DIR@',
'WITH_XDNN_API':'@WITH_XDNN_API@'
} }
...@@ -728,6 +728,9 @@ if '${WITH_GPU}' == 'ON' or '${WITH_ROCM}' == 'ON': ...@@ -728,6 +728,9 @@ if '${WITH_GPU}' == 'ON' or '${WITH_ROCM}' == 'ON':
# externalErrorMsg.pb for External Error message # externalErrorMsg.pb for External Error message
headers += list(find_files('*.pb', '${externalError_INCLUDE_DIR}')) headers += list(find_files('*.pb', '${externalError_INCLUDE_DIR}'))
if '${WITH_XDNN_API}' == 'ON':
headers += list(find_files('*.h', '@PADDLE_BINARY_DIR@/third_party/xpu/src/extern_xpu/xpu', recursive=True)) # xdnn api headers
headers += list(find_files('*.h', '${PYBIND_INCLUDE_DIR}', True)) # pybind headers headers += list(find_files('*.h', '${PYBIND_INCLUDE_DIR}', True)) # pybind headers
class InstallCommand(InstallCommandBase): class InstallCommand(InstallCommandBase):
...@@ -776,7 +779,7 @@ class InstallHeaders(Command): ...@@ -776,7 +779,7 @@ class InstallHeaders(Command):
else: else:
# third_party # third_party
install_dir = re.sub('${THIRD_PARTY_PATH}', 'third_party', header) install_dir = re.sub('${THIRD_PARTY_PATH}', 'third_party', header)
patterns = ['install/mkldnn/include', 'pybind/src/extern_pybind/include'] patterns = ['install/mkldnn/include', 'pybind/src/extern_pybind/include', 'third_party/xpu/src/extern_xpu/xpu/include/']
for pattern in patterns: for pattern in patterns:
install_dir = re.sub(pattern, '', install_dir) install_dir = re.sub(pattern, '', install_dir)
install_dir = os.path.join(self.install_dir, os.path.dirname(install_dir)) install_dir = os.path.join(self.install_dir, os.path.dirname(install_dir))
......
...@@ -155,6 +155,7 @@ def get_header_install_dir(header): ...@@ -155,6 +155,7 @@ def get_header_install_dir(header):
patterns = [ patterns = [
'install/mkldnn/include', 'install/mkldnn/include',
'pybind/src/extern_pybind/include', 'pybind/src/extern_pybind/include',
'third_party/xpu/src/extern_xpu/xpu/include/',
] ]
for pattern in patterns: for pattern in patterns:
install_dir = re.sub(pattern, '', install_dir) install_dir = re.sub(pattern, '', install_dir)
...@@ -1222,6 +1223,15 @@ def get_headers(): ...@@ -1222,6 +1223,15 @@ def get_headers():
find_files('*.pb', env_dict.get("externalError_INCLUDE_DIR")) find_files('*.pb', env_dict.get("externalError_INCLUDE_DIR"))
) )
if env_dict.get("WITH_XDNN_API") == 'ON':
headers += list(
find_files(
'*.h',
paddle_binary_dir + '/third_party/xpu/src/extern_xpu/xpu',
recursive=True,
)
) # xdnn api headers
# pybind headers # pybind headers
headers += list(find_files('*.h', env_dict.get("PYBIND_INCLUDE_DIR"), True)) headers += list(find_files('*.h', env_dict.get("PYBIND_INCLUDE_DIR"), True))
return headers return headers
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册