未验证 提交 f30b3f81 编写于 作者: P pangyoki 提交者: GitHub

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
上级 07dad6d6
......@@ -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"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册