Skip to content

【paddle_test No.41】replace of cc_test with paddle_test #61946

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions paddle/fluid/framework/ir/fusion_group/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,8 @@ cc_library(
code_generator
SRCS operation.cc code_generator.cc code_generator_helper.cc
DEPS graph subgraph_detector)
if(WITH_GPU OR WITH_ROCM)
cc_test(
test_code_generator
SRCS code_generator_tester.cc
DEPS code_generator phi common lod_tensor graph_viz_pass)
endif()

cc_library(
fusion_group_pass
SRCS fusion_group_pass.cc elementwise_group_detector.cc
DEPS subgraph_detector fuse_pass_base code_generator phi common)
cc_test(
test_fusion_group_pass
SRCS fusion_group_pass_tester.cc
DEPS fusion_group_pass graph_viz_pass)
if(WITH_TESTING AND TEST test_code_generator)
set_tests_properties(test_code_generator PROPERTIES TIMEOUT 120)
endif()
12 changes: 7 additions & 5 deletions paddle/fluid/framework/ir/fusion_group/code_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,16 @@ class SubGraph;

class CodeGenerator {
public:
CodeGenerator();
TEST_API CodeGenerator();

std::string Generate(std::string func_name,
const std::vector<OperationExpression>& expressions);
TEST_API std::string Generate(
std::string func_name,
const std::vector<OperationExpression>& expressions);

std::string Generate(SubGraph* subgraph);
TEST_API std::string Generate(SubGraph* subgraph);

std::vector<OperationExpression> ConvertToExpressions(SubGraph* subgraph);
TEST_API std::vector<OperationExpression> ConvertToExpressions(
SubGraph* subgraph);

private:
std::set<int> DistilInputIds(
Expand Down
4 changes: 2 additions & 2 deletions paddle/fluid/framework/ir/fusion_group/operation.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ struct Operation {

class OperationMap {
public:
OperationMap();
TEST_API OperationMap();

static OperationMap& Instance() {
PADDLE_ENFORCE_NOT_NULL(
Expand Down Expand Up @@ -119,7 +119,7 @@ class OperationMap {
void InsertMultivariateElementwiseOperations();

private:
static OperationMap* map;
TEST_API static OperationMap* map;
std::unordered_map<std::string, Operation> operations_;
DISABLE_COPY_AND_ASSIGN(OperationMap);
};
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/framework/ir/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class Node {
#if !defined(_WIN32) && (__cplusplus < 201703L)
static constexpr char kControlDepVarName[] = "__control_var";
#else
static const char kControlDepVarName[];
TEST_API static const char kControlDepVarName[];
#endif

Type NodeType() const { return type_; }
Expand Down
12 changes: 6 additions & 6 deletions paddle/fluid/framework/ir/pass.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,12 @@ struct PassRegistrar : public Registrar {
&__pass_tmp_registrar_##pass_type##__ UNUSED = \
__pass_registrar_##pass_type##__

#define USE_PASS(pass_type) \
STATIC_ASSERT_PASS_GLOBAL_NAMESPACE( \
__use_pass_itself_##pass_type, \
"USE_PASS must be called in global namespace"); \
extern int TouchPassRegistrar_##pass_type(); \
static int use_pass_itself_##pass_type##_ UNUSED = \
#define USE_PASS(pass_type) \
STATIC_ASSERT_PASS_GLOBAL_NAMESPACE( \
__use_pass_itself_##pass_type, \
"USE_PASS must be called in global namespace"); \
TEST_API extern int TouchPassRegistrar_##pass_type(); \
static int use_pass_itself_##pass_type##_ UNUSED = \
TouchPassRegistrar_##pass_type()

} // namespace ir
Expand Down
10 changes: 5 additions & 5 deletions paddle/phi/backends/device_code.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ class DeviceCode {
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
class GPUDeviceCode : public DeviceCode {
public:
explicit GPUDeviceCode(const Place& place,
const std::string& name,
const std::string& kernel);
bool Compile(bool include_path = false) override;
void Launch(const size_t n, std::vector<void*>* args) const override;
TEST_API explicit GPUDeviceCode(const Place& place,
const std::string& name,
const std::string& kernel);
TEST_API bool Compile(bool include_path = false) override;
TEST_API void Launch(const size_t n, std::vector<void*>* args) const override;

void SetNumThreads(int num_threads) { num_threads_ = num_threads; }
void SetWorkloadPerThread(int workload_per_thread) {
Expand Down
1 change: 1 addition & 0 deletions test/cpp/fluid/framework/ir/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
add_subdirectory(fusion_group)
add_subdirectory(memory_optimize_pass)
13 changes: 13 additions & 0 deletions test/cpp/fluid/framework/ir/fusion_group/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
if(WITH_GPU OR WITH_ROCM)
paddle_test(test_code_generator SRCS code_generator_tester.cc DEPS common)
endif()
if(WITH_TESTING AND TEST test_code_generator)
set_tests_properties(test_code_generator PROPERTIES TIMEOUT 120)
endif()

if(NOT WIN32)
nv_test(
test_fusion_group_pass
SRCS fusion_group_pass_tester.cc
DEPS fusion_group_pass graph_viz_pass)
endif()