Expected top-level entity error after installing hipDNN with gem5 library


After installing hipDNN in gem5 docker image, I compiled square.cpp:
make gfx8-apu

Error occured:

mkdir -p ./bin
/opt/rocm/hip/bin/hipcc --amdgpu-target=gfx801 square.cpp -o ./bin/square.o
Name "main::EXPORT_LL" used only once: possible typo at /opt/rocm/hip/bin/hipcc line 219.
objdump: './bin/square.o': No such file
objdump: /usr/lib/x86_64-linux-gnu/libm.a: File format not recognized
/opt/rocm/hcc/bin/llvm-link: /tmp/tmp.NRjce6bRpJ/crt1.kernel.bc:1:1: error: expected top-level entity
/opt/rocm/hcc/bin/llvm-link: error loading file '/tmp/tmp.NRjce6bRpJ/crt1.kernel.bc'
ld: warning: Cannot create .eh_frame_hdr section, --eh-frame-hdr ignored.
ld: error in /tmp/tmp.NRjce6bRpJ/crt1.host.o(.eh_frame); no .eh_frame_hdr table will be created.


The version of hipDNN is commit 6ab7aaaa7b90845b43c3241eb9c500e1929d8503 which is consistent with MIOpen version. When compiling square.cpp, hipdnn is not even used. This problem did not occur before installing hipdnn.


Ubuntu 18.04
hipdnn commit 6ab7aaaa7b90845b43c3241eb9c500e1929d8503


March 29, 2021, 9:49 PM

I have never gotten hipDNN to work, even with a supposedly compatible version of MIOpen – if I remember correctly hipDNN needed libraries that required newer versions of ROCm. The last hipDNN commit I tried was:

commit 03e10cba4ebc12e38f2a89e7855bd38fd4763f7e
Author: Prasandhmcw <prasandh@multicorewareinc.com>
Date:   Wed Jan 10 14:45:37 2018 +0530

    RNN API support for ROCm backend

It’s possible you found a way around the linking and compilation issues we had, but either way hipDNN is not supported so I don’t have any simple answers, sorry.

I noticed that you’re running on Ubuntu 18 though – currently ROCm 1.6 requires gcc 5.4 which is not installed by default in Ubuntu 18. Are you actually running the docker (which uses Ubuntu 16 and gcc 5.4 internally) on a machine that runs Ubuntu 18? If not, this seems like a more basic problem with gcc version. Or did you update the docker to use Ubuntu 18 instead? You mentioned that you were able to compile square before adding hipDNN though, so I suspect this is not the case.

EDIT: go with Kyle’s answer instead, much more likely.

Kyle Roarty
March 29, 2021, 9:47 PM

There’s a bug in hipcc when you’re compiling a .o file when it’s already built

The solution is to either change the Makefile command to output as

instead of

Alternatively, you should be able to either delete the bin directory, or re-run the make command.

Bobby Bruce
March 29, 2021, 9:32 PM

: Do you have any idea about this?