From 00ea0b2fe650e0ac386fd9459e8cd9de34713277 Mon Sep 17 00:00:00 2001 From: zyfncg Date: Thu, 10 Nov 2022 11:17:01 +0800 Subject: [PATCH] Add CI check for script of auto code-gen (#47814) * add ci check for code-gen script * update --- .../generator/eager_gen.py | 1 - .../fluid/operators/generator/generate_op.py | 1 + python/setup.py.in | 2 +- tools/check_file_diff_approvals.sh | 24 +++++++++++++++++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/paddle/fluid/eager/auto_code_generator/generator/eager_gen.py b/paddle/fluid/eager/auto_code_generator/generator/eager_gen.py index e13d4f5b82..1b73b3c67d 100644 --- a/paddle/fluid/eager/auto_code_generator/generator/eager_gen.py +++ b/paddle/fluid/eager/auto_code_generator/generator/eager_gen.py @@ -2411,7 +2411,6 @@ class DygraphForwardAndNodesGenerator(GeneratorBase): def GenerateCode(self): forward_api_list = self.forward_api_list - grad_api_dict = self.grad_api_dict forward_apis_dict = {} for api_item in forward_api_list: forward_apis_dict[api_item['op']] = api_item diff --git a/paddle/fluid/operators/generator/generate_op.py b/paddle/fluid/operators/generator/generate_op.py index d8648fa38e..36db646431 100644 --- a/paddle/fluid/operators/generator/generate_op.py +++ b/paddle/fluid/operators/generator/generate_op.py @@ -90,6 +90,7 @@ def replace_compat_name(op_op_map, forward_op_dict, backward_op_dict): backward_op_item = backward_op_dict[forward_op_item['backward']] if new_op_name != op_name: forward_op_item['op_name'] = op_name + if 'backward' in op_args and has_backward: backward_op_list = op_args['backward'].split(',') _, bw_op_name = get_op_and_op_name(backward_op_list[0]) diff --git a/python/setup.py.in b/python/setup.py.in index e596e55b55..5ab06a05e1 100755 --- a/python/setup.py.in +++ b/python/setup.py.in @@ -776,7 +776,7 @@ with redirect_stdout(): project_urls = { 'Homepage': 'https://www.paddlepaddle.org.cn/', 'Downloads': 'https://github.com/paddlepaddle/paddle' - }, + }, license='Apache Software License', packages=packages, install_requires=setup_requires, diff --git a/tools/check_file_diff_approvals.sh b/tools/check_file_diff_approvals.sh index 6b28a19703..f1aa530e87 100644 --- a/tools/check_file_diff_approvals.sh +++ b/tools/check_file_diff_approvals.sh @@ -272,6 +272,30 @@ if [ "${HAS_MODIFIED_API_COMPAT_YAML}" != "" ] && [ "${GIT_PR_ID}" != "" ]; then check_approval 1 chenwhql zyfncg fi +HAS_MODIFIED_API_GENE=`git diff --name-only upstream/$BRANCH | grep "paddle/phi/api/yaml/generator" || true` +if [ "${HAS_MODIFIED_API_GENE}" != "" ] && [ "${GIT_PR_ID}" != "" ]; then + echo_line="You must have one RD (zyfncg, chenwhql, YuanRisheng, phlrain) approval for file changes in paddle/phi/api/yaml/generator, which manages the generated code for C++ API in paddle/phi/api/lib/api.cc.\n" + check_approval 1 zyfncg chenwhql YuanRisheng phlrain +fi + +HAS_MODIFIED_EAGER_GENE=`git diff --name-only upstream/$BRANCH | grep "paddle/fluid/eager/auto_code_generator" || true` +if [ "${HAS_MODIFIED_EAGER_GENE}" != "" ] && [ "${GIT_PR_ID}" != "" ]; then + echo_line="You must have one RD (JiabinYang, chenwhql, zyfncg, phlrain) approval for file changes in paddle/fluid/eager/auto_code_generator, which manages the generated code for dygraph functions in paddle/fluid/eager/api/generated.\n" + check_approval 1 JiabinYang chenwhql zyfncg phlrain +fi + +HAS_MODIFIED_OPERATOR_GENE=`git diff --name-only upstream/$BRANCH | grep "paddle/fluid/operators/generator" || true` +if [ "${HAS_MODIFIED_OPERATOR_GENE}" != "" ] && [ "${GIT_PR_ID}" != "" ]; then + echo_line="You must have one RD (zyfncg, chenwhql, iclementine, phlrain) approval for file changes in paddle/fluid/operators/generator, which manages the generated code for OpMaker in paddle/fluid/operators/(generated_op.cc | sparse_generated_op.cc)\n" + check_approval 1 zyfncg chenwhql iclementine phlrain +fi + +HAS_MODIFIED_SETUP_IN=`git diff --name-only upstream/$BRANCH | grep "python/setup.py.in" || true` +if [ "${HAS_MODIFIED_SETUP_IN}" != "" ] && [ "${GIT_PR_ID}" != "" ]; then + echo_line="You must have one RD (chenwhql, zyfncg, YuanRisheng, phlrain) approval for file changes in python/setup.py.in, which manages the header files that can be used from outside of framework.\n" + check_approval 1 chenwhql zyfncg YuanRisheng phlrain +fi + ALL_PADDLE_ENFORCE=`git diff -U0 upstream/$BRANCH |grep "^+" |grep -zoE "PADDLE_ENFORCE\(.[^,\);]+.[^;]*\);\s" || true` if [ "${ALL_PADDLE_ENFORCE}" != "" ] && [ "${GIT_PR_ID}" != "" ]; then echo_line="PADDLE_ENFORCE is not recommended. Please use PADDLE_ENFORCE_EQ/NE/GT/GE/LT/LE or PADDLE_ENFORCE_NOT_NULL or PADDLE_ENFORCE_GPU_SUCCESS instead, see [ https://github.com/PaddlePaddle/Paddle/wiki/PADDLE_ENFORCE-Rewriting-Specification ] for details.\nYou must have one RD (chenwhql (Recommend), luotao1 (Recommend) or lanxianghit) approval for the usage (either add or delete) of PADDLE_ENFORCE.\n${ALL_PADDLE_ENFORCE}\n" -- GitLab