UIUC-ChenLab / scalehls

A scalable High-Level Synthesis framework on MLIR
Other
228 stars 47 forks source link

Error: ScaleHLS build error #70

Closed Zhichenzzz closed 1 year ago

Zhichenzzz commented 1 year ago

Hello! I'm currently working on building ScaleHLS, and I've run into an issue related to MLIR argument. Here is the error message I'm encountering:

scalehls/lib/Dialect/HLS/Utils.cpp:154:23: error: cannot convert ‘mlir::ValueRange’ to ‘mlir::TypeRange’
  154 |   block->addArguments(ValueRange(inputs.getArrayRef()), inputLocs);
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                       |
      |                       mlir::ValueRange
scalehls/lib/Dialect/HLS/Utils.cpp:156:23: error: cannot convert ‘mlir::ValueRange’ to ‘mlir::TypeRange’
  156 |   block->addArguments(ValueRange(params.getArrayRef()), paramLocs);
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                       |
      |                       mlir::ValueRange

Could you please help me understand and resolve this error? Thx!

chhzh123 commented 1 year ago

It seems we can append a TypeRange before the ValueRange to pass the compilation, but I further encountered the linking problem as shown below:

/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: ../../../../lib/libMLIRHLS.a(HLS.cpp.o): in function `mlir::scalehls::hls::TaskOp::isLivein(mlir::Value)':
/scratch/users/hc676/project/scalehls/lib/Dialect/HLS/HLS.cpp:161: undefined reference to `mlir::Liveness::Liveness(mlir::Operation*)'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: /scratch/users/hc676/project/scalehls/lib/Dialect/HLS/HLS.cpp:161: undefined reference to `mlir::Liveness::getLiveIn(mlir::Block*) const'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: ../../../../lib/libMLIRHLS.a(HLS.cpp.o): in function `mlir::scalehls::hls::TaskOp::getLiveins()':
/scratch/users/hc676/project/scalehls/lib/Dialect/HLS/HLS.cpp:166: undefined reference to `mlir::Liveness::Liveness(mlir::Operation*)'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: /scratch/users/hc676/project/scalehls/lib/Dialect/HLS/HLS.cpp:166: undefined reference to `mlir::Liveness::getLiveIn(mlir::Block*) const'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: ../../../../lib/libMLIRHLS.a(HLS.cpp.o): in function `(anonymous namespace)::AlwaysTrueOrFalseSelect::matchAndRewrite(mlir::scalehls::hls::AffineSelectOp, mlir::PatternRewriter&) const':
/scratch/users/hc676/project/scalehls/lib/Dialect/HLS/HLS.cpp:886: undefined reference to `mlir::FlatAffineValueConstraints::FlatAffineValueConstraints(mlir::IntegerSet)'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: /scratch/users/hc676/project/scalehls/lib/Dialect/HLS/HLS.cpp:895: undefined reference to `mlir::FlatAffineValueConstraints::addAffineForOpDomain(mlir::AffineForOp)'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: /scratch/users/hc676/project/scalehls/lib/Dialect/HLS/HLS.cpp:898: undefined reference to `mlir::presburger::IntegerRelation::isEmpty() const'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: ../../../../lib/libMLIRHLS.a(HLS.cpp.o): in function `mlir::presburger::IntegerRelation::~IntegerRelation()':
/scratch/users/hc676/project/scalehls/polygeist/llvm-project/llvm/../mlir/include/mlir/Analysis/Presburger/IntegerRelation.h:80: undefined reference to `vtable for mlir::presburger::IntegerRelation'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: ../../../../lib/libMLIRHLS.a(HLS.cpp.o): in function `mlir::presburger::IntegerPolyhedron::~IntegerPolyhedron()':
/scratch/users/hc676/project/scalehls/polygeist/llvm-project/llvm/../mlir/include/mlir/Analysis/Presburger/IntegerRelation.h:804: undefined reference to `vtable for mlir::presburger::IntegerPolyhedron'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: ../../../../lib/libMLIRHLS.a(HLS.cpp.o): in function `mlir::FlatAffineValueConstraints::~FlatAffineValueConstraints()':
/scratch/users/hc676/project/scalehls/polygeist/llvm-project/llvm/../mlir/include/mlir/Dialect/Affine/Analysis/AffineStructures.h:41: undefined reference to `vtable for mlir::FlatAffineValueConstraints'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: ../../../../lib/libMLIRHLS.a(Utils.cpp.o): in function `mlir::scalehls::getDistributedFactors(unsigned int, llvm::SmallVectorImpl<mlir::AffineForOp> const&)':
/scratch/users/hc676/project/scalehls/lib/Dialect/HLS/Utils.cpp:342: undefined reference to `mlir::getConstantTripCount(mlir::AffineForOp)'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: ../../../../lib/libMLIRHLS.a(Utils.cpp.o): in function `mlir::scalehls::getEvenlyDistributedFactors(unsigned int, llvm::SmallVector<unsigned int, 8u>&, llvm::SmallVectorImpl<mlir::AffineForOp> const&)':
/scratch/users/hc676/project/scalehls/lib/Dialect/HLS/Utils.cpp:373: undefined reference to `mlir::getConstantTripCount(mlir::AffineForOp)'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: ../../../../lib/libMLIRHLS.a(Utils.cpp.o): in function `mlir::scalehls::ifAlwaysTrueOrFalse(mlir::AffineIfOp)':
/scratch/users/hc676/project/scalehls/lib/Dialect/HLS/Utils.cpp:456: undefined reference to `mlir::FlatAffineValueConstraints::addAffineIfOpDomain(mlir::AffineIfOp)'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: /scratch/users/hc676/project/scalehls/lib/Dialect/HLS/Utils.cpp:460: undefined reference to `mlir::FlatAffineValueConstraints::addAffineForOpDomain(mlir::AffineForOp)'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: /scratch/users/hc676/project/scalehls/lib/Dialect/HLS/Utils.cpp:489: undefined reference to `mlir::presburger::IntegerRelation::isEmpty() const'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: ../../../../lib/libMLIRHLS.a(Utils.cpp.o): in function `mlir::scalehls::getCommonSurroundingLoops(mlir::Operation*, mlir::Operation*, llvm::SmallVector<mlir::AffineForOp, 6u>*)':
/scratch/users/hc676/project/scalehls/lib/Dialect/HLS/Utils.cpp:615: undefined reference to `mlir::getLoopIVs(mlir::Operation&, llvm::SmallVectorImpl<mlir::AffineForOp>*)'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: /scratch/users/hc676/project/scalehls/lib/Dialect/HLS/Utils.cpp:616: undefined reference to `mlir::getLoopIVs(mlir::Operation&, llvm::SmallVectorImpl<mlir::AffineForOp>*)'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: ../../../../lib/libMLIRHLS.a(Utils.cpp.o): in function `mlir::scalehls::getParallelAndReductionLoopBand(llvm::SmallVector<mlir::AffineForOp, 6u> const&, llvm::SmallVector<mlir::AffineForOp, 6u>&, llvm::SmallVector<mlir::AffineForOp, 6u>&)':
/scratch/users/hc676/project/scalehls/lib/Dialect/HLS/Utils.cpp:784: undefined reference to `mlir::isLoopParallel(mlir::AffineForOp, llvm::SmallVectorImpl<mlir::LoopReduction>*)'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: /scratch/users/hc676/project/scalehls/lib/Dialect/HLS/Utils.cpp:788: undefined reference to `mlir::isLoopParallel(mlir::AffineForOp, llvm::SmallVectorImpl<mlir::LoopReduction>*)'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: /scratch/users/hc676/project/scalehls/lib/Dialect/HLS/Utils.cpp:792: undefined reference to `mlir::isLoopParallel(mlir::AffineForOp, llvm::SmallVectorImpl<mlir::LoopReduction>*)'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: ../../../../lib/libMLIRHLS.a(Utils.cpp.o): in function `mlir::scalehls::getAverageTripCount(mlir::AffineForOp)':
/scratch/users/hc676/project/scalehls/lib/Dialect/HLS/Utils.cpp:879: undefined reference to `mlir::getConstantTripCount(mlir::AffineForOp)'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: ../../../../lib/libMLIRHLS.a(Utils.cpp.o): in function `mlir::scalehls::checkDependence(mlir::Operation*, mlir::Operation*)':
/scratch/users/hc676/project/scalehls/lib/Dialect/HLS/Utils.cpp:913: undefined reference to `mlir::MemRefAccess::MemRefAccess(mlir::Operation*)'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: /scratch/users/hc676/project/scalehls/lib/Dialect/HLS/Utils.cpp:913: undefined reference to `mlir::MemRefAccess::MemRefAccess(mlir::Operation*)'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: /scratch/users/hc676/project/scalehls/lib/Dialect/HLS/Utils.cpp:914: undefined reference to `mlir::checkMemrefAccessDependence(mlir::MemRefAccess const&, mlir::MemRefAccess const&, unsigned int, mlir::FlatAffineValueConstraints*, llvm::SmallVector<mlir::DependenceComponent, 2u>*, bool)'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: ../../../../lib/libMLIRHLS.a(Utils.cpp.o): in function `mlir::presburger::IntegerRelation::IntegerRelation(unsigned int, unsigned int, unsigned int, mlir::presburger::PresburgerSpace const&)':
/scratch/users/hc676/project/scalehls/polygeist/llvm-project/llvm/../mlir/include/mlir/Analysis/Presburger/IntegerRelation.h:70: undefined reference to `vtable for mlir::presburger::IntegerRelation'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: /scratch/users/hc676/project/scalehls/polygeist/llvm-project/llvm/../mlir/include/mlir/Analysis/Presburger/IntegerRelation.h:70: undefined reference to `mlir::presburger::Matrix::Matrix(unsigned int, unsigned int, unsigned int, unsigned int)'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: /scratch/users/hc676/project/scalehls/polygeist/llvm-project/llvm/../mlir/include/mlir/Analysis/Presburger/IntegerRelation.h:70: undefined reference to `mlir::presburger::Matrix::Matrix(unsigned int, unsigned int, unsigned int, unsigned int)'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: ../../../../lib/libMLIRHLS.a(Utils.cpp.o): in function `mlir::presburger::IntegerPolyhedron::IntegerPolyhedron(unsigned int, unsigned int, unsigned int, mlir::presburger::PresburgerSpace const&)':
/scratch/users/hc676/project/scalehls/polygeist/llvm-project/llvm/../mlir/include/mlir/Analysis/Presburger/IntegerRelation.h:812: undefined reference to `vtable for mlir::presburger::IntegerPolyhedron'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: ../../../../lib/libMLIRHLS.a(Utils.cpp.o): in function `mlir::FlatAffineValueConstraints::FlatAffineValueConstraints(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, llvm::ArrayRef<llvm::Optional<mlir::Value> >)':
/scratch/users/hc676/project/scalehls/polygeist/llvm-project/llvm/../mlir/include/mlir/Dialect/Affine/Analysis/AffineStructures.h:53: undefined reference to `vtable for mlir::FlatAffineValueConstraints'
Zhichenzzz commented 1 year ago

@chhzh123 After the error you described, there will be the following error. I think this is reason why scalehls-translate did not compile successfully.

collect2: error: ld returned 1 exit status
make[2]: *** [tools/scalehls/tools/scalehls-translate/CMakeFiles/scalehls-translate.dir/build.make:384: bin/scalehls-translate] Error 1
make[1]: *** [CMakeFiles/Makefile2:160111: tools/scalehls/tools/scalehls-translate/CMakeFiles/scalehls-translate.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
Zhichenzzz commented 1 year ago

It can be fixed when we use clang to compile ScaleHLS instead of gcc