Skip to content

Commit c1d2469

Browse files
metax6661184319564root
authored
[Metax] fix ut and fix ci (PaddlePaddle#2217)
* [Metax]support block-based ignore configuration for Python unit tests (PaddlePaddle#188) * support block-based ignore configuration for Python unit tests * Revert "support block-based ignore configuration for Python unit tests" This reverts commit 5dafa4d. * fix CI test cmd --------- Co-authored-by: root <[email protected]> * support block-based ignore configuration for Python unit tests (PaddlePaddle#189) * fixmetaxci * [metax]updata paddle --------- Co-authored-by: ZhouDuan <[email protected]> Co-authored-by: root <[email protected]>
1 parent 41a3387 commit c1d2469

File tree

6 files changed

+72
-31
lines changed

6 files changed

+72
-31
lines changed

.github/workflows/_Metax-X86.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,28 @@ defaults:
2323

2424

2525
jobs:
26-
metax-gpu-test:
26+
27+
check-bypass:
28+
name: Check bypass
29+
if: ${{ inputs.can-skip != 'true' }}
30+
uses: ./.github/workflows/check-bypass.yml
31+
with:
32+
workflow-name: 'metax'
33+
secrets:
34+
github-token: ${{ secrets.GITHUB_TOKEN }}
35+
36+
PR-CI-METAX:
37+
name: PR-CI-METAX
38+
needs: check-bypass
39+
if: ${{ needs.check-bypass.outputs.can-skip != 'true' }}
2740
runs-on: paddle-metax-runner-set
2841
env:
2942
PR_ID: ${{ github.event.pull_request.number }}
3043
COMMIT_ID: ${{ github.event.pull_request.head.sha }}
3144
BRANCH: develop
3245

33-
3446
steps:
35-
- name: Checkout repository
47+
- name: Download Code
3648
run: |
3749
set -x
3850
wget -q --tries=5 --no-proxy https://paddle-github-action.bj.bcebos.com/PaddleCustomDevice/PR/${PR_ID}/${COMMIT_ID}/PaddleCustomDevice.tar.gz --no-check-certificate
@@ -44,13 +56,6 @@ jobs:
4456
git merge ${BRANCH} --no-edit
4557
git --no-pager log --pretty=oneline -5
4658
47-
- name: Check bypass
48-
id: check-bypass
49-
uses: ./PaddleCustomDevice/.github/actions/check-bypass
50-
with:
51-
github-token: ${{ secrets.GITHUB_TOKEN }}
52-
workflow-name: metax
53-
5459
5560
- name: RUN METAX-GPU
5661
id: run-metax
@@ -59,21 +64,16 @@ jobs:
5964
cd PaddleCustomDevice
6065
# !!!!! SKIP IF NO METAX CHANGE !!!!
6166
echo "=========== Checking PR Changes If METAX FULL CI Needed ==========="
62-
6367
change_numbers=$(git diff --name-only remotes/origin/${BRANCH} | wc -l)
64-
6568
change_backend=$(git diff --name-only remotes/origin/${BRANCH} | grep "backends/"| wc -l)
6669
change_metax_only=$(git diff --name-only remotes/origin/${BRANCH} | grep "backends/metax_gpu"| wc -l)
6770
git --no-pager diff --name-only remotes/origin/${BRANCH}
71+
6872
if [ $change_numbers -ne $change_backend ]; then
6973
echo "Common file changed, continue to run METAX FULL CI test ..."
70-
echo "should_skip=false" >> $GITHUB_OUTPUT
7174
elif [ $change_metax_only -eq 0 ] ; then
72-
echo "NO METAX backend changes found, skip METAX FULL CI ...."
73-
echo "should_skip=true" >> $GITHUB_OUTPUT
75+
echo "NO METAX backend changes found, skip MLU FULL CI ...."
7476
exit 0
75-
else
76-
echo "should_skip=false" >> $GITHUB_OUTPUT
7777
fi
7878
7979
- name: compile
@@ -84,7 +84,7 @@ jobs:
8484
- name: run test
8585
run: |
8686
cd PaddleCustomDevice/backends/metax_gpu/tests
87-
bash run_test.sh -j 8
87+
bash run_test.sh -j 8 -b "default"
8888
8989
- name: push whl
9090
env:

.github/workflows/_Metax_work_private.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979

8080
run: |
8181
cd backends/metax_gpu/tests
82-
bash run_test.sh -j 8
82+
bash run_test.sh -j 8 -b "default"
8383
8484
- name: push whl
8585
env:

Paddle

Submodule Paddle updated 155 files

backends/metax_gpu/tests/CMakeLists.txt

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,47 @@ list(REMOVE_DUPLICATES PYTHON_TEST_SCRIPTS)
6767

6868
if(NOT TEST_LIST_FILE)
6969
set(NEED_IGNORE_FILE ${CMAKE_CURRENT_LIST_DIR}/ignore.txt)
70+
7071
if(EXISTS ${NEED_IGNORE_FILE})
71-
file(STRINGS ${NEED_IGNORE_FILE} NEED_IGNORE_TEST_PROGRAMS)
72-
foreach(test_name ${NEED_IGNORE_TEST_PROGRAMS})
73-
if(EXISTS ${PADDLE_LEGACY_TEST_PATH}/${test_name}.py)
72+
73+
file(STRINGS ${NEED_IGNORE_FILE} ignore_lines)
74+
75+
set(current_block "")
76+
set(all_blocks "")
77+
78+
foreach(line ${ignore_lines})
79+
if(line MATCHES "^\\[(.+)\\]$")
80+
set(current_block "${CMAKE_MATCH_1}")
81+
list(APPEND all_blocks "${current_block}")
82+
set(ignore_map_${current_block} "")
83+
elseif(NOT line STREQUAL "")
84+
if(NOT current_block STREQUAL "")
85+
list(APPEND ignore_map_${current_block} "${line}")
86+
endif()
87+
endif()
88+
endforeach()
89+
90+
if(IGNORE_BLOCKS STREQUAL "NONE")
91+
message(STATUS "IGNORE_BLOCKS=NONE → No ignore blocks applied.")
92+
set(blocks_to_ignore "")
93+
elseif(IGNORE_BLOCKS)
94+
string(REPLACE ";" " " blocks_to_ignore "${IGNORE_BLOCKS}")
95+
message(STATUS "Only ignoring blocks: ${blocks_to_ignore}")
96+
else()
97+
set(blocks_to_ignore "${all_blocks}")
98+
message(STATUS "Default: ignoring ALL blocks: ${blocks_to_ignore}")
99+
endif()
100+
101+
foreach(block ${blocks_to_ignore})
102+
set(varname "ignore_map_${block}")
103+
foreach(test_name ${${varname}})
74104
list(REMOVE_ITEM PYTHON_TEST_SCRIPTS
75-
${PADDLE_LEGACY_TEST_PATH}/${test_name}.py)
76-
else()
105+
"${PADDLE_LEGACY_TEST_PATH}/${test_name}.py")
77106
list(REMOVE_ITEM PYTHON_TEST_SCRIPTS
78-
${METAX_UNIT_TEST_PATH}/${test_name}.py)
79-
endif()
107+
"${METAX_UNIT_TEST_PATH}/${test_name}.py")
108+
endforeach()
80109
endforeach()
110+
81111
endif()
82112
endif()
83113

backends/metax_gpu/tests/ignore.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[default]
12
test_matmul_op_metax
23
test_sum_op
34
test_elementwise_add_op
@@ -13,3 +14,8 @@ test_conv3d_layer
1314
test_conv3d_transpose_part2_op
1415
test_fused_conv2d_add_act_op
1516
test_bilinear_interp_v2_op
17+
18+
[internet]
19+
test_hapi_amp
20+
test_momentum_op
21+
test_adam_optimizer_fp32_fp64

backends/metax_gpu/tests/run_test.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ TEST_LOG_LEVEL=0
3535
TEST_LIST_FILE=""
3636
TEST_LOG_OUTPUT_DIR=""
3737
TEST_PARALLEL_NUM=1
38+
IGNORE_BLOCKS=""
3839

39-
while getopts "i:o:v:j:h" opt; do
40+
while getopts "i:o:v:j:b:h" opt; do
4041
case "$opt" in
4142
i)
4243
TEST_LIST_FILE="$OPTARG"
@@ -51,13 +52,17 @@ while getopts "i:o:v:j:h" opt; do
5152
j)
5253
TEST_PARALLEL_NUM="$OPTARG"
5354
;;
55+
b)
56+
IGNORE_BLOCKS="$OPTARG"
57+
echo "Set ignore blocks: $IGNORE_BLOCKS"
58+
;;
5459
h)
5560
echo "用法:$0 -i <测试列表文件> -o <日志输出路径> ..."
56-
echo "选项说明:"
5761
echo " -i 测试程序列表文件"
5862
echo " -o 日志输出路径"
5963
echo " -v GLOG_v 日志等级"
60-
echo " -j ctest 测试并行数量"
64+
echo " -j ctest 并行数量"
65+
echo " -b 忽略的块列表,例如:\"elementwise;conv\" 或 NONE"
6166
echo " -h 显示帮助"
6267
exit 0
6368
;;
@@ -76,7 +81,7 @@ done
7681
export GLOG_v=$TEST_LOG_LEVEL
7782

7883

79-
cmake .. -DTEST_LIST_FILE=$TEST_LIST_FILE -DLOG_OUTPUT_DIR=$TEST_LOG_OUTPUT_DIR
84+
cmake .. -DTEST_LIST_FILE=$TEST_LIST_FILE -DLOG_OUTPUT_DIR=$TEST_LOG_OUTPUT_DIR -DIGNORE_BLOCKS="$IGNORE_BLOCKS"
8085

8186
cmake --build .
8287

0 commit comments

Comments
 (0)