From 7cae0f28d3056100a40c6ae012fdc7cd5994bd0b Mon Sep 17 00:00:00 2001 From: xingmingyyj Date: Tue, 12 Dec 2023 08:49:55 +0000 Subject: [PATCH 1/3] PIR Relaxed OpTest: not found test_xxx_op in legacy_test --- paddle/phi/api/yaml/op_compat.yaml | 4 +-- test/CMakeLists.txt | 34 +++++++++++++++++++++++ test/distribution/CMakeLists.txt | 2 ++ test/fft/CMakeLists.txt | 2 ++ test/legacy_test/CMakeLists.txt | 37 ++------------------------ test/white_list/pir_op_test_white_list | 2 -- 6 files changed, 42 insertions(+), 39 deletions(-) diff --git a/paddle/phi/api/yaml/op_compat.yaml b/paddle/phi/api/yaml/op_compat.yaml index e4bbb15073f418..ae6d89817d771b 100755 --- a/paddle/phi/api/yaml/op_compat.yaml +++ b/paddle/phi/api/yaml/op_compat.yaml @@ -2549,7 +2549,7 @@ - op : reshape (reshape2) backward : reshape_grad (reshape2_grad) inputs: - x : X + x : z outputs: out : Out xshape: XShape @@ -3380,7 +3380,7 @@ - op: dpsgd inputs: - {param: Param,grad: Grad,learning_rate: LearningRate} + {param: param,grad: grad,learning_rate: LearningRate} outputs: param_out : ParamOut diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index dd4ff65e332019..a61b75dd75af43 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -91,6 +91,38 @@ function(bash_test_modules TARGET_NAME) endif() endfunction() +function(set_pit_tests_properties) + file(STRINGS "${CMAKE_SOURCE_DIR}/test/white_list/pir_op_test_white_list" + PIR_OP_TESTS) + foreach(IR_OP_TEST ${PIR_OP_TESTS}) + if(TEST ${IR_OP_TEST}) + set_tests_properties( + ${IR_OP_TEST} PROPERTIES ENVIRONMENT "FLAGS_PIR_OPTEST_WHITE_LIST=True") + endif() + endforeach() + + file(STRINGS "${CMAKE_SOURCE_DIR}/test/white_list/pir_op_test_no_check_list" + PIR_OP_NO_CHECK_TESTS) + foreach(IR_OP_TEST ${PIR_OP_NO_CHECK_TESTS}) + if(TEST ${IR_OP_TEST}) + set_tests_properties(${IR_OP_TEST} PROPERTIES ENVIRONMENT + "FLAGS_PIR_NO_CHECK=True") + endif() + endforeach() + + file(STRINGS + "${CMAKE_SOURCE_DIR}/test/white_list/pir_op_test_precision_white_list" + PIR_OP_RELAXED_TESTS) + foreach(IR_OP_TEST ${PIR_OP_RELAXED_TESTS}) + if(TEST ${IR_OP_TEST}) + set_tests_properties( + ${IR_OP_TEST} PROPERTIES ENVIRONMENT + "FLAGS_PIR_OPTEST_RELAX_CHECK=True") + endif() + endforeach() + +endfunction() + if(WITH_TESTING) if(WITH_CINN) add_subdirectory(cpp/cinn) @@ -256,3 +288,5 @@ add_custom_target(build_tests) if(${len} GREATER_EQUAL 1) add_dependencies(build_tests ${test_names}) endif() + +set_pit_tests_properties() diff --git a/test/distribution/CMakeLists.txt b/test/distribution/CMakeLists.txt index 95739040ef4af7..2839c2ea7231fc 100644 --- a/test/distribution/CMakeLists.txt +++ b/test/distribution/CMakeLists.txt @@ -7,3 +7,5 @@ string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}") foreach(TEST_OP ${TEST_OPS}) py_test_modules(${TEST_OP} MODULES ${TEST_OP}) endforeach() + +set_pit_tests_properties() diff --git a/test/fft/CMakeLists.txt b/test/fft/CMakeLists.txt index 95739040ef4af7..2839c2ea7231fc 100644 --- a/test/fft/CMakeLists.txt +++ b/test/fft/CMakeLists.txt @@ -7,3 +7,5 @@ string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}") foreach(TEST_OP ${TEST_OPS}) py_test_modules(${TEST_OP} MODULES ${TEST_OP}) endforeach() + +set_pit_tests_properties() diff --git a/test/legacy_test/CMakeLists.txt b/test/legacy_test/CMakeLists.txt index 6fe6a90a5dd3da..42ac5a5f445706 100644 --- a/test/legacy_test/CMakeLists.txt +++ b/test/legacy_test/CMakeLists.txt @@ -1398,41 +1398,6 @@ set_tests_properties(test_sync_batch_norm_op_static_build PROPERTIES LABELS "RUN_TYPE=DIST") set_tests_properties(test_sync_batch_norm_op_static_build PROPERTIES TIMEOUT 250) - -file(STRINGS "${CMAKE_SOURCE_DIR}/test/white_list/pir_op_test_white_list" - PIR_OP_TESTS) -foreach(IR_OP_TEST ${PIR_OP_TESTS}) - if(TEST ${IR_OP_TEST}) - set_tests_properties( - ${IR_OP_TEST} PROPERTIES ENVIRONMENT "FLAGS_PIR_OPTEST_WHITE_LIST=True") - else() - message(STATUS "PIR OpTest: not found ${IR_OP_TEST} in legacy_test") - endif() -endforeach() - -file(STRINGS "${CMAKE_SOURCE_DIR}/test/white_list/pir_op_test_no_check_list" - PIR_OP_NO_CHECK_TESTS) -foreach(IR_OP_TEST ${PIR_OP_NO_CHECK_TESTS}) - if(TEST ${IR_OP_TEST}) - set_tests_properties(${IR_OP_TEST} PROPERTIES ENVIRONMENT - "FLAGS_PIR_NO_CHECK=True") - else() - message(STATUS "PIR OpTest: not found ${IR_OP_TEST} in legacy_test") - endif() -endforeach() - -file(STRINGS - "${CMAKE_SOURCE_DIR}/test/white_list/pir_op_test_precision_white_list" - PIR_OP_RELAXED_TESTS) -foreach(IR_OP_TEST ${PIR_OP_RELAXED_TESTS}) - if(TEST ${IR_OP_TEST}) - set_tests_properties( - ${IR_OP_TEST} PROPERTIES ENVIRONMENT "FLAGS_PIR_OPTEST_RELAX_CHECK=True") - else() - message(STATUS "PIR Relaxed OpTest: not found ${IR_OP_TEST} in legacy_test") - endif() -endforeach() - py_test_modules(test_stride MODULES test_stride ENVS FLAGS_use_stride_kernel=true) @@ -1448,3 +1413,5 @@ if((WITH_ROCM OR WITH_GPU) AND NOT WIN32) test_fleet_executor_with_task_nodes PROPERTIES ENVIRONMENT "FLAGS_new_executor_micro_batching=False") endif() + +set_pit_tests_properties() diff --git a/test/white_list/pir_op_test_white_list b/test/white_list/pir_op_test_white_list index 6cc67d7ab60b80..f042e43b94c716 100644 --- a/test/white_list/pir_op_test_white_list +++ b/test/white_list/pir_op_test_white_list @@ -26,7 +26,6 @@ test_auc_single_pred_op test_bce_loss test_bernoulli_op test_bicubic_interp_v2_op -test_bilinear_interp_mkldnn_op test_bilinear_interp_v2_mkldnn_op test_bilinear_interp_v2_op test_bilinear_tensor_product_op @@ -167,7 +166,6 @@ test_index_select_op test_instance_norm_op test_instance_norm_op_v2 test_inverse_op -test_ir_pybind test_is_empty_op test_isclose_op test_kldiv_loss_op From 92758f1b70c7557e1d83cde46ebf54e93b5ab8b1 Mon Sep 17 00:00:00 2001 From: xingmingyyj <135400902+xingmingyyj@users.noreply.github.com> Date: Tue, 12 Dec 2023 20:31:34 +0800 Subject: [PATCH 2/3] Update op_compat.yaml --- paddle/phi/api/yaml/op_compat.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/paddle/phi/api/yaml/op_compat.yaml b/paddle/phi/api/yaml/op_compat.yaml index ae6d89817d771b..621c9d59aa8dbb 100755 --- a/paddle/phi/api/yaml/op_compat.yaml +++ b/paddle/phi/api/yaml/op_compat.yaml @@ -2549,7 +2549,7 @@ - op : reshape (reshape2) backward : reshape_grad (reshape2_grad) inputs: - x : z + x : X outputs: out : Out xshape: XShape @@ -3380,7 +3380,7 @@ - op: dpsgd inputs: - {param: param,grad: grad,learning_rate: LearningRate} + {param: Param,grad: grad,learning_rate: LearningRate} outputs: param_out : ParamOut From 5924f8aaf0633a4ff4d052db1f5b9e3ef7b4f57d Mon Sep 17 00:00:00 2001 From: xingmingyyj <135400902+xingmingyyj@users.noreply.github.com> Date: Tue, 12 Dec 2023 20:32:06 +0800 Subject: [PATCH 3/3] Update op_compat.yaml --- paddle/phi/api/yaml/op_compat.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paddle/phi/api/yaml/op_compat.yaml b/paddle/phi/api/yaml/op_compat.yaml index 621c9d59aa8dbb..e4bbb15073f418 100755 --- a/paddle/phi/api/yaml/op_compat.yaml +++ b/paddle/phi/api/yaml/op_compat.yaml @@ -3380,7 +3380,7 @@ - op: dpsgd inputs: - {param: Param,grad: grad,learning_rate: LearningRate} + {param: Param,grad: Grad,learning_rate: LearningRate} outputs: param_out : ParamOut