diff --git a/paddle/pten/core/CMakeLists.txt b/paddle/pten/core/CMakeLists.txt index 181012732fa35b58cfffcd932926691375453a5d..b281f95f36bbd9100987a7d92c03822131ff0200 100644 --- a/paddle/pten/core/CMakeLists.txt +++ b/paddle/pten/core/CMakeLists.txt @@ -23,12 +23,6 @@ cc_library(infermeta_utils SRCS infermeta_utils.cc DEPS meta_tensor) cc_test(unroll_array_ops_test SRCS unroll_array_ops_test.cc) cc_library(ddim SRCS ddim.cc DEPS eigen3 boost enforce) -cc_test(ddim_test SRCS ddim_test.cc DEPS ddim) -if(WITH_GPU) - nv_test(dim_test SRCS dim_test.cu DEPS ddim) -elseif(WITH_ROCM) - hip_test(dim_test SRCS dim_test.cu DEPS ddim) -endif() cc_library(selected_rows SRCS selected_rows.cc DEPS dense_tensor mixed_vector enforce ddim) diff --git a/paddle/pten/tests/core/CMakeLists.txt b/paddle/pten/tests/core/CMakeLists.txt index 363a57f036b9bb39fef9007e80073f83f3045bea..43e1480e2c41e3e0a5cc2a57597a83d306e709ed 100644 --- a/paddle/pten/tests/core/CMakeLists.txt +++ b/paddle/pten/tests/core/CMakeLists.txt @@ -4,6 +4,14 @@ cc_test(test_type_info SRCS test_type_info.cc) cc_test(test_convert_utils SRCS test_convert_utils.cc DEPS convert_utils) cc_test(test_kernel_factory SRCS test_kernel_factory.cc DEPS kernel_factory scale_kernel) cc_test(test_pten_device_context SRCS test_device_context.cc DEPS pten_context cpu_context) + +cc_test(test_ddim SRCS test_ddim.cc DEPS ddim) +if(WITH_GPU) + nv_test(test_dim SRCS test_dim.cu DEPS ddim) +elseif(WITH_ROCM) + hip_test(test_dim SRCS test_dim.cu DEPS ddim) +endif() + cc_test(selected_rows_test SRCS test_selected_rows.cc DEPS selected_rows) if(WITH_TESTING AND TEST selected_rows_test) set_tests_properties(selected_rows_test PROPERTIES TIMEOUT 120) diff --git a/paddle/pten/core/ddim_test.cc b/paddle/pten/tests/core/test_ddim.cc similarity index 96% rename from paddle/pten/core/ddim_test.cc rename to paddle/pten/tests/core/test_ddim.cc index 1903bbfdff135ebd19d0cef258401f13fe11fa04..b13fe68ef57afd5d67bed60d901f7fdc084aa1aa 100644 --- a/paddle/pten/core/ddim_test.cc +++ b/paddle/pten/tests/core/test_ddim.cc @@ -17,6 +17,9 @@ #include "gtest/gtest.h" #include "paddle/pten/core/ddim.h" +namespace pten { +namespace tests { + TEST(DDim, Equality) { // construct a DDim from an initialization list pten::framework::DDim ddim = pten::framework::make_ddim({9, 1, 5}); @@ -81,3 +84,6 @@ TEST(DDim, Print) { ss << ddim; EXPECT_EQ("2, 3, 4", ss.str()); } + +} // namespace tests +} // namespace pten diff --git a/paddle/pten/core/dim_test.cu b/paddle/pten/tests/core/test_dim.cu similarity index 96% rename from paddle/pten/core/dim_test.cu rename to paddle/pten/tests/core/test_dim.cu index 0f8d71c5d3b4cfb33b59e82709ac8bac51d18e6f..1c4a9c163f9434d06bc01e8976728651c156e233 100644 --- a/paddle/pten/core/dim_test.cu +++ b/paddle/pten/tests/core/test_dim.cu @@ -18,6 +18,9 @@ #include "gtest/gtest.h" #include "paddle/pten/core/dim.h" +namespace pten { +namespace tests { + __global__ void test(pten::framework::Dim<2>* o) { o[0] = pten::framework::make_dim(5, 6); } @@ -94,4 +97,7 @@ TEST(Dim, Print) { ss << pten::framework::make_dim(8); EXPECT_EQ(ss.str(), "8"); } -} \ No newline at end of file +} + +} // namespace tests +} // namespace pten \ No newline at end of file