diff --git a/paddle/fluid/operators/cinn/CMakeLists.txt b/paddle/fluid/operators/cinn/CMakeLists.txt index 3a97e275689ed032b3fdebd56d6b4be62c7b30af..b700b2798fcd8a32ae2e834f98c539fdaaaea46b 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 2f395cb62ed65037887d320fa4877ef5e485139d..60bdac586c49b04f6086bc27afcb8f9b8cda908a 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 0000000000000000000000000000000000000000..e2d08eac64b73cf56552bc791bdcb6d9e4394d3f --- /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 0000000000000000000000000000000000000000..f396d1c58cccc930cc9f91cf7a91d0d64d882131 --- /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 8b6fa57c5d2b60ae5fc4acaa6e84436b2243f214..36086a0bd1fab3d8e28c2d09fd57384fefdc5d54 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 9764c31200f9e4c020e43e0ae5acaf923f1395ac..5765a2c50269eee1db4b03f8f909cea017475166 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