tkclimb opened a new issue #4498: [SDACCEL] build failure with USE_SDACCEL and 
confirmation of the bug fix
URL: https://github.com/apache/incubator-tvm/issues/4498
 
 
   When I tried to build tvm with `USE_SDACCEL=ON` , I found it failed with the 
following error. 
   
   ```shell
   ➜ cmake --build .
   [20/116] Building CXX object 
CMakeFiles/tvm.dir/src/runtime/opencl/sdaccel/sdaccel_module.cc.o
   FAILED: CMakeFiles/tvm.dir/src/runtime/opencl/sdaccel/sdaccel_module.cc.o
   /usr/bin/g++  -DDMLC_USE_FOPEN64=0 -DNDEBUG -DTVM_LLVM_VERSION=80 
-DTVM_THREADPOOL_USE_OPENMP=0 -Dtvm_EXPORTS -I../include 
-I../3rdparty/dlpack/include -I../3rdparty/dmlc-core/include 
-I../3rdparty/rang/include -I../3rdparty/compiler-rt -I../3rdparty/picojson 
-I../vta/include -I/home/linuxbrew/.linuxbrew/Cellar/llvm/8.0.0_1/include 
-I../topi/include -std=c++11 -O0 -g -Wall -fPIC  -rdynamic -g -fPIC    
-D_GNU_SOURCE  -D__STDC_CONSTANT_MACROS  -D__STDC_FORMAT_MACROS  
-D__STDC_LIMIT_MACROS -pthread -MD -MT 
CMakeFiles/tvm.dir/src/runtime/opencl/sdaccel/sdaccel_module.cc.o -MF 
CMakeFiles/tvm.dir/src/runtime/opencl/sdaccel/sdaccel_module.cc.o.d -o 
CMakeFiles/tvm.dir/src/runtime/opencl/sdaccel/sdaccel_module.cc.o -c 
../src/runtime/opencl/sdaccel/sdaccel_module.cc
   ../src/runtime/opencl/sdaccel/sdaccel_module.cc: In function 
‘tvm::runtime::Module tvm::runtime::SDAccelModuleCreate(std::__cxx11::string, 
std::__cxx11::string, std::unordered_map<std::__cxx11::basic_string<char>, 
tvm::runtime::FunctionInfo>, std::__cxx11::string)’:
   ../src/runtime/opencl/sdaccel/sdaccel_module.cc:56:18: error: no matching 
function for call to 
‘tvm::runtime::Module::Module(std::shared_ptr<tvm::runtime::SDAccelModuleNode>&)’
      return Module(n);
                     ^
   In file included from ../include/tvm/runtime/packed_func.h:40:0,
                    from ../include/tvm/runtime/registry.h:48,
                    from ../src/runtime/opencl/sdaccel/sdaccel_module.cc:24:
   ../include/tvm/runtime/module.h:53:12: note: candidate: 
tvm::runtime::Module::Module(tvm::runtime::ObjectPtr<tvm::runtime::Object>)
      explicit Module(ObjectPtr<Object> n)
               ^
   ../include/tvm/runtime/module.h:53:12: note:   no known conversion for 
argument 1 from ‘std::shared_ptr<tvm::runtime::SDAccelModuleNode>’ to 
‘tvm::runtime::ObjectPtr<tvm::runtime::Object>’
   ../include/tvm/runtime/module.h:51:3: note: candidate: 
tvm::runtime::Module::Module()
      Module() {}
      ^
   ../include/tvm/runtime/module.h:51:3: note:   candidate expects 0 arguments, 
1 provided
   ../include/tvm/runtime/module.h:49:7: note: candidate: 
tvm::runtime::Module::Module(const tvm::runtime::Module&)
    class Module : public ObjectRef {
          ^
   ../include/tvm/runtime/module.h:49:7: note:   no known conversion for 
argument 1 from ‘std::shared_ptr<tvm::runtime::SDAccelModuleNode>’ to ‘const 
tvm::runtime::Module&’
   ../include/tvm/runtime/module.h:49:7: note: candidate: 
tvm::runtime::Module::Module(tvm::runtime::Module&&)
   ../include/tvm/runtime/module.h:49:7: note:   no known conversion for 
argument 1 from ‘std::shared_ptr<tvm::runtime::SDAccelModuleNode>’ to 
‘tvm::runtime::Module&&’
   [52/116] Building CXX object 
CMakeFiles/tvm_runtime.dir/src/runtime/opencl/sdaccel/sdaccel_module.cc.o
   FAILED: 
CMakeFiles/tvm_runtime.dir/src/runtime/opencl/sdaccel/sdaccel_module.cc.o
   /usr/bin/g++  -DDMLC_USE_FOPEN64=0 -DTVM_LLVM_VERSION=80 
-DTVM_THREADPOOL_USE_OPENMP=0 -Dtvm_runtime_EXPORTS -I../include 
-I../3rdparty/dlpack/include -I../3rdparty/dmlc-core/include 
-I../3rdparty/rang/include -I../3rdparty/compiler-rt -I../3rdparty/picojson 
-I../vta/include -I/home/linuxbrew/.linuxbrew/Cellar/llvm/8.0.0_1/include 
-std=c++11 -O0 -g -Wall -fPIC  -rdynamic -g -fPIC    -D_GNU_SOURCE  
-D__STDC_CONSTANT_MACROS  -D__STDC_FORMAT_MACROS  -D__STDC_LIMIT_MACROS 
-pthread -MD -MT 
CMakeFiles/tvm_runtime.dir/src/runtime/opencl/sdaccel/sdaccel_module.cc.o -MF 
CMakeFiles/tvm_runtime.dir/src/runtime/opencl/sdaccel/sdaccel_module.cc.o.d -o 
CMakeFiles/tvm_runtime.dir/src/runtime/opencl/sdaccel/sdaccel_module.cc.o -c 
../src/runtime/opencl/sdaccel/sdaccel_module.cc
   ../src/runtime/opencl/sdaccel/sdaccel_module.cc: In function 
‘tvm::runtime::Module tvm::runtime::SDAccelModuleCreate(std::__cxx11::string, 
std::__cxx11::string, std::unordered_map<std::__cxx11::basic_string<char>, 
tvm::runtime::FunctionInfo>, std::__cxx11::string)’:
   ../src/runtime/opencl/sdaccel/sdaccel_module.cc:56:18: error: no matching 
function for call to 
‘tvm::runtime::Module::Module(std::shared_ptr<tvm::runtime::SDAccelModuleNode>&)’
      return Module(n);
                     ^
   In file included from ../include/tvm/runtime/packed_func.h:40:0,
                    from ../include/tvm/runtime/registry.h:48,
                    from ../src/runtime/opencl/sdaccel/sdaccel_module.cc:24:
   ../include/tvm/runtime/module.h:53:12: note: candidate: 
tvm::runtime::Module::Module(tvm::runtime::ObjectPtr<tvm::runtime::Object>)
      explicit Module(ObjectPtr<Object> n)
               ^
   ../include/tvm/runtime/module.h:53:12: note:   no known conversion for 
argument 1 from ‘std::shared_ptr<tvm::runtime::SDAccelModuleNode>’ to 
‘tvm::runtime::ObjectPtr<tvm::runtime::Object>’
   ../include/tvm/runtime/module.h:51:3: note: candidate: 
tvm::runtime::Module::Module()
      Module() {}
      ^
   ../include/tvm/runtime/module.h:51:3: note:   candidate expects 0 arguments, 
1 provided
   ../include/tvm/runtime/module.h:49:7: note: candidate: 
tvm::runtime::Module::Module(const tvm::runtime::Module&)
    class Module : public ObjectRef {
          ^
   ../include/tvm/runtime/module.h:49:7: note:   no known conversion for 
argument 1 from ‘std::shared_ptr<tvm::runtime::SDAccelModuleNode>’ to ‘const 
tvm::runtime::Module&’
   ../include/tvm/runtime/module.h:49:7: note: candidate: 
tvm::runtime::Module::Module(tvm::runtime::Module&&)
   ../include/tvm/runtime/module.h:49:7: note:   no known conversion for 
argument 1 from ‘std::shared_ptr<tvm::runtime::SDAccelModuleNode>’ to 
‘tvm::runtime::Module&&’
   [101/116] Building CXX object 
CMakeFiles/tvm.dir/src/codegen/llvm/codegen_llvm.cc.o
   ninja: build stopped: subcommand failed.
   ```
   
   I fixed it by changing `sdaccel_module.cc` like below, does this 
modification make sense??
   if it's ok, I'll make pull request.
   
   ```diff
   diff --git a/src/runtime/opencl/sdaccel/sdaccel_module.cc 
b/src/runtime/opencl/sdaccel/sdaccel_module.cc
   index 5436b418..31db46af 100644
   --- a/src/runtime/opencl/sdaccel/sdaccel_module.cc
   +++ b/src/runtime/opencl/sdaccel/sdaccel_module.cc
   @@ -50,8 +50,7 @@ Module SDAccelModuleCreate(
        std::string fmt,
        std::unordered_map<std::string, FunctionInfo> fmap,
        std::string source) {
   -  std::shared_ptr<SDAccelModuleNode> n =
   -      std::make_shared<SDAccelModuleNode>(data, fmt, fmap, source);
   +  auto n = make_object<SDAccelModuleNode>(data, fmt, fmap, source);
      n->Init();
      return Module(n);
    }
   ```
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to