HIP icon indicating copy to clipboard operation
HIP copied to clipboard

Error when using HIP + boost::stacktrace

Open ipdemes opened this issue 4 years ago • 1 comments

I am getting an error like below when compiling an example that uses Boost stack trace with HIP compiler.

In file included from /home/irina/install_dir/boost_1_72/include/boost/stacktrace/frame.hpp:20:
/home/irina/install_dir/boost_1_72/include/boost/stacktrace/safe_dump_to.hpp:50:5: error: use of undeclared identifier 'noinline'; did you mean 'inline'?
    BOOST_NOINLINE static std::size_t safe_dump_to_impl(void* memory, std::size_t size, std::size_t skip) BOOST_NOEXCEPT {
    ^
/home/irina/install_dir/boost_1_72/include/boost/config/detail/suffix.hpp:623:46: note: expanded from macro 'BOOST_NOINLINE'
#      define BOOST_NOINLINE __attribute__ ((__noinline__))
                                             ^
/opt/rocm-4.2.0/hip/include/hip/amd_detail/host_defines.h:50:37: note: expanded from macro '__noinline__'
#define __noinline__ __attribute__((noinline))
                                    ^
In file included from /home/irina/development/flecsi/flecsi/log/utils.cc:18:
In file included from /home/irina/development/flecsi/flecsi/util/mpi.hh:21:
In file included from /home/irina/development/flecsi/flecsi/util/serialize.hh:27:
In file included from /home/irina/development/flecsi/flecsi/flog.hh:419:
In file included from /home/irina/install_dir/boost_1_72/include/boost/stacktrace.hpp:15:
In file included from /home/irina/install_dir/boost_1_72/include/boost/stacktrace/frame.hpp:20:
/home/irina/install_dir/boost_1_72/include/boost/stacktrace/safe_dump_to.hpp:50:5: error: type name does not allow function specifier to be specified
/home/irina/install_dir/boost_1_72/include/boost/config/detail/suffix.hpp:623:46: note: expanded from macro 'BOOST_NOINLINE'
#      define BOOST_NOINLINE __attribute__ ((__noinline__))
                                             ^
/opt/rocm-4.2.0/hip/include/hip/amd_detail/host_defines.h:50:37: note: expanded from macro '__noinline__'
#define __noinline__ __attribute__((noinline))
                                    ^

To reproduce the error, please apply following diff to the reduction test in HIP-examples:

pccdiff --git a/reduction/Makefile b/reduction/Makefile
index 1cf8065..28e9087 100644
--- a/reduction/Makefile
+++ b/reduction/Makefile
@@ -4,7 +4,7 @@ ifeq (,$(HIP_PATH))
 endif
 HIPCC=$(HIP_PATH)/bin/hipcc

-CXXFLAGS += -std=c++11 -O3
+CXXFLAGS += -std=c++11 -O3 -isystem /path_to_boost/include

 reduction: reduction.cpp
 ifeq ($(shell which $(HIPCC) > /dev/null; echo $$?), 0)
diff --git a/reduction/reduction.cpp b/reduction/reduction.cpp
index a5ea2f2..c9528bc 100644
--- a/reduction/reduction.cpp
+++ b/reduction/reduction.cpp
@@ -29,7 +29,7 @@ THE SOFTWARE.
 #include <iomanip>
 #include <cmath>
 #include "hip/hip_runtime.h"
-
+#include <boost/stacktrace.hpp>

 void check_hip_error(void)
 {

My configuration:

HIP version: 4.2.21155-37cb3a34 clang version 12.0.0 (https://github.com/RadeonOpenCompute/llvm-project roc-4.2.0 21161 b204d7f0cae65b6cd4446eec50fc1fb675d582af) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /opt/rocm-4.2.0/llvm/bin

ipdemes avatar Sep 20 '21 20:09 ipdemes

This is fixed in boost by: https://github.com/boostorg/config/pull/393

Maetveis avatar Feb 13 '22 14:02 Maetveis