未验证 提交 8c758313 编写于 作者: H HongyuJia 提交者: GitHub

[Decouple] Decouple prim/api/api.yaml in phi CMakeLists (#50595)

* autogen phi tensor operants

* autogen operants base

* autogen operants_manager

* polish code style

* add cmake output

* fix cmake depency error

* fix cmake file path error

* decouple prim/api/api.yaml in phi CMakeLists

* polish CMakeLists of phi/api/lib
上级 77606f5d
......@@ -100,7 +100,6 @@ set(wrapped_infermeta_source_file
# tensor and tensor operants file
set(tensor_gen_file
${CMAKE_SOURCE_DIR}/paddle/phi/api/yaml/generator/tensor_gen.py)
set(api_prim_yaml_file ${CMAKE_SOURCE_DIR}/paddle/fluid/prim/api/api.yaml)
set(operants_base_file
${CMAKE_SOURCE_DIR}/paddle/phi/api/include/operants_base.h)
set(phi_tensor_operants_header_file
......@@ -248,7 +247,6 @@ add_custom_command(
--phi_tensor_operants_source_path ${phi_tensor_operants_source_file_tmp}
--operants_manager_header_path ${operants_manager_header_file_tmp}
--operants_manager_source_path ${operants_manager_source_file_tmp}
--api_prim_yaml_path ${api_prim_yaml_file}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${operants_base_file_tmp}
${operants_base_file}
COMMAND
......
......@@ -322,7 +322,6 @@ def generate_tensor_operants_api(
operants_source_path,
operants_manager_header_path,
operants_manager_source_path,
api_prim_path,
):
apis = []
......@@ -349,10 +348,8 @@ def generate_tensor_operants_api(
operants_manager_source_file.write(operants_manager_source_include)
operants_manager_source_file.write(operants_manager_source_start)
with open(api_prim_path, 'rt') as f:
api_prims = yaml.safe_load(f)
# white list temporarily
api_prims = ('add', 'subtract', 'multiply', 'divide')
# white list temporarily
api_prims = ('add', 'subtract', 'multiply', 'divide')
for api in apis:
operants_api = OperantsAPI(api, api_prims)
......@@ -423,12 +420,6 @@ def main():
default='paddle/phi/api/lib/operants_manager.cc',
)
parser.add_argument(
'--api_prim_yaml_path',
help='Primitive API list yaml file.',
default='paddle/fluid/prim/api/api.yaml',
)
options = parser.parse_args()
api_yaml_path = options.api_yaml_path
......@@ -437,7 +428,6 @@ def main():
operants_source_path = options.phi_tensor_operants_source_path
operants_manager_header_path = options.operants_manager_header_path
operants_manager_source_path = options.operants_manager_source_path
api_prim_yaml_path = options.api_prim_yaml_path
generate_tensor_operants_api(
api_yaml_path,
......@@ -446,7 +436,6 @@ def main():
operants_source_path,
operants_manager_header_path,
operants_manager_source_path,
api_prim_yaml_path,
)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册