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

[Bug] 0.17.0 fails with GCC14 with: error: control reaches end of non-void function [-Werror=return-type] #17459

Closed
ggardet opened this issue Oct 10, 2024 · 9 comments
Labels
needs-triage PRs or issues that need to be investigated by maintainers to find the right assignees to address it type: bug

Comments

@ggardet
Copy link
Contributor

ggardet commented Oct 10, 2024

0.17.0 fails with GCC14 (on openSSUE Tumbleweed) with: error: control reaches end of non-void function [-Werror=return-type]

Expected behavior

Build should succeed with GCC14.

Actual behavior

Build fails with:

[  247s] /home/abuild/rpmbuild/BUILD/tvm-0.17.0/src/meta_schedule/cost_model/../../support/base64.h: In member function ‘virtual size_t tvm::support::Base64OutStream::Read(void*, size_t)’:
[  247s] /home/abuild/rpmbuild/BUILD/tvm-0.17.0/src/meta_schedule/cost_model/../../support/base64.h:253:19: error: control reaches end of non-void function [-Werror=return-type]
[  247s]   253 |     LOG(FATAL) << "Base64OutStream do not support read";
[  247s]       |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  247s] cc1plus: some warnings being treated as errors
[  247s] make[2]: *** [CMakeFiles/tvm_objs.dir/build.make:989: CMakeFiles/tvm_objs.dir/src/meta_schedule/cost_model/cost_model.cc.o] Error 1

Environment

openSUSE Tumbleweed
TVM 0.17.0

Steps to reproduce

Try to build with GCC14.

Triage

Please refer to the list of label tags here to find the relevant tags and add them below in a bullet format (example below).

  • needs-triage
@ggardet ggardet added needs-triage PRs or issues that need to be investigated by maintainers to find the right assignees to address it type: bug labels Oct 10, 2024
@ggardet
Copy link
Contributor Author

ggardet commented Oct 10, 2024

If I add -Wno-error=return-type as workaround, I get the following errors:

[   50s] [  2%] Building CXX object CMakeFiles/tvm_runtime_objs.dir/src/runtime/disco/disco_worker.cc.o
[   50s] /usr/bin/c++ -DDMLC_USE_FOPEN64=0 -DDMLC_USE_LOGGING_LIBRARY="<tvm/runtime/logging.h>" -DNDEBUG -DNDEBUG=1 -DTVM_ENABLE_SPIRV=1 -DTVM_INDEX_DEFAULT_I64=1 -DTVM_LLVM_HAS_AARCH64_TARGET=1 -DTVM_LLVM_VERSION=140 -DTVM_THREADPOOL_USE_OPENMP=0 -DTVM_USE_LIBBACKTRACE=0 -DUSE_FALLBACK_STL_MAP=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/abuild/rpmbuild/BUILD/tvm-0.17.0/include -I/home/abuild/rpmbuild/BUILD/tvm-0.17.0/3rdparty/libcrc/include -isystem /usr/include/dlpack -isystem /usr/include/dmlc -isystem /usr/include/rang -isystem /home/abuild/rpmbuild/BUILD/tvm-0.17.0/3rdparty/compiler-rt -isystem /home/abuild/rpmbuild/BUILD/tvm-0.17.0/3rdparty/picojson -isystem /home/abuild/rpmbuild/BUILD/tvm-0.17.0/3rdparty/OpenCL-Headers -isystem /usr/include/spirv-tools -isystem /usr/include/spirv/unified1 -isystem /usr/include/openblas -std=c++17 -faligned-new -O2 -Wall -fPIC -mbranch-protection=standard -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type  -g -Wno-error=return-type -O2 -g -DNDEBUG -ffile-prefix-map=..=/home/abuild/rpmbuild/BUILD/tvm-0.17.0 -MD -MT CMakeFiles/tvm_runtime_objs.dir/src/runtime/disco/disco_worker.cc.o -MF CMakeFiles/tvm_runtime_objs.dir/src/runtime/disco/disco_worker.cc.o.d -o CMakeFiles/tvm_runtime_objs.dir/src/runtime/disco/disco_worker.cc.o -c /home/abuild/rpmbuild/BUILD/tvm-0.17.0/src/runtime/disco/disco_worker.cc
[   50s] In file included from /home/abuild/rpmbuild/BUILD/tvm-0.17.0/src/runtime/disco/./protocol.h:35,
[   50s]                  from /home/abuild/rpmbuild/BUILD/tvm-0.17.0/src/runtime/disco/disco_worker.cc:26:
[   50s] /home/abuild/rpmbuild/BUILD/tvm-0.17.0/src/runtime/disco/./../../support/base64.h:209:10: error: conflicting return type specified for ‘virtual size_t tvm::support::Base64InStream::Write(const void*, size_t)’
[   50s]   209 |   size_t Write(const void* ptr, size_t size) final {
[   50s]       |          ^~~~~
[   50s] In file included from /home/abuild/rpmbuild/BUILD/tvm-0.17.0/include/tvm/runtime/module.h:29,
[   50s]                  from /home/abuild/rpmbuild/BUILD/tvm-0.17.0/include/tvm/runtime/disco/builtin.h:23,
[   50s]                  from /home/abuild/rpmbuild/BUILD/tvm-0.17.0/src/runtime/disco/disco_worker.cc:19:
[   50s] /usr/include/dmlc/io.h:44:16: note: overridden function is ‘virtual void dmlc::Stream::Write(const void*, size_t)’
[   50s]    44 |   virtual void Write(const void *ptr, size_t size) = 0;
[   50s]       |                ^~~~~
[   50s] /home/abuild/rpmbuild/BUILD/tvm-0.17.0/src/runtime/disco/./../../support/base64.h:232:10: error: conflicting return type specified for ‘virtual size_t tvm::support::Base64OutStream::Write(const void*, size_t)’
[   50s]   232 |   size_t Write(const void* ptr, size_t size) final {
[   50s]       |          ^~~~~
[   50s] /usr/include/dmlc/io.h:44:16: note: overridden function is ‘virtual void dmlc::Stream::Write(const void*, size_t)’
[   50s]    44 |   virtual void Write(const void *ptr, size_t size) = 0;
[   50s]       |                ^~~~~
[   50s] /home/abuild/rpmbuild/BUILD/tvm-0.17.0/src/runtime/disco/./../../support/base64.h: In member function ‘virtual size_t tvm::support::Base64OutStream::Read(void*, size_t)’:
[   50s] /home/abuild/rpmbuild/BUILD/tvm-0.17.0/src/runtime/disco/./../../support/base64.h:253:19: warning: control reaches end of non-void function [-Wreturn-type]
[   50s]   253 |     LOG(FATAL) << "Base64OutStream do not support read";
[   50s]       |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[   50s] make[2]: *** [CMakeFiles/tvm_runtime_objs.dir/build.make:191: CMakeFiles/tvm_runtime_objs.dir/src/runtime/disco/disco_worker.cc.o] Error 1
[   50s] make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/tvm-0.17.0/build_cmake'
[   50s] make[2]: *** Waiting for unfinished jobs....

@mshr-h
Copy link
Contributor

mshr-h commented Oct 17, 2024

Build works fine on my machine. Tested on OpenSUSE docker image.

# spawn openSUSE container
docker run -it --rm opensuse/tumbleweed:latest

# run the below commands inside the container
zypper install -y awk git cmake ninja gcc gcc-c++ llvm-devel clang
zypper install -y python3 python3-devel python3-pip
zypper install -y ncurses-devel libxml2-devel zlib-devel

python3 -m pip install --break-system-packages numpy decorator attrs pytest

git clone https://github.com/apache/tvm --branch v0.17.0 --recursive
cd tvm
cmake -E make_directory build
cmake -S . -G Ninja -B build \
          -DUSE_RPC=ON \
          -DUSE_GRAPH_RUNTIME=ON \
          -DUSE_LLVM=ON
cmake --build build
python3 -m pip install --break-system-packages ./python
python3 -c "import tvm; print(tvm.__version__)" # -> shows 0.17.0

@ggardet
Copy link
Contributor Author

ggardet commented Oct 17, 2024

You need the C/CXX flags -Werror=return-type which is enabled in the openSUSE Tumbleweed build system.

@mshr-h
Copy link
Contributor

mshr-h commented Oct 17, 2024

Ah, I think I understand what you're trying to do.
You want to build TVM with openSUSE (default?) build system and eventually something like to provide TVM package for openSUSE?

@ggardet
Copy link
Contributor Author

ggardet commented Oct 17, 2024

Ah, I think I understand what you're trying to do. You want to build TVM with openSUSE (default?) build system and eventually something like to provide TVM package for openSUSE?

Right, TVM 0.16.0 is already available in openSUSE as an RPM package, but update to 0.17.0 fails with errors above.

@mshr-h
Copy link
Contributor

mshr-h commented Oct 18, 2024

Build worked fine with -Werror=return-type.

Repro:

# spawn openSUSE container
docker run -it --rm opensuse/tumbleweed:latest

# run the below commands inside the container
zypper install -y awk git cmake ninja gcc gcc-c++ llvm-devel clang python3 \
                  python3-devel python3-pip ncurses-devel libxml2-devel zlib-devel

python3 -m pip install --break-system-packages numpy decorator attrs pytest

git clone https://github.com/apache/tvm --branch v0.17.0 --recursive
cd tvm
cmake -E make_directory build
CC=gcc-14 CXX=g++-14 cmake -S . -G Ninja -B build \
                           -DCMAKE_C_FLAGS="-Werror=return-type" \
                           -DCMAKE_CXX_FLAGS="-Werror=return-type" \
                           -DUSE_RPC=ON -DUSE_GRAPH_RUNTIME=ON -DUSE_LLVM=ON
cmake --build build
python3 -m pip install --break-system-packages ./python
python3 -c "import tvm; print(tvm.__version__)" # -> shows 0.17.0

@ggardet
Copy link
Contributor Author

ggardet commented Oct 22, 2024

To be more complete, here is the cmake commandline used for x86_64:

[   21s] + mkdir -p build_cmake
[   21s] + cd build_cmake
[   21s] + /usr/bin/cmake /home/abuild/rpmbuild/BUILD/tvm-0.17.0/. '-GUnix Makefiles' -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_BINDIR:PATH=bin -DCMAKE_INSTALL_SBINDIR:PATH=sbin -DCMAKE_INSTALL_LIBEXECDIR:PATH=libexec -DCMAKE_INSTALL_SYSCONFDIR:PATH=etc -DCMAKE_INSTALL_SHAREDSTATEDIR:PATH=/var/lib -DCMAKE_INSTALL_LOCALSTATEDIR:PATH=var -DCMAKE_INSTALL_RUNSTATEDIR:PATH=run -DCMAKE_INSTALL_LIBDIR:PATH=lib64 -DCMAKE_INSTALL_INCLUDEDIR:PATH=include -DCMAKE_INSTALL_DATAROOTDIR:PATH=share -DCMAKE_INSTALL_DOCDIR:PATH=share/doc/packages/tvm -DCMAKE_INSTALL_MANDIR:PATH=share/man -DCMAKE_INSTALL_INFODIR:PATH=share/info -DINCLUDE_INSTALL_DIR:PATH=/usr/include -DLIB_INSTALL_DIR:PATH=/usr/lib64 -DSYSCONF_INSTALL_DIR:PATH=/etc -DSHARE_INSTALL_PREFIX:PATH=/usr/share -DCMAKE_BUILD_TYPE=RelWithDebInfo '-DCMAKE_C_FLAGS=-O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type  -g' '-DCMAKE_CXX_FLAGS=-O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type  -g' '-DCMAKE_Fortran_FLAGS=-O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type  -g' '-DCMAKE_EXE_LINKER_FLAGS= -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now' '-DCMAKE_MODULE_LINKER_FLAGS= -Wl,--as-needed' '-DCMAKE_SHARED_LINKER_FLAGS= -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now' -DLIB_SUFFIX=64 -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=ON -DBUILD_STATIC_LIBS:BOOL=OFF -DCMAKE_COLOR_MAKEFILE:BOOL=OFF -DCMAKE_INSTALL_DO_STRIP:BOOL=OFF -DCMAKE_MODULES_INSTALL_DIR=/usr/lib64/cmake/tvm -DDMLC_PATH=/usr/include/dmlc -DDLPACK_PATH=/usr/include/dlpack -DRANG_PATH=/usr/include/rang -DUSE_GRAPH_RUNTIME=ON -DUSE_LLVM=ON -DUSE_BLAS=openblas -DUSE_MKLDNN=ON -DUSE_OPENCL=ON -DUSE_OPENGL=ON -DUSE_OPENMP=ON -DUSE_RANDOM=ON -DUSE_RPC=ON -DUSE_RTTI=ON -DUSE_SORT=ON -DUSE_THREADS=ON -DUSE_VULKAN=ON -DUSE_LIBBACKTRACE=OFF -DUSE_ANTLR=/usr/share/java/antlr4/antlr4-runtime.jar -DINSTALL_DEV=ON

And for aarch64, we also have -mbranch-protection=standard

@mshr-h
Copy link
Contributor

mshr-h commented Oct 22, 2024

I guess -DDMLC_PATH=/usr/include/dmlc is the problem.
The dmlc API has changed in dmlc/dmlc-core@3031e4a and TVM adapted it in #16998
You're using the old dmlc version (maybe 0.3 according to https://packagehub.suse.com/packages/dmlc-core/) for TVM compilation because the dmlc team hasn't released the new version yet.
dmlc/dmlc-core#682

@ggardet
Copy link
Contributor Author

ggardet commented Oct 22, 2024

Right. Updating dmlc-core fixed the build. Thanks!

@ggardet ggardet closed this as completed Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage PRs or issues that need to be investigated by maintainers to find the right assignees to address it type: bug
Projects
None yet
Development

No branches or pull requests

2 participants