0

My class member function definition is in OperatorSave.cpp

template <typename Target>
template <typename U>
typename std::enable_if<is_one_of<U, DPUv2, DPUv3e, DPUv3me, DPUv4e, DPUv4f,
                                  XVDPU, XV2DPU>::value>::type
OperatorSave<Target>::makeImgPoolBySmf_imp(shared_ptr<SwimPool> swimpool,
                                           uint32_t idx_bcg, uint32_t idx_bwg,
                                           uint32_t idx_bdg, uint32_t,
                                           uint32_t src_op_idx,
                                           uint32_t feed_height) {
  ...
}

template class OperatorSave<DPUv2>;        
template class OperatorSave<DPUv3e>;       
template class OperatorSave<DPUv3me>;      
template class OperatorSave<DPUv4e>;       
template class OperatorSave<DPUv4f>;    
template class OperatorSave<XVDPU>;       
template class OperatorSave<XV2DPU>;

As you can see, I have all type of specialization for the class, and in OperatorSave.hpp it has declaration.

  template <typename U = Target>
  typename std::enable_if<is_one_of<U, DPUv2, DPUv3e, DPUv3me, DPUv4e, DPUv4f,
                                    XVDPU, XV2DPU>::value>::type
  makeImgPoolBySmf_imp(shared_ptr<SwimPool> swimpool, uint32_t idx_bcg,
                       uint32_t idx_bwg, uint32_t idx_bdg, uint32_t idx_bhg,
                       uint32_t src_op_idx, uint32_t feed_height);

I only compile OperatorSave.cpp one file

/usr/bin/c++ -DGFLAGS_IS_A_DLL=0 -DGOOGLE_GLOG_DLL_DECL="" -DGOOGLE_GLOG_DLL_DECL_FOR_UNITTESTS="" -DTARGET_FACTORY_USE_DLL=1 -Daicomp_USE_DLL=1 -DXCOM_DEBUG_MODE -DXCOM_INSTALL_FAILURE_FUNC -DXCOM_SKIP_CLEAN_GRAPH -DXIR_USE_DLL=1 -Daicomp_core_EXPORTS -I/my/work/dir/src -I/my/work/dir/src/pass -I/my/work/dir/src/util -I/my/work/dir/src/target -I/my/work/dir/src/dpu -I/my/work/dir/src/AIE2Backend/auto_generate_opcode -I/my/work/dir/src/slnode -I/my/work/dir/src/operator -I/my/work/dir/src/swimpool -I/my/work/dir/src/InstrGenerator -I/my/work/dir/src/DebugManager -I/my/work/dir/src/plugin -I/home/tianchen1/build/aicomp/src -isystem /home/tianchen1/install/include "-fuse-ld=lld" -Wall -Werror -fno-operator-names -g -Wall -Werror -ggdb -O0 -fno-inline -fPIC -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -MD -MT src/CMakeFiles/aicomp-core.dir/operator/DPUv2/OperatorSave.cpp.o -MF CMakeFiles/aicomp-core.dir/operator/DPUv2/OperatorSave.cpp.o.d -o CMakeFiles/aicomp-core.dir/operator/DPUv2/OperatorSave.cpp.o -c /my/work/dir/src/operator/DPUv2/OperatorSave.cpp

and function makeImgPoolBySmf_imp is missing in object file OperatorSave.cpp.o neither do any fdump-tree-all, fdump-rtl-all, fdump-ipa-all*.*** Only -E show the function.

That makes linker error while linking this object file to others because it supposed to contain definition of makeImgPoolBySmf_imp but it not.

I am quite sure the function is not inline because if so, fdump-rlt-inline would have record. Could someone tell me where the symbol goes to?

I already try add __attribute((noinline)) but it doesn't work. If the function is inline to dissappear, fdump-tree-original won't remove it but fdump-tree-optimized do.

  • Instantiation of `OperatorSave` template class does not automatically instantiate template member function `makeImgPoolBySmf_imp`. You need an additional `U` type parameter to further instantiate the function. – Lancern Feb 02 '23 at 09:05
  • thanks @Lancern , the second day I thought out I hadn't specialize the template function which made template by its return type: enable_if_t, of course it won't appear in gcc compile tree. – Benedict William Feb 03 '23 at 07:51

0 Answers0