From a53ee944e26f93fe473fdf0005bba56fe161ca37 Mon Sep 17 00:00:00 2001 From: gouzil <66515297+gouzil@users.noreply.github.com> Date: Fri, 28 Apr 2023 17:22:29 +0800 Subject: [PATCH] [test]mv fluid op cinn to test/cpp/fluid/cinn (#53443) --- paddle/fluid/operators/cinn/CMakeLists.txt | 50 ------------------- test/cpp/CMakeLists.txt | 1 + test/cpp/fluid/CMakeLists.txt | 3 ++ test/cpp/fluid/cinn/CMakeLists.txt | 46 +++++++++++++++++ .../cinn/cinn_instruction_run_op_test.cc | 2 +- .../fluid}/cinn/cinn_launch_context_test.cc | 0 .../cpp/fluid}/cinn/cinn_launch_op_test.cc | 2 +- .../cpp/fluid}/cinn/test_helper.h | 0 8 files changed, 52 insertions(+), 52 deletions(-) create mode 100644 test/cpp/fluid/CMakeLists.txt create mode 100644 test/cpp/fluid/cinn/CMakeLists.txt rename {paddle/fluid/operators => test/cpp/fluid}/cinn/cinn_instruction_run_op_test.cc (98%) rename {paddle/fluid/operators => test/cpp/fluid}/cinn/cinn_launch_context_test.cc (100%) rename {paddle/fluid/operators => test/cpp/fluid}/cinn/cinn_launch_op_test.cc (99%) rename {paddle/fluid/operators => test/cpp/fluid}/cinn/test_helper.h (100%) diff --git a/paddle/fluid/operators/cinn/CMakeLists.txt b/paddle/fluid/operators/cinn/CMakeLists.txt index 3a97e275689..b700b2798fc 100644 --- a/paddle/fluid/operators/cinn/CMakeLists.txt +++ b/paddle/fluid/operators/cinn/CMakeLists.txt @@ -29,53 +29,3 @@ set(CINN_OP_DEPS cinn_launch_context transform_type) register_operators(DEPS ${CINN_OP_DEPS}) - -if(WITH_TESTING) - cc_test_old( - cinn_launch_context_test - SRCS - cinn_launch_context_test.cc - DEPS - ddim - lod_tensor - scope - proto_desc - graph - cinn_launch_context - cinn_instruction_run_op - cinn) - target_link_libraries(cinn_launch_context_test ${PYTHON_LIBRARIES}) - set_tests_properties(cinn_launch_context_test PROPERTIES LABELS - "RUN_TYPE=CINN") - - set(CINN_RUN_ENVIRONMENT - "OMP_NUM_THREADS=1;runtime_include_dir=${PADDLE_BINARY_DIR}/third_party/CINN/src/external_cinn/cinn/runtime/cuda" - ) - # cc_test_old( - # cinn_launch_op_test - # SRCS - # cinn_launch_op_test.cc - # DEPS - # cinn_compiler - # cinn_launch_op - # cinn_instruction_run_op - # elementwise_add_op - # gflags) - # set_tests_properties( - # cinn_launch_op_test PROPERTIES LABELS "RUN_TYPE=CINN" ENVIRONMENT - # "${CINN_RUN_ENVIRONMENT}") - - cc_test_old( - cinn_instruction_run_op_test - SRCS - cinn_instruction_run_op_test.cc - DEPS - cinn_compiler - cinn_launch_op - cinn_instruction_run_op - elementwise_add_op) - target_link_libraries(cinn_instruction_run_op_test ${PYTHON_LIBRARIES}) - set_tests_properties( - cinn_instruction_run_op_test PROPERTIES LABELS "RUN_TYPE=CINN" ENVIRONMENT - "${CINN_RUN_ENVIRONMENT}") -endif() diff --git a/test/cpp/CMakeLists.txt b/test/cpp/CMakeLists.txt index 2f395cb62ed..60bdac586c4 100644 --- a/test/cpp/CMakeLists.txt +++ b/test/cpp/CMakeLists.txt @@ -6,3 +6,4 @@ add_subdirectory(imperative) add_subdirectory(ir) add_subdirectory(inference) add_subdirectory(eager) +add_subdirectory(fluid) diff --git a/test/cpp/fluid/CMakeLists.txt b/test/cpp/fluid/CMakeLists.txt new file mode 100644 index 00000000000..e2d08eac64b --- /dev/null +++ b/test/cpp/fluid/CMakeLists.txt @@ -0,0 +1,3 @@ +if(WITH_CINN) + add_subdirectory(cinn) +endif() diff --git a/test/cpp/fluid/cinn/CMakeLists.txt b/test/cpp/fluid/cinn/CMakeLists.txt new file mode 100644 index 00000000000..f396d1c58cc --- /dev/null +++ b/test/cpp/fluid/cinn/CMakeLists.txt @@ -0,0 +1,46 @@ +cc_test_old( + cinn_launch_context_test + SRCS + cinn_launch_context_test.cc + DEPS + ddim + lod_tensor + scope + proto_desc + graph + cinn_launch_context + cinn_instruction_run_op + cinn) +target_link_libraries(cinn_launch_context_test ${PYTHON_LIBRARIES}) +set_tests_properties(cinn_launch_context_test PROPERTIES LABELS "RUN_TYPE=CINN") + +set(CINN_RUN_ENVIRONMENT + "OMP_NUM_THREADS=1;runtime_include_dir=${PADDLE_BINARY_DIR}/third_party/CINN/src/external_cinn/cinn/runtime/cuda" +) +# cc_test_old( +# cinn_launch_op_test +# SRCS +# cinn_launch_op_test.cc +# DEPS +# cinn_compiler +# cinn_launch_op +# cinn_instruction_run_op +# elementwise_add_op +# gflags) +# set_tests_properties( +# cinn_launch_op_test PROPERTIES LABELS "RUN_TYPE=CINN" ENVIRONMENT +# "${CINN_RUN_ENVIRONMENT}") + +cc_test_old( + cinn_instruction_run_op_test + SRCS + cinn_instruction_run_op_test.cc + DEPS + cinn_compiler + cinn_launch_op + cinn_instruction_run_op + elementwise_add_op) +target_link_libraries(cinn_instruction_run_op_test ${PYTHON_LIBRARIES}) +set_tests_properties( + cinn_instruction_run_op_test PROPERTIES LABELS "RUN_TYPE=CINN" ENVIRONMENT + "${CINN_RUN_ENVIRONMENT}") diff --git a/paddle/fluid/operators/cinn/cinn_instruction_run_op_test.cc b/test/cpp/fluid/cinn/cinn_instruction_run_op_test.cc similarity index 98% rename from paddle/fluid/operators/cinn/cinn_instruction_run_op_test.cc rename to test/cpp/fluid/cinn/cinn_instruction_run_op_test.cc index 8b6fa57c5d2..36086a0bd1f 100644 --- a/paddle/fluid/operators/cinn/cinn_instruction_run_op_test.cc +++ b/test/cpp/fluid/cinn/cinn_instruction_run_op_test.cc @@ -20,11 +20,11 @@ limitations under the License. */ #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/framework/paddle2cinn/cinn_compiler.h" #include "paddle/fluid/framework/scope.h" -#include "paddle/fluid/operators/cinn/test_helper.h" #include "paddle/fluid/platform/cpu_helper.h" #include "paddle/fluid/platform/enforce.h" #include "paddle/fluid/platform/init.h" #include "paddle/phi/core/kernel_registry.h" +#include "test/cpp/fluid/cinn/test_helper.h" USE_OP_ITSELF(cinn_launch); USE_OP_ITSELF(cinn_instruction_run); diff --git a/paddle/fluid/operators/cinn/cinn_launch_context_test.cc b/test/cpp/fluid/cinn/cinn_launch_context_test.cc similarity index 100% rename from paddle/fluid/operators/cinn/cinn_launch_context_test.cc rename to test/cpp/fluid/cinn/cinn_launch_context_test.cc diff --git a/paddle/fluid/operators/cinn/cinn_launch_op_test.cc b/test/cpp/fluid/cinn/cinn_launch_op_test.cc similarity index 99% rename from paddle/fluid/operators/cinn/cinn_launch_op_test.cc rename to test/cpp/fluid/cinn/cinn_launch_op_test.cc index 9764c31200f..5765a2c5026 100644 --- a/paddle/fluid/operators/cinn/cinn_launch_op_test.cc +++ b/test/cpp/fluid/cinn/cinn_launch_op_test.cc @@ -24,12 +24,12 @@ limitations under the License. */ #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/framework/paddle2cinn/cinn_compiler.h" #include "paddle/fluid/framework/scope.h" -#include "paddle/fluid/operators/cinn/test_helper.h" #include "paddle/fluid/platform/cpu_helper.h" #include "paddle/fluid/platform/init.h" #include "paddle/phi/core/ddim.h" #include "paddle/phi/core/flags.h" #include "paddle/phi/core/kernel_registry.h" +#include "test/cpp/fluid/cinn/test_helper.h" USE_OP_ITSELF(cinn_launch); USE_OP_ITSELF(cinn_instruction_run); diff --git a/paddle/fluid/operators/cinn/test_helper.h b/test/cpp/fluid/cinn/test_helper.h similarity index 100% rename from paddle/fluid/operators/cinn/test_helper.h rename to test/cpp/fluid/cinn/test_helper.h -- GitLab