From f30b3f810d1b7e341507450313503cf4702f7d8a Mon Sep 17 00:00:00 2001 From: pangyoki Date: Wed, 2 Mar 2022 16:17:43 +0800 Subject: [PATCH] support checking `phi` directory in CI op benchmark (#40026) * support phi checking in CI op benchmark * add sparse/gpu * remove h file in cpu directory --- tools/ci_op_benchmark.sh | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/tools/ci_op_benchmark.sh b/tools/ci_op_benchmark.sh index 1db79418b2..0937ebe534 100644 --- a/tools/ci_op_benchmark.sh +++ b/tools/ci_op_benchmark.sh @@ -43,20 +43,33 @@ function match_cu_file_directory { do [ "${cu_file_dir}" == "paddle/fluid/operators${sub_dir}" ] && return 0 done - for sub_dir in "" "/gpu" "/hybird" + for sub_dir in "" "/gpu" "/gpudnn" "/sparse/gpu" do [ "${cu_file_dir}" == "paddle/phi/kernels${sub_dir}" ] && return 0 done return 1 } +# Limit h file directory +function match_h_file_directory { + LOG "[INFO] run function match_h_file_directory" + local sub_dir h_file_dir + h_file_dir=$(dirname ${1}) + # '.h' file should not in directory below + for sub_dir in "" "/cpu" + do + [ "${h_file_dir}" == "paddle/phi/kernels${sub_dir}" ] && return 1 + done + return 0 +} + # Load op files by header file function load_CHANGE_OP_FILES_by_header_file { LOG "[INFO] run function load_CHANGE_OP_FILES_by_header_file" local change_file for change_file in $(grep -rl "${1}" paddle/fluid/operators paddle/phi/kernels/) do - if [[ "$change_file" =~ "_op.cu" ]] + if [[ "$change_file" =~ "_op.cu" || "$change_file" =~ "_kernel.cu" || "$change_file" =~ "_kernel_gpudnn.cu" ]] then # match cu file directory limit match_cu_file_directory $change_file || continue @@ -64,6 +77,7 @@ function load_CHANGE_OP_FILES_by_header_file { CHANGE_OP_FILES[${#CHANGE_OP_FILES[@]}]="$change_file" elif [[ "$change_file" =~ ".h" ]] then + match_h_file_directory $change_file || continue [ -n "${INCLUDE_SEARCH_MAP[$change_file]}" ] && continue LOG "[INFO] Found \"${1}\" include by \"${change_file}\", keep searching." INCLUDE_SEARCH_MAP[$change_file]="searched" @@ -82,7 +96,7 @@ function load_CHANGE_OP_FILES { # match directory limit [[ "$change_file" =~ "paddle/fluid/operators/" ]] || [[ "$change_file" =~ "paddle/phi/kernels/" ]] || continue # match file name limit - if [[ "$change_file" =~ "_op.cu" ]] + if [[ "$change_file" =~ "_op.cu" || "$change_file" =~ "_kernel.cu" || "$change_file" =~ "_kernel_gpudnn.cu" ]] then # match cu file directory limit match_cu_file_directory $change_file || continue @@ -90,6 +104,7 @@ function load_CHANGE_OP_FILES { CHANGE_OP_FILES[${#CHANGE_OP_FILES[@]}]="$change_file" elif [[ "$change_file" =~ ".h" ]] then + match_h_file_directory $change_file || continue LOG "[INFO] Found \"${change_file}\" changed, keep searching." INCLUDE_SEARCH_MAP[${change_file}]="searched" load_CHANGE_OP_FILES_by_header_file $change_file @@ -131,6 +146,8 @@ function load_CHANGE_OP_MAP { op_name=${change_file_name##*/} op_name=${op_name%_cudnn_op*} op_name=${op_name%_op*} + op_name=${op_name%_grad_kernel*} + op_name=${op_name%_kernel*} [ -n "${SKIP_OP_MAP[$op_name]}" ] && continue LOG "[INFO] Load op: \"${op_name}\"." CHANGE_OP_MAP[${op_name}]="$change_file" -- GitLab