From fa7cff1feecd549fe881892d31caf61e12470587 Mon Sep 17 00:00:00 2001 From: Aurelius84 Date: Wed, 4 Dec 2019 15:05:29 +0800 Subject: [PATCH] Add CI for checking registered data_type of new Op (#21488) * add data_type register CI test=develop * add op add test case test=develop * add test case for register op kernel test=develop * fix shell script bug test=develop * fix checkout branch test=develop * remove test case code test=develop * fix op_type.spec name test=develop --- paddle/scripts/paddle_build.sh | 5 ++++- tools/check_api_approvals.sh | 10 ++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/paddle/scripts/paddle_build.sh b/paddle/scripts/paddle_build.sh index 211a3680251..ac569a3c7a5 100755 --- a/paddle/scripts/paddle_build.sh +++ b/paddle/scripts/paddle_build.sh @@ -485,8 +485,11 @@ function generate_api_spec() { source .${spec_kind}_env/bin/activate pip install ${PADDLE_ROOT}/build/python/dist/*whl - spec_path=${PADDLE_ROOT}/paddle/fluid/API_${spec_kind}.spec + spec_path=${PADDLE_ROOT}/paddle/fluid/API_${spec_kind}.spec python ${PADDLE_ROOT}/tools/print_signatures.py paddle.fluid > $spec_path + # used to log op_register data_type + op_type_path=${PADDLE_ROOT}/paddle/fluid/OP_TYPE_${spec_kind}.spec + python ${PADDLE_ROOT}/tools/check_op_register_type.py > $op_type_path awk -F '(' '{print $NF}' $spec_path >${spec_path}.doc awk -F '(' '{$NF="";print $0}' $spec_path >${spec_path}.api if [ "$1" == "cp35-cp35m" ] || [ "$1" == "cp36-cp36m" ] || [ "$1" == "cp37-cp37m" ]; then diff --git a/tools/check_api_approvals.sh b/tools/check_api_approvals.sh index 833057707df..c97fb796301 100644 --- a/tools/check_api_approvals.sh +++ b/tools/check_api_approvals.sh @@ -68,13 +68,18 @@ if [ "$api_doc_spec_diff" != "" ]; then check_approval 1 31623103 2870059 fi +op_type_spec_diff=`python ${PADDLE_ROOT}/tools/check_op_register_type.py ${PADDLE_ROOT}/paddle/fluid/OP_TYPE_DEV.spec ${PADDLE_ROOT}/paddle/fluid/OP_TYPE_PR.spec` +if [ "$op_type_spec_diff" != "" ]; then + echo_line="More data_type of new operator should be regitered in your PR. Please make sure that both float/double (or int/int64_t) have been regitered. You must have one RD (Aurelius84 or liym27 or zhhsplendid)approval for the data_type registration of new operator.\n" + check_approval 1 9301846 33742067 7913861 +fi for API_FILE in ${API_FILES[*]}; do API_CHANGE=`git diff --name-only upstream/$BRANCH | grep "${API_FILE}" | grep -v "/CMakeLists.txt" || true` echo "checking ${API_FILE} change, PR: ${GIT_PR_ID}, changes: ${API_CHANGE}" if [ "${API_CHANGE}" ] && [ "${GIT_PR_ID}" != "" ]; then - # NOTE: per_page=10000 should be ok for all cases, a PR review > 10000 is not human readable. - # approval_user_list: XiaoguangHu01 46782768,Xreki 12538138,luotao1 6836917,sneaxiy 32832641,qingqing01 7845005,guoshengCS 14105589,heavengate 12605721,kuke 3064195,Superjomn 328693,lanxianghit 47554610,cyj1986 39645414,hutuxian 11195205,frankwhzhang 20274488,nepeplwu 45024560,Dianhai 38231817,JiabinYang 22361972,chenwhql 22561442,zhiqiu 6888866,seiriosPlus 5442383,gongweibao 10721757,saxon-zh 2870059,Boyan-Liu 2870059. + # NOTE: per_page=10000 should be ok for all cases, a PR review > 10000 is not human readable.q + # approval_user_list: XiaoguangHu01 46782768,Xreki 12538138,luotao1 6836917,sneaxiy 32832641,qingqing01 7845005,guoshengCS 14105589,heavengate 12605721,kuke 3064195,Superjomn 328693,lanxianghit 47554610,cyj1986 39645414,hutuxian 11195205,frankwhzhang 20274488,nepeplwu 45024560,Dianhai 38231817,JiabinYang 22361972,chenwhql 22561442,zhiqiu 6888866,seiriosPlus 5442383,gongweibao 10721757,saxon-zh 2870059,Boyan-Liu 2870059, Aurelius84 9301846, liym27 33742067, zhhsplendid 7913861. if [ "${API_FILE}" == "paddle/fluid/op_use_default_grad_op_maker.spec" ];then echo_line="You must have one RD (sneaxiy (Recommend) or luotao1) approval for op_use_default_grad_op_maker.spec, which manages the grad_op memory optimization.\n" check_approval 1 32832641 6836917 @@ -150,6 +155,7 @@ if [ -n "${echo_list}" ];then fi python ${PADDLE_ROOT}/tools/diff_api.py ${PADDLE_ROOT}/paddle/fluid/API_DEV.spec ${PADDLE_ROOT}/paddle/fluid/API_PR.spec +python ${PADDLE_ROOT}/tools/check_op_register_type.py ${PADDLE_ROOT}/paddle/fluid/OP_TYPE_DEV.spec ${PADDLE_ROOT}/paddle/fluid/OP_TYPE_PR.spec if [ -n "${echo_list}" ]; then exit 1 -- GitLab