RenderKit / oidn

Intel® Open Image Denoise library
https://www.openimagedenoise.org/
Apache License 2.0
1.73k stars 160 forks source link

Failure to build with hipcc support #218

Open luyatshimbalanga opened 2 months ago

luyatshimbalanga commented 2 months ago

When using HIPcc option to build OIDN, failure happened from the log extract:

-- Check for working CXX compiler: /usr/bin/hipcc - broken
CMake Error at /usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:60 (message):
  The C++ compiler

    "/usr/bin/hipcc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: '/builddir/build/BUILD/oidn-2.3.0-beta/redhat-linux-build/devices/hip/build/CMakeFiles/CMakeScratch/TryCompile-mmYk8r'

    Run Build Command(s): /usr/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_3837d/fast
    gmake[3]: Entering directory '/builddir/build/BUILD/oidn-2.3.0-beta/redhat-linux-build/devices/hip/build/CMakeFiles/CMakeScratch/TryCompile-mmYk8r'
    /usr/bin/gmake  -f CMakeFiles/cmTC_3837d.dir/build.make CMakeFiles/cmTC_3837d.dir/build
    gmake[4]: Entering directory '/builddir/build/BUILD/oidn-2.3.0-beta/redhat-linux-build/devices/hip/build/CMakeFiles/CMakeScratch/TryCompile-mmYk8r'
    Building CXX object CMakeFiles/cmTC_3837d.dir/testCXXCompiler.cxx.o
    /usr/bin/hipcc   -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer  -MD -MT CMakeFiles/cmTC_3837d.dir/testCXXCompiler.cxx.o -MF CMakeFiles/cmTC_3837d.dir/testCXXCompiler.cxx.o.d -o CMakeFiles/cmTC_3837d.dir/testCXXCompiler.cxx.o -c /builddir/build/BUILD/oidn-2.3.0-beta/redhat-linux-build/devices/hip/build/CMakeFiles/CMakeScratch/TryCompile-mmYk8r/testCXXCompiler.cxx
    clang: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument]
    clang: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument]
    clang: warning: argument unused during compilation: '-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1' [-Wunused-command-line-argument]
    clang: warning: argument unused during compilation: '-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1' [-Wunused-command-line-argument]
    error: option 'cf-protection=return' cannot be specified on this target
    error: option 'cf-protection=branch' cannot be specified on this target
    2 errors generated when compiling for gfx906.
    gmake[4]: *** [CMakeFiles/cmTC_3837d.dir/build.make:79: CMakeFiles/cmTC_3837d.dir/testCXXCompiler.cxx.o] Error 1
    gmake[4]: Leaving directory '/builddir/build/BUILD/oidn-2.3.0-beta/redhat-linux-build/devices/hip/build/CMakeFiles/CMakeScratch/TryCompile-mmYk8r'

    gmake[3]: *** [Makefile:127: cmTC_3837d/fast] Error 2
    gmake[3]: Leaving directory '/builddir/build/BUILD/oidn-2.3.0-beta/redhat-linux-build/devices/hip/build/CMakeFiles/CMakeScratch/TryCompile-mmYk8r'

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:13 (project)

-- Configuring incomplete, errors occurred!
gmake[2]: *** [devices/CMakeFiles/OpenImageDenoise_device_hip.dir/build.make:95: devices/hip/stamp/OpenImageDenoise_device_hip-configure] Error 1
gmake[2]: Leaving directory '/builddir/build/BUILD/oidn-2.3.0-beta/redhat-linux-build'
gmake[1]: *** [CMakeFiles/Makefile2:319: devices/CMakeFiles/OpenImageDenoise_device_hip.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....

Here is the system used for the test

Hardware Information:

Software Information:

atafra commented 2 months ago

What exactly do you mean by "HIPcc option"? How exactly do you invoke CMake? What version of ROCm are you using?

luyatshimbalanga commented 2 months ago

Adding -DOIDN_DEVICE_HIP_COMPILER=%{_bindir}/hipcc \ in supplement to -DOIDN_DEVICE_HIP=ON \ running on ROCm 6.0

atafra commented 2 months ago

You shouldn't manually set OIDN_DEVICE_HIP_COMPILER. The ROCm path should be automatically detected. It isn't? If it's not detected, you should rather set ROCM_PATH instead. In any case, ROCm's clang++ should be used (which should be detected automatically) instead of hipcc.

luyatshimbalanga commented 1 month ago

Thanks for the pointer. After setting ROCM_PATH and had to manually apply OIDN_DEVICE_HIP_COMPILER to use clang++-17 (version 17 on Fedora which use version 18 by default), the build failed at the following line:

/builddir/build/BUILD/oidn-2.3.0-beta/devices/hip/ck_conv_wmma.cpp
clang++-17: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument]
clang++-17: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument]
clang++-17: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument]
clang++-17: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument]
clang++-17: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument]
clang++-17: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument]
clang++-17: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument]
clang++-17: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument]
clang++-17: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument]
clang++-17: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument]
clang++-17: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument]
clang++-17: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument]
clang++-17: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument]
clang++-17: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument]
clang++-17: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument]
clang++-17: warning: argument unused during compilation: '-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1' [-Wunused-command-line-argument]
clang++-17: warning: argument unused during compilation: '-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1' [-Wunused-command-line-argument]
error: option 'cf-protection=return' cannot be specified on this target
error: option 'cf-protection=branch' cannot be specified on this target
2 errors generated when compiling for gfx1030.

It looks like the failure occurred for gfx1030 line. I include the build.log for reference.

atafra commented 1 month ago

Why did you have to set OIDN_DEVICE_HIP_COMPILER? This isn't necessary with a regular installation of ROCm (tested with versions between 5.5.0 and 6.1.0). Also, you set it to /usr/bin/clang++-17, which seems to be the system Clang instead of ROCm's own Clang. That won't work.

Please follow the ROCm install instructions at https://rocm.docs.amd.com/projects/install-on-linux/en/latest/ Currently this is the only supported ROCm installation method by OIDN.