Skip to content
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

【CMake opt No.12】rm some DEPS of test/cpp/pir/core/CMakeLists.txt #60161

Merged
merged 6 commits into from
Dec 20, 2023
Merged
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
12 changes: 2 additions & 10 deletions test/cpp/pir/core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
paddle_test(type_test SRCS type_test.cc DEPS pir op_dialect_vjp)
Copy link
Member Author

@DrRyanHuang DrRyanHuang Dec 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`type_test` 需要 `pir`
2023-12-20 01:01:24 type_test.cc.obj : 
error LNK2019: unresolved external symbol "public: class pir::Dialect * __cdecl pir::IrContext::GetRegisteredDialect(class std::basic_string,class std::allocator > const &)" (?GetRegisteredDialect@IrContext@pir@@QEAAPEAVDialect@2@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "private: virtual void __cdecl type_test_custom_type_dialect_Test::TestBody(void)" (?TestBody@type_test_custom_type_dialect_Test@@EEAAXXZ)

由于 pirpaddle/pir/CMakeLists.txt

file(GLOB_RECURSE PIR_CPP_SOURCES "*.cc")

包含改目录下所有 cc 文件

`type_test` 需要 `op_dialect_vjp`
2023-12-20 02:22:00 type_test.cc.obj : 
error LNK2019: unresolved external symbol "public: unsigned __int64 const & __cdecl paddle::dialect::SelectedRowsType::offset(void)const " (?offset@SelectedRowsType@dialect@paddle@@QEBAAEB_KXZ) referenced in function "private: virtual void __cdecl type_test_pd_op_dialect_Test::TestBody(void)" (?TestBody@type_test_pd_op_dialect_Test@@EEAAXXZ)

在 op_dialect.cc 文件中创建

set(op_dialect_vjp_srcs
    ${CMAKE_CURRENT_SOURCE_DIR}/operator/ir/manual_op_decomp.cc
    ${CMAKE_CURRENT_SOURCE_DIR}/operator/ir/manual_op_vjp.cc
    ${CMAKE_CURRENT_SOURCE_DIR}/operator/ir/op_dialect.cc
    ${op_decomp_source_file}
    ${op_vjp_source_file}
    ${PADDLE_SOURCE_DIR}/paddle/fluid/primitive/base/decomp_trans.cc)
set(op_dialect_vjp_deps primitive_vjp_experimental op_dialect)

cc_library(
  op_dialect_vjp
  SRCS ${op_dialect_vjp_srcs}
  DEPS ${op_dialect_vjp_deps})

paddle_test(ir_attribute_test SRCS ir_attribute_test.cc DEPS pir)
Copy link
Member Author

@DrRyanHuang DrRyanHuang Dec 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`ir_attribute_test` 需要 `pir`
2023-12-20 01:01:24 ir_attribute_test.cc.obj : 
error LNK2001: unresolved external symbol 
"public: virtual void __cdecl pir::Dialect::PrintOperation(class pir::Operation *,class pir::IrPrinter &)const " 
(?PrintOperation@Dialect@pir@@UEBAXPEAVOperation@2@AEAVIrPrinter@2@@Z)

由于 pirpaddle/pir/CMakeLists.txt

file(GLOB_RECURSE PIR_CPP_SOURCES "*.cc")

包含改目录下所有 cc 文件

paddle_test(ir_value_test SRCS ir_value_test.cc DEPS pir)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`ir_value_test` 需要 `pir`
2023-12-20 01:01:24 ir_value_test.cc.obj : 
error LNK2019: unresolved external symbol "public: static class pir::IrContext * __cdecl pir::IrContext::Instance(void)" (?Instance@IrContext@pir@@SAPEAV12@XZ) referenced in function "private: virtual void __cdecl value_test_value_test_Test::TestBody(void)" (?TestBody@value_test_value_test_Test@@EEAAXXZ)

由于 pirpaddle/pir/CMakeLists.txt

file(GLOB_RECURSE PIR_CPP_SOURCES "*.cc")

包含改目录下所有 cc 文件

paddle_test(
ir_op_test
SRCS
ir_op_test.cc
DEPS
pir
test_dialect
op_dialect_vjp)
paddle_test(ir_op_test SRCS ir_op_test.cc DEPS test_dialect op_dialect_vjp)
paddle_test(ir_region_test SRCS ir_region_test.cc DEPS pir)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`ir_region_test` 需要 `pir`
2023-12-20 01:01:24 ir_region_test.cc.obj : 
error LNK2019: unresolved external symbol "public: class pir::OpInfo __cdecl pir::IrContext::GetRegisteredOpInfo(class std::basic_string,class std::allocator > const &)" (?GetRegisteredOpInfo@IrContext@pir@@QEAA?AVOpInfo@2@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "private: virtual void __cdecl region_erase_op_test_Test::TestBody(void)" (?TestBody@region_erase_op_test_Test@@EEAAXXZ)

由于 pirpaddle/pir/CMakeLists.txt

file(GLOB_RECURSE PIR_CPP_SOURCES "*.cc")

包含改目录下所有 cc 文件

paddle_test(ir_builder_test SRCS ir_builder_test.cc DEPS pir)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`ir_builder_test` 需要 `pir`
2023-12-20 01:01:24 ir_builder_test.cc.obj : 
error LNK2019: unresolved external symbol "public: __cdecl pir::IrContext::IrContext(void)" (??0IrContext@pir@@QEAA@XZ) referenced in function "private: virtual void __cdecl builder_test_type_api_Test::TestBody(void)" (?TestBody@builder_test_type_api_Test@@EEAAXXZ)

由于 pirpaddle/pir/CMakeLists.txt

file(GLOB_RECURSE PIR_CPP_SOURCES "*.cc")

包含改目录下所有 cc 文件

cc_test_old(
Expand Down Expand Up @@ -131,8 +124,7 @@ cc_test_old(
gtest
pir)

paddle_test(block_argument_test SRCS block_argument_test.cc DEPS test_dialect
pir)
paddle_test(block_argument_test SRCS block_argument_test.cc DEPS test_dialect)

Copy link
Member Author

@DrRyanHuang DrRyanHuang Dec 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`block_argument_test` 需要 `test_dialect`
2023-12-19 23:02:37 block_argument_test.cc:
(.text._ZNSt17_Function_handlerIFPN3pir7DialectEvEZNS0_9IrContext20GetOrRegisterDialectIN4test11TestDialectEEEPT_vEUlvE_E9_M_invokeERKSt9_Any_data[_ZNSt17_Function_handlerIFPN3pir7DialectEvEZNS0_9IrContext20GetOrRegisterDialectIN4test11TestDialectEEEPT_vEUlvE_E9_M_invokeERKSt9_Any_data]+0x1f): 
undefined reference to `test::TestDialect::TestDialect(pir::IrContext*)'

if(WITH_ONNXRUNTIME AND WIN32)
# Copy onnxruntime for some c++ test in Windows, since the test will
Expand Down