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

编译最新 develop ,在链接 inline_translator_test 大量报错 undefined reference to xxxx #70290

Open
LittleHeroZZZX opened this issue Dec 18, 2024 · 3 comments
Assignees

Comments

@LittleHeroZZZX
Copy link
Contributor

bug描述 Describe the Bug

Docker 编译,使用的镜像为:paddle:3.0.0b2-gpu-cuda12.3-cudnn9.0-trt8.6

CMake 配置命令为:cmake .. -DPY_VERSION=3.10 -DWITH_GPU=ON -DWITH_TESTING=ON -DWITH_CINN=ON -DWITH_NCCL=OFF -DCUDA_ARCH_NAME=Manual -DCUDA_ARCH_BIN=80 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=1

Make Log:

[  7%] Linking CXX executable inline_translator_test
/usr/local/bin/ld: /usr/local/bin/ld: DWARF error: can't find .debug_ranges section.
CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o: in function `cinn::common::Context::NewName(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
inline_translator_test.cc:(.text._ZN4cinn6common7Context7NewNameERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN4cinn6common7Context7NewNameERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x32): undefined reference to `cinn::common::NameGenerator::New(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o: in function `cinn::common::UniqName(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
inline_translator_test.cc:(.text._ZN4cinn6commonL8UniqNameERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x11): undefined reference to `cinn::common::Context::Global()'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o: in function `pir::Operation::result(unsigned int) const':
inline_translator_test.cc:(.text._ZNK3pir9Operation6resultEj[_ZNK3pir9Operation6resultEj]+0x1c): undefined reference to `pir::Operation::op_result_impl(unsigned int) const'
/usr/local/bin/ld: inline_translator_test.cc:(.text._ZNK3pir9Operation6resultEj[_ZNK3pir9Operation6resultEj]+0x2e): undefined reference to `pir::OpResult::OpResult(pir::detail::OpResultImpl*)'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o: in function `pir::Operation::operand(unsigned int) const':
inline_translator_test.cc:(.text._ZNK3pir9Operation7operandEj[_ZNK3pir9Operation7operandEj]+0x1c): undefined reference to `pir::Operation::op_operand_impl(unsigned int) const'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o:(.data.rel.ro._ZN3phiL16gpuGraphGetNodesE+0x0): undefined reference to `cudaGraphGetNodes'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o:(.data.rel.ro._ZN3phiL16gpuGraphGetEdgesE+0x0): undefined reference to `cudaGraphGetEdges'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o:(.data.rel.ro._ZN3phiL14gpuGraphLaunchE+0x0): undefined reference to `cudaGraphLaunch'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o:(.data.rel.ro._ZN3phiL15gpuGraphDestroyE+0x0): undefined reference to `cudaGraphDestroy'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o:(.data.rel.ro._ZN3phiL19gpuGraphExecDestroyE+0x0): undefined reference to `cudaGraphExecDestroy'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o:(.data.rel.ro._ZN3phiL19gpuGraphNodeGetTypeE+0x0): undefined reference to `cudaGraphNodeGetType'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o:(.data.rel.ro._ZN3phiL31gpuGraphExecKernelNodeSetParamsE+0x0): undefined reference to `cudaGraphExecKernelNodeSetParams'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o:(.data.rel.ro._ZN3phiL27gpuGraphKernelNodeGetParamsE+0x0): undefined reference to `cudaGraphKernelNodeGetParams'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o:(.data.rel.ro._ZN3phiL27gpuStreamCreateWithPriorityE+0x0): undefined reference to `cudaStreamCreateWithPriority'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o:(.data.rel.ro._ZN3phiL21gpuStreamBeginCaptureE+0x0): undefined reference to `cudaStreamBeginCapture'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o:(.data.rel.ro._ZN3phiL19gpuStreamEndCaptureE+0x0): undefined reference to `cudaStreamEndCapture'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o:(.data.rel.ro._ZN3phiL23gpuStreamGetCaptureInfoE+0x0): undefined reference to `cudaStreamGetCaptureInfo_v2'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o:(.data.rel.ro._ZN3phiL23gpuEventCreateWithFlagsE+0x0): undefined reference to `cudaEventCreateWithFlags'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o:(.data.rel.ro._ZN3phiL14gpuEventRecordE+0x0): undefined reference to `cudaEventRecord'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o:(.data.rel.ro._ZN3phiL15gpuEventDestroyE+0x0): undefined reference to `cudaEventDestroy'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o:(.data.rel.ro._ZN3phiL13gpuEventQueryE+0x0): undefined reference to `cudaEventQuery'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o:(.data.rel.ro._ZN3phiL19gpuEventSynchronizeE+0x0): undefined reference to `cudaEventSynchronize'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o: in function `pir::BasicIrPrinter::BasicIrPrinter(std::ostream&)':
inline_translator_test.cc:(.text._ZN3pir14BasicIrPrinterC2ERSo[_ZN3pir14BasicIrPrinterC5ERSo]+0xf): undefined reference to `vtable for pir::BasicIrPrinter'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o: in function `pir::IrPrinter::IrPrinter(std::ostream&)':
inline_translator_test.cc:(.text._ZN3pir9IrPrinterC2ERSo[_ZN3pir9IrPrinterC5ERSo]+0x26): undefined reference to `vtable for pir::IrPrinter'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o: in function `cinn::fusion::GetOpPatternKind(pir::Operation const*)':
inline_translator_test.cc:(.text._ZN4cinn6fusionL16GetOpPatternKindEPKN3pir9OperationE+0x14): undefined reference to `cinn::hlir::framework::pir::CompatibleInfo::OpKind(pir::Operation const&)'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o: in function `cinn::fusion::GetRank(pir::Value)':
inline_translator_test.cc:(.text._ZN4cinn6fusionL7GetRankEN3pir5ValueE+0x20): undefined reference to `pir::Value::type() const'
/usr/local/bin/ld: inline_translator_test.cc:(.text._ZN4cinn6fusionL7GetRankEN3pir5ValueE+0x1f2): undefined reference to `pir::Value::type() const'
/usr/local/bin/ld: inline_translator_test.cc:(.text._ZN4cinn6fusionL7GetRankEN3pir5ValueE+0x212): undefined reference to `pir::DenseTensorType::dims() const'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o: in function `pir::IrPrinter::~IrPrinter()':
inline_translator_test.cc:(.text._ZN3pir9IrPrinterD2Ev[_ZN3pir9IrPrinterD5Ev]+0xf): undefined reference to `vtable for pir::IrPrinter'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o: in function `cinn::fusion::OpsDebugStr(std::vector<pir::Operation*, std::allocator<pir::Operation*> >)':
inline_translator_test.cc:(.text._ZN4cinn6fusionL11OpsDebugStrESt6vectorIPN3pir9OperationESaIS4_EE+0xa4): undefined reference to `pir::IrPrinter::PrintOperation(pir::Operation const&)'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o: in function `cinn::fusion::ValueDim::ValueDim(pir::Value, unsigned long)::{lambda(pir::Value const&)#1}::operator()(pir::Value const&) const':
inline_translator_test.cc:(.text._ZZN4cinn6fusion8ValueDimC4EN3pir5ValueEmENKUlRKS3_E_clES5_[_ZZN4cinn6fusion8ValueDimC4EN3pir5ValueEmENKUlRKS3_E_clES5_]+0x27): undefined reference to `pir::Value::defining_op() const'
/usr/local/bin/ld: inline_translator_test.cc:(.text._ZZN4cinn6fusion8ValueDimC4EN3pir5ValueEmENKUlRKS3_E_clES5_[_ZZN4cinn6fusion8ValueDimC4EN3pir5ValueEmENKUlRKS3_E_clES5_]+0x40): undefined reference to `pir::Value::defining_op() const'
/usr/local/bin/ld: inline_translator_test.cc:(.text._ZZN4cinn6fusion8ValueDimC4EN3pir5ValueEmENKUlRKS3_E_clES5_[_ZZN4cinn6fusion8ValueDimC4EN3pir5ValueEmENKUlRKS3_E_clES5_]+0x54): undefined reference to `pir::Value::use_empty() const'
/usr/local/bin/ld: inline_translator_test.cc:(.text._ZZN4cinn6fusion8ValueDimC4EN3pir5ValueEmENKUlRKS3_E_clES5_[_ZZN4cinn6fusion8ValueDimC4EN3pir5ValueEmENKUlRKS3_E_clES5_]+0x210): undefined reference to `pir::Value::first_use() const'
/usr/local/bin/ld: inline_translator_test.cc:(.text._ZZN4cinn6fusion8ValueDimC4EN3pir5ValueEmENKUlRKS3_E_clES5_[_ZZN4cinn6fusion8ValueDimC4EN3pir5ValueEmENKUlRKS3_E_clES5_]+0x220): undefined reference to `pir::OpOperand::owner() const'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o: in function `cinn::fusion::ValueDim::ValueDim(pir::Value, unsigned long)':
inline_translator_test.cc:(.text._ZN4cinn6fusion8ValueDimC2EN3pir5ValueEm[_ZN4cinn6fusion8ValueDimC5EN3pir5ValueEm]+0x3d): undefined reference to `pir::ShapeAnalysisManager::Instance()'
/usr/local/bin/ld: inline_translator_test.cc:(.text._ZN4cinn6fusion8ValueDimC2EN3pir5ValueEm[_ZN4cinn6fusion8ValueDimC5EN3pir5ValueEm]+0x5b): undefined reference to `pir::Operation::GetParentProgram()'
/usr/local/bin/ld: inline_translator_test.cc:(.text._ZN4cinn6fusion8ValueDimC2EN3pir5ValueEm[_ZN4cinn6fusion8ValueDimC5EN3pir5ValueEm]+0x66): undefined reference to `pir::ShapeAnalysisManager::Get(pir::Program const*)'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o: in function `cinn::fusion::ValueDim::GetSymbolicDim() const':
inline_translator_test.cc:(.text._ZNK4cinn6fusion8ValueDim14GetSymbolicDimEv[_ZNK4cinn6fusion8ValueDim14GetSymbolicDimEv]+0x1ad): undefined reference to `pir::ShapeConstraintIRAnalysis::GetProductDimExpr(pir::Value, std::vector<int, std::allocator<int> > const&)'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o: in function `cinn::fusion::FindDownstreamOps(pir::Operation*)':
inline_translator_test.cc:(.text._ZN4cinn6fusionL17FindDownstreamOpsEPN3pir9OperationE+0x46): undefined reference to `pir::Value::use_begin() const'
/usr/local/bin/ld: inline_translator_test.cc:(.text._ZN4cinn6fusionL17FindDownstreamOpsEPN3pir9OperationE+0x60): undefined reference to `pir::OpOperand::owner() const'
/usr/local/bin/ld: inline_translator_test.cc:(.text._ZN4cinn6fusionL17FindDownstreamOpsEPN3pir9OperationE+0x8f): undefined reference to `pir::Value::use_end() const'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o: in function `cinn::fusion::GetUsageIdx(pir::Value const&, pir::Operation*)':
inline_translator_test.cc:(.text._ZN4cinn6fusionL11GetUsageIdxERKN3pir5ValueEPNS1_9OperationE+0x2c): undefined reference to `pir::Value::use_begin() const'
/usr/local/bin/ld: inline_translator_test.cc:(.text._ZN4cinn6fusionL11GetUsageIdxERKN3pir5ValueEPNS1_9OperationE+0x46): undefined reference to `pir::OpOperand::owner() const'
/usr/local/bin/ld: inline_translator_test.cc:(.text._ZN4cinn6fusionL11GetUsageIdxERKN3pir5ValueEPNS1_9OperationE+0x7d): undefined reference to `pir::Value::use_end() const'
/usr/local/bin/ld: inline_translator_test.cc:(.text._ZN4cinn6fusionL11GetUsageIdxERKN3pir5ValueEPNS1_9OperationE+0xbb): undefined reference to `pir::Operation::name[abi:cxx11]() const'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o: in function `cinn::fusion::GetOperandIdx(pir::Value const&, pir::Operation*)':
inline_translator_test.cc:(.text._ZN4cinn6fusionL13GetOperandIdxERKN3pir5ValueEPNS1_9OperationE+0x46): undefined reference to `pir::OpOperand::source() const'
/usr/local/bin/ld: inline_translator_test.cc:(.text._ZN4cinn6fusionL13GetOperandIdxERKN3pir5ValueEPNS1_9OperationE+0x60): undefined reference to `pir::Value::operator==(pir::Value const&) const'
/usr/local/bin/ld: inline_translator_test.cc:(.text._ZN4cinn6fusionL13GetOperandIdxERKN3pir5ValueEPNS1_9OperationE+0xb1): undefined reference to `pir::Operation::name[abi:cxx11]() const'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o: in function `cinn::fusion::GetResultIdx(pir::Value const&, pir::Operation*)':
inline_translator_test.cc:(.text._ZN4cinn6fusionL12GetResultIdxERKN3pir5ValueEPNS1_9OperationE+0x58): undefined reference to `pir::Value::operator==(pir::Value const&) const'
/usr/local/bin/ld: inline_translator_test.cc:(.text._ZN4cinn6fusionL12GetResultIdxERKN3pir5ValueEPNS1_9OperationE+0xa9): undefined reference to `pir::Operation::name[abi:cxx11]() const'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o: in function `cinn::fusion::FindUserOp(std::vector<pir::Operation*, std::allocator<pir::Operation*> > const&, pir::Value const&)':
inline_translator_test.cc:(.text._ZN4cinn6fusionL10FindUserOpERKSt6vectorIPN3pir9OperationESaIS4_EERKNS2_5ValueE+0x29): undefined reference to `pir::Value::use_begin() const'
/usr/local/bin/ld: inline_translator_test.cc:(.text._ZN4cinn6fusionL10FindUserOpERKSt6vectorIPN3pir9OperationESaIS4_EERKNS2_5ValueE+0xd3): undefined reference to `pir::Value::use_end() const'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o: in function `cinn::fusion::IsDirectUpstream(pir::Operation const*, pir::Operation const*)':
inline_translator_test.cc:(.text._ZN4cinn6fusionL16IsDirectUpstreamEPKN3pir9OperationES4_+0x2e): undefined reference to `pir::Operation::results() const'
/usr/local/bin/ld: inline_translator_test.cc:(.text._ZN4cinn6fusionL16IsDirectUpstreamEPKN3pir9OperationES4_+0x81): undefined reference to `pir::Operation::operands() const'
/usr/local/bin/ld: inline_translator_test.cc:(.text._ZN4cinn6fusionL16IsDirectUpstreamEPKN3pir9OperationES4_+0xd0): undefined reference to `pir::OpOperand::source() const'
/usr/local/bin/ld: inline_translator_test.cc:(.text._ZN4cinn6fusionL16IsDirectUpstreamEPKN3pir9OperationES4_+0xe7): undefined reference to `pir::Value::operator==(pir::Value const&) const'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o: in function `pir::ValueUseIterator<pir::OpOperand>::operator++()':
inline_translator_test.cc:(.text._ZN3pir16ValueUseIteratorINS_9OpOperandEEppEv[_ZN3pir16ValueUseIteratorINS_9OpOperandEEppEv]+0x14): undefined reference to `pir::OpOperand::next_use() const'
/usr/local/bin/ld: inline_translator_test.cc:(.text._ZN3pir16ValueUseIteratorINS_9OpOperandEEppEv[_ZN3pir16ValueUseIteratorINS_9OpOperandEEppEv]+0x2b): undefined reference to `pir::OpOperand::operator=(pir::OpOperand const&)'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o: in function `pir::ValueUseIterator<pir::OpOperand>::owner() const':
inline_translator_test.cc:(.text._ZNK3pir16ValueUseIteratorINS_9OpOperandEE5ownerEv[_ZNK3pir16ValueUseIteratorINS_9OpOperandEE5ownerEv]+0x14): undefined reference to `pir::OpOperand::owner() const'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o: in function `pir::Type::CastUtil<pir::DenseTensorType, void>::call(pir::Type)':
inline_translator_test.cc:(.text._ZN3pir4Type8CastUtilINS_15DenseTensorTypeEvE4callES0_[_ZN3pir4Type8CastUtilINS_15DenseTensorTypeEvE4callES0_]+0x14): undefined reference to `pir::DenseTensorType::dyn_cast_impl(pir::Type)'
/usr/local/bin/ld: CMakeFiles/inline_translator_test.dir/inline_translator_test.cc.o: in function `pir::isa_impl<pir::DenseTensorType, pir::Type, void>::call(pir::Type const&)':
inline_translator_test.cc:(.text._ZN3pir8isa_implINS_15DenseTensorTypeENS_4TypeEvE4callERKS2_[_ZN3pir8isa_implINS_15DenseTensorTypeENS_4TypeEvE4callERKS2_]+0x17): undefined reference to `pir::DenseTensorType::classof(pir::Type)'
collect2: error: ld returned 1 exit status
make[2]: *** [paddle/cinn/adt/CMakeFiles/inline_translator_test.dir/build.make:120: paddle/cinn/adt/inline_translator_test] Error 1
make[1]: *** [CMakeFiles/Makefile2:9824: paddle/cinn/adt/CMakeFiles/inline_translator_test.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

其他补充信息 Additional Supplementary Information

No response

@LittleHeroZZZX LittleHeroZZZX changed the title 编译最新 develop 报错:/usr/local/bin/ld: /usr/local/bin/ld: DWARF error: can't find .debug_ranges section. 编译最新 develop ,在链接 inline_translator_test 大量报错 undefined reference to xxxx Dec 18, 2024
@LittleHeroZZZX
Copy link
Contributor Author

cinn::common::Context::NewName这个函数在 paddle/cinn/common/context.cc 路径下,该文件最终被编译为cinnapi动态库,但是inline_translator_test这个目标似乎并没有声明需要依赖 cinnapi 或者 cinncore,这是预期的吗?

cinn_cc_test(
inline_translator_test
SRCS
inline_translator_test.cc
DEPS
gtest
glog
absl)

@LittleHeroZZZX
Copy link
Contributor Author

Update:

在 docker 把构建类型改成 Release 可以顺利编译,但是调试起来就不方便了 😭

@gongshaotian
Copy link
Contributor

cinn::common::Context::NewName这个函数在 paddle/cinn/common/context.cc 路径下,该文件最终被编译为cinnapi动态库,但是inline_translator_test这个目标似乎并没有声明需要依赖 cinnapi 或者 cinncore,这是预期的吗?

cinn_cc_test(
inline_translator_test
SRCS
inline_translator_test.cc
DEPS
gtest
glog
absl)

已转给对应的同学进行单测迁移

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants