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

codegen.cc:150:32: error: use of deleted function #4596

Closed
kevinyuan opened this issue Dec 28, 2019 · 5 comments · Fixed by #4597
Closed

codegen.cc:150:32: error: use of deleted function #4596

kevinyuan opened this issue Dec 28, 2019 · 5 comments · Fixed by #4597
Assignees

Comments

@kevinyuan
Copy link
Contributor

Hi,

The latest code has compilation errors with tvm/src/relay/backend/contrib/codegen_c/codegen.cc:


[ 90%] Building CXX object CMakeFiles/tvm.dir/src/runtime/cpu_device_api.cc.o
/home/kevinyuan/dev/tvm/src/relay/backend/contrib/codegen_c/codegen.cc: In member function ‘void tvm::relay::contrib::CSourceCodegen::GenCFunc(const tvm::relay::Function&)’:
/home/kevinyuan/dev/tvm/src/relay/backend/contrib/codegen_c/codegen.cc:150:32: error: use of deleted function ‘tvm::relay::contrib::CodegenC::CodegenC(tvm::relay::contrib::CodegenC&&)’
auto builder = CodegenC(sid);
^
/home/kevinyuan/dev/tvm/src/relay/backend/contrib/codegen_c/codegen.cc:39:7: note: ‘tvm::relay::contrib::CodegenC::CodegenC(tvm::relay::contrib::CodegenC&&)’ is implicitly deleted because the default definition would be ill-formed:
class CodegenC : public ExprVisitor, public CodegenCBase {
^
/home/kevinyuan/dev/tvm/src/relay/backend/contrib/codegen_c/codegen.cc:39:7: error: use of deleted function ‘tvm::relay::contrib::CodegenCBase::CodegenCBase(tvm::relay::contrib::CodegenCBase&&)’
In file included from /home/kevinyuan/dev/tvm/src/relay/backend/contrib/codegen_c/codegen.cc:28:0:
/home/kevinyuan/dev/tvm/src/relay/backend/contrib/codegen_c/codegen_c.h:70:7: note: ‘tvm::relay::contrib::CodegenCBase::CodegenCBase(tvm::relay::contrib::CodegenCBase&&)’ is implicitly deleted because the default definition would be ill-formed:
class CodegenCBase {
^
/home/kevinyuan/dev/tvm/src/relay/backend/contrib/codegen_c/codegen_c.h:70:7: error: use of deleted function ‘std::basic_ostringstream::basic_ostringstream(const std::basic_ostringstream&)’
In file included from /home/kevinyuan/dev/tvm/3rdparty/dmlc-core/include/dmlc/logging.h:20:0,
from /home/kevinyuan/dev/tvm/include/tvm/node/functor.h:26,
from /home/kevinyuan/dev/tvm/include/tvm/relay/expr_functor.h:28,
from /home/kevinyuan/dev/tvm/src/relay/backend/contrib/codegen_c/codegen.cc:19:
/usr/include/c++/4.8.2/sstream:387:11: note: ‘std::basic_ostringstream::basic_ostringstream(const std::basic_ostringstream&)’ is implicitly deleted because the default definition would be ill-formed:
class basic_ostringstream : public basic_ostream<_CharT, _Traits>
^
/usr/include/c++/4.8.2/sstream:387:11: error: use of deleted function ‘std::basic_ostream::basic_ostream(const std::basic_ostream&)’
In file included from /usr/include/c++/4.8.2/istream:39:0,
from /usr/include/c++/4.8.2/sstream:38,
from /home/kevinyuan/dev/tvm/3rdparty/dmlc-core/include/dmlc/logging.h:20,
from /home/kevinyuan/dev/tvm/include/tvm/node/functor.h:26,
from /home/kevinyuan/dev/tvm/include/tvm/relay/expr_functor.h:28,
from /home/kevinyuan/dev/tvm/src/relay/backend/contrib/codegen_c/codegen.cc:19:
/usr/include/c++/4.8.2/ostream:58:11: note: ‘std::basic_ostream::basic_ostream(const std::basic_ostream&)’ is implicitly deleted because the default definition would be ill-formed:
class basic_ostream : virtual public basic_ios<_CharT, _Traits>
^
/usr/include/c++/4.8.2/ostream:58:11: error: use of deleted function ‘std::basic_ios::basic_ios(const std::basic_ios&)’
In file included from /usr/include/c++/4.8.2/ios:44:0,
from /usr/include/c++/4.8.2/istream:38,
from /usr/include/c++/4.8.2/sstream:38,
from /home/kevinyuan/dev/tvm/3rdparty/dmlc-core/include/dmlc/logging.h:20,
from /home/kevinyuan/dev/tvm/include/tvm/node/functor.h:26,
from /home/kevinyuan/dev/tvm/include/tvm/relay/expr_functor.h:28,
from /home/kevinyuan/dev/tvm/src/relay/backend/contrib/codegen_c/codegen.cc:19:

/usr/include/c++/4.8.2/bits/basic_ios.h:66:11: note: ‘std::basic_ios::basic_ios(const std::basic_ios&)’ is implicitly deleted because the default definition would be ill-formed:
class basic_ios : public ios_base
^
In file included from /usr/include/c++/4.8.2/ios:42:0,
from /usr/include/c++/4.8.2/istream:38,
from /usr/include/c++/4.8.2/sstream:38,
from /home/kevinyuan/dev/tvm/3rdparty/dmlc-core/include/dmlc/logging.h:20,
from /home/kevinyuan/dev/tvm/include/tvm/node/functor.h:26,
from /home/kevinyuan/dev/tvm/include/tvm/relay/expr_functor.h:28,
from /home/kevinyuan/dev/tvm/src/relay/backend/contrib/codegen_c/codegen.cc:19:
/usr/include/c++/4.8.2/bits/ios_base.h:786:5: error: ‘std::ios_base::ios_base(const std::ios_base&)’ is private
ios_base(const ios_base&);
^
In file included from /usr/include/c++/4.8.2/ios:44:0,
from /usr/include/c++/4.8.2/istream:38,
from /usr/include/c++/4.8.2/sstream:38,
from /home/kevinyuan/dev/tvm/3rdparty/dmlc-core/include/dmlc/logging.h:20,
from /home/kevinyuan/dev/tvm/include/tvm/node/functor.h:26,
from /home/kevinyuan/dev/tvm/include/tvm/relay/expr_functor.h:28,
from /home/kevinyuan/dev/tvm/src/relay/backend/contrib/codegen_c/codegen.cc:19:
/usr/include/c++/4.8.2/bits/basic_ios.h:66:11: error: within this context
class basic_ios : public ios_base
^
In file included from /home/kevinyuan/dev/tvm/3rdparty/dmlc-core/include/dmlc/logging.h:20:0,
from /home/kevinyuan/dev/tvm/include/tvm/node/functor.h:26,
from /home/kevinyuan/dev/tvm/include/tvm/relay/expr_functor.h:28,
from /home/kevinyuan/dev/tvm/src/relay/backend/contrib/codegen_c/codegen.cc:19:
/usr/include/c++/4.8.2/sstream:387:11: error: use of deleted function ‘std::basic_ios::basic_ios(const std::basic_ios&)’
class basic_ostringstream : public basic_ostream<_CharT, _Traits>
^
/usr/include/c++/4.8.2/sstream:387:11: error: use of deleted function ‘std::basic_stringbuf::basic_stringbuf(const std::basic_stringbuf&)’
/usr/include/c++/4.8.2/sstream:64:11: note: ‘std::basic_stringbuf::basic_stringbuf(const std::basic_stringbuf&)’ is implicitly deleted because the default definition would be ill-formed:
class basic_stringbuf : public basic_streambuf<_CharT, _Traits>
^
In file included from /usr/include/c++/4.8.2/ios:43:0,
from /usr/include/c++/4.8.2/istream:38,
from /usr/include/c++/4.8.2/sstream:38,
from /home/kevinyuan/dev/tvm/3rdparty/dmlc-core/include/dmlc/logging.h:20,
from /home/kevinyuan/dev/tvm/include/tvm/node/functor.h:26,
from /home/kevinyuan/dev/tvm/include/tvm/relay/expr_functor.h:28,
from /home/kevinyuan/dev/tvm/src/relay/backend/contrib/codegen_c/codegen.cc:19:
/usr/include/c++/4.8.2/streambuf:802:7: error: ‘std::basic_streambuf<_CharT, _Traits>::basic_streambuf(const std::basic_streambuf<_CharT, _Traits>&) [with _CharT = char; _Traits = std::char_traits]’ is private
basic_streambuf(const basic_streambuf& __sb)
^
In file included from /home/kevinyuan/dev/tvm/3rdparty/dmlc-core/include/dmlc/logging.h:20:0,
from /home/kevinyuan/dev/tvm/include/tvm/node/functor.h:26,
from /home/kevinyuan/dev/tvm/include/tvm/relay/expr_functor.h:28,
from /home/kevinyuan/dev/tvm/src/relay/backend/contrib/codegen_c/codegen.cc:19:
/usr/include/c++/4.8.2/sstream:64:11: error: within this context
class basic_stringbuf : public basic_streambuf<_CharT, _Traits>
^
[ 91%] Building CXX object CMakeFiles/tvm.dir/src/runtime/dso_library.cc.o

make[2]: *** [CMakeFiles/tvm.dir/src/relay/backend/contrib/codegen_c/codegen.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/tvm.dir/all] Error 2
make: *** [all] Error 2

@kevinyuan
Copy link
Contributor Author

Not sure if it's correct, but I just adding line 18 to exclude the codegen.cc from default compilation.

18 if(USE_DNNL_CODEGEN STREQUAL "ON")
19 file(GLOB CSOURCE_RELAY_CONTRIB_SRC src/relay/backend/contrib/codegen_c/codegen.cc)
20 list(APPEND COMPILER_SRCS ${CSOURCE_RELAY_CONTRIB_SRC})
21 endif()
22

@tqchen
Copy link
Member

tqchen commented Dec 28, 2019

cc @zhiics @comaniac

@comaniac
Copy link
Contributor

According to this post, it seems like we triggered the stream move constructor that has not yet supported in gcc 4.8. We'll try to find out the root cause, although we don't have gcc 4.8 to reproduce the issue. The most efficient solution would be upgrading gcc version I think.

btw, the solution @kevinyuan proposed could work, but it's just a workaround.

@tqchen
Copy link
Member

tqchen commented Dec 28, 2019

Given that we do not really have to move the code generator class, I would say we can simply disable copy and move. If we need to move it, consider wrap it in an unique_ptr

@zhiics
Copy link
Member

zhiics commented Dec 29, 2019

copy constructor is triggered by

https://github.com/apache/incubator-tvm/blob/227c7af4464a03b42d7e2fa0949621833137cca2/src/relay/backend/contrib/codegen_c/codegen.cc#L150

This should be fixed by #4597

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

Successfully merging a pull request may close this issue.

4 participants