ROCm / ROCm-CompilerSupport

The compiler support repository provides various Lightning Compiler related services.
45 stars 31 forks source link

Latest LLVM breaks on latest ROCm-CompilerSupport #59

Closed SamuelMarks closed 1 year ago

SamuelMarks commented 1 year ago

Built from RadeonOpenCompute/llvm-project@73507 in order to resolve https://github.com/RadeonOpenCompute/ROCm-Device-Libs/issues/91

$ cmake -DCMAKE_INSTALL_PREFIX='/opt/rocm' ..
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test Terminfo_LINKABLE
-- Performing Test Terminfo_LINKABLE - Success
-- Found Terminfo: /usr/lib/x86_64-linux-gnu/libtinfo.so  
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.13") 
-- Found zstd: /usr/lib/x86_64-linux-gnu/libzstd.so  
-- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so (found version "2.9.14") 

------------LLVM_DIR: /opt/rocm/llvm/lib/cmake/llvm
---LLVM_INCLUDE_DIRS: /opt/rocm/llvm/include
---LLVM_LIBRARY_DIRS: /opt/rocm/llvm/lib
-----------Clang_DIR: /opt/rocm/llvm/lib/cmake/clang
--CLANG_INCLUDE_DIRS: /opt/rocm/llvm/include
----LLD_INCLUDE_DIRS: /opt/rocm/llvm/include
---AMDDeviceLibs_DIR: /opt/rocm/lib/cmake/AMDDeviceLibs
------------ROCM_DIR: /opt/rocm/share/rocm/cmake

-- Configuring done
-- Generating done
$ cmake --build .

Output: comgr.build.log

FYI: I'm following this guide https://gist.github.com/rigtorp/d9483af100fb77cee57e4c9fa3c74245 with the overall goal to add support for my AMD Radeon™ RX 6850M XT 12GB GDDR6; i.e., Navi22.

lamb-j commented 1 year ago

Ah it looks like an unfortunate case of the LLVM and Comgr versions not all matching up. (Note: in the future we may merge these into a single repository to avoid issues like this). I saw you mentioned in your other issue that you're using the latest amd-stg-open of llvm-project. I'm guessing however cmake is pulling in some older version of llvm.

Can you try something like the following?

cd path/to/comgr/build; cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$path/to/llvm-project/build;path/to/device-libs/build" .. make -j32

Where llvm-project/build and device-libs/build are both amd-stg-open from around the same time.

Let me know if that works, or if you have any issues. I may need to update the instructions in the guide you linked.

SamuelMarks commented 1 year ago

Hmm, well I'm definitely using the right LLVM:

------------LLVM_DIR: /opt/rocm/llvm/lib/cmake/llvm
---LLVM_INCLUDE_DIRS: /opt/rocm/llvm/include
---LLVM_LIBRARY_DIRS: /opt/rocm/llvm/lib
-----------Clang_DIR: /opt/rocm/llvm/lib/cmake/clang
--CLANG_INCLUDE_DIRS: /opt/rocm/llvm/include
----LLD_INCLUDE_DIRS: /opt/rocm/llvm/include
---AMDDeviceLibs_DIR: /opt/rocm/lib/cmake/AMDDeviceLibs
------------ROCM_DIR: /opt/rocm/share/rocm/cmake

Keen to get that new instructions so I can work on Navi22

lamb-j commented 1 year ago

Now that I'm looking at the error log more closely it looks like a lot of them are due to lack of C++17.

The LLVM you're building should support C++17. Are you sure you're setting the following before building CompilerSupport?

export PATH=/opt/rocm/llvm/bin:$PATH

If not you may be using an older system compiler without C++17 support?

I was able to build successfully using those instructions. That said, is there a reason you're trying to build from source instead of using the installer? https://docs.amd.com/bundle/ROCm-Installation-Guide-v5.5/page/How_to_Install_ROCm.html#_How_to_Install

SamuelMarks commented 1 year ago

Yes I am definitely running RadeonOpenCompute/llvm-project@73507.

As for why I'm not trying the binary builds, my plan is to add support for my new laptop's GPU; which ROCm doesn't support. So I need source builds as I'll probably need to patch a bunch of source files in different repos to make the build work.

lamb-j commented 1 year ago

Instead of "cmake --build ." can you run the following:

$ make VERBOSE=1

And then paste the first C++ compilation command here? For me it looks something like this:

/usr/bin/c++ -DAMD_COMGR_EXPORT -D_GNU_SOURCE -D_GNU_SOURCE -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_LIBCPP_ENABLE_ASSERTIONS -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -DSTDC_LIMIT_MACROS -DSTDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -Damd_comgr_EXPORTS -I/home/rocmbuild/rocm/llvm/include -I/home/rocmbuild/ROCm-CompilerSupport/lib/comgr/src -I/home/rocmbuild/ROCm-CompilerSupport/lib/comgr/build/include -fPIC -fno-rtti -Wall -Wno-attributes -fms-extensions -fvisibility=hidden -fno-strict-aliasing -std=c++17 -MD -MT CMakeFiles/amd_comgr.dir/src/comgr-compiler.cpp.o -MF CMakeFiles/amd_comgr.dir/src/comgr-compiler.cpp.o.d -o CMakeFiles/amd_comgr.dir/src/comgr-compiler.cpp.o -c /home/rocmbuild/ROCm-CompilerSupport/lib/comgr/src/comgr-compiler.cpp

$ /usr/bin/c++ --version c++ (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0

If your system c++ compiler is an older version of GCC, it may not support C++17.

Since you already have a C++17-supporting compiler built (your amd-stg-open LLVM), you could try using that. You can force Cmake to use clang to compile C++ files by adding "-DCMAKE_CXX_COMPILER=clang" to your CMake command for ROCm-CompilerSupport/build.

SamuelMarks commented 1 year ago
$ export PATH='/opt/rocm/llvm/bin:'"$PATH"
$ cd "$HOME"'/ROCm/ROCm-CompilerSupport/lib/comgr'
$ rm -rf build && mkdir "$_" && cd "$_"
$ cmake -DCMAKE_INSTALL_PREFIX='/opt/rocm' ..
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test Terminfo_LINKABLE
-- Performing Test Terminfo_LINKABLE - Success
-- Found Terminfo: /usr/lib/x86_64-linux-gnu/libtinfo.so  
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.13") 
-- Found zstd: /usr/lib/x86_64-linux-gnu/libzstd.so  
-- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so (found version "2.9.14") 

------------LLVM_DIR: /opt/rocm/llvm/lib/cmake/llvm
---LLVM_INCLUDE_DIRS: /opt/rocm/llvm/include
---LLVM_LIBRARY_DIRS: /opt/rocm/llvm/lib
-----------Clang_DIR: /opt/rocm/llvm/lib/cmake/clang
--CLANG_INCLUDE_DIRS: /opt/rocm/llvm/include
----LLD_INCLUDE_DIRS: /opt/rocm/llvm/include
---AMDDeviceLibs_DIR: /opt/rocm/lib/cmake/AMDDeviceLibs
------------ROCM_DIR: /opt/rocm/share/rocm/cmake

-- Configuring done
-- Generating done
-- Build files have been written to: ROCm/ROCm-CompilerSupport/lib/comgr/build
$ which clang
/opt/rocm/llvm/bin/clang
$ clang --version
clang version 17.0.0 (https://github.com/RadeonOpenCompute/llvm-project 73507dfb920e328560c77491548eae5b7b86b09b)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/rocm/llvm/bin
$ make VERBOSE=1

comgr.build.log

Looks like it might be a header search path issue on your end, because of occurrences like /usr/include/c++/12/bits/basic_string.h in the build log. Shouldn't everything be related to CLANG_INCLUDE_DIRS and LLVM_INCLUDE_DIRS?

lamb-j commented 1 year ago

I think there's a separation between the compiler driver we're building (Comgr, which uses parts of LLVM/clang and therefore needs things like an LLVM_INCLUDE_DIR and CLANG_INCLUDE_DIR to make sure the LLVM/clang API calls Comgr is using are properly defined/implemented), and the compiler CMake is using using to build Comgr (just a standard C++ compiler, but in this case one that supports C++17).

It looks like by default, CMake is using /usr/bin/c++ to compile Comgr. From your log, I see the following;

usr/bin/c++ -DAMD_COMGR_EXPORT -D_GNU_SOURCE -D_GNU_SOURCE -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_LIBCPP_ENABLE_ASSERTIONS -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -DSTDC_LIMIT_MACROS -DSTDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -Damd_comgr_EXPORTS -I/opt/rocm/llvm/include -IROCm/ROCm-CompilerSupport/lib/comgr/src -IROCm/ROCm-CompilerSupport/lib/comgr/build/include -fPIC -fno-rtti -Wall -Wno-attributes -fms-extensions -fvisibility=hidden -fno-strict-aliasing -std=c++14 -MD -MT CMakeFiles/amd_comgr.dir/src/comgr-compiler.cpp.o -MF CMakeFiles/amd_comgr.dir/src/comgr-compiler.cpp.o.d -o CMakeFiles/amd_comgr.dir/src/comgr-compiler.cpp.o -c ROCm/ROCm-CompilerSupport/lib/comgr/src/comgr-compiler.cpp In file included from ROCm/ROCm-CompilerSupport/lib/comgr/src/comgr-compiler.cpp:74: /opt/rocm/llvm/include/llvm/ADT/bit.h:64:56: error: ‘is_integral_v’ is not a member of ‘std’; did you mean ‘is_integral’? 64 | template <typename T, typename = std::enable_if_t<std::is_integral_v>>

This is similar to the command I see too. I normally do just use the default C++ compiler for CMake. In your case, I'm wondering if we're missing C++17 support.

Can you paste the output from the following? : usr/bin/c++ --version

As mentioned before I think if you set "-DCMAKE_CXX_COMPILER=clang" it may fix things (since you've already added clang to your $PATH).

Hopefully that makes sense. Definitely a good question, and there may be something we can do to moving forward to simplify this!

SamuelMarks commented 1 year ago

Thanks for following up


Hmm, that's still giving me:

/opt/rocm/llvm/include/llvm/ADT/bit.h:282:22: error: no template named 'is_unsigned_v' in namespace 'std'; did you mean 'is_unsigned'?
  static_assert(std::is_unsigned_v<T>,
                ~~~~~^~~~~~~~~~~~~
                     is_unsigned

Which seems to be a C++17 feature https://en.cppreference.com/w/cpp/types/is_unsigned

I also tried:

cmake -DCMAKE_INSTALL_PREFIX='/opt/rocm' -DCMAKE_CXX_COMPILER='clang' -DCMAKE_C_COMPILER='clang'

And even explicitly setting CC=$(which clang). So time to go nuclear:

$ env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake -DCMAKE_INSTALL_PREFIX='/opt/rocm' -DCMAKE_CXX_COMPILER='clang' -DCMAKE_C_COMPILER='clang' ..
-- The C compiler identification is Clang 17.0.0
-- The CXX compiler identification is Clang 17.0.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/rocm/llvm/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/rocm/llvm/bin/clang - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test Terminfo_LINKABLE
-- Performing Test Terminfo_LINKABLE - Success
-- Found Terminfo: /usr/lib/x86_64-linux-gnu/libtinfo.so  
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.13") 
-- Found zstd: /usr/lib/x86_64-linux-gnu/libzstd.so  
-- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so (found version "2.9.14") 

------------LLVM_DIR: /opt/rocm/llvm/lib/cmake/llvm
---LLVM_INCLUDE_DIRS: /opt/rocm/llvm/include
---LLVM_LIBRARY_DIRS: /opt/rocm/llvm/lib
-----------Clang_DIR: /opt/rocm/llvm/lib/cmake/clang
--CLANG_INCLUDE_DIRS: /opt/rocm/llvm/include
----LLD_INCLUDE_DIRS: /opt/rocm/llvm/include
---AMDDeviceLibs_DIR: /opt/rocm/lib/cmake/AMDDeviceLibs
------------ROCM_DIR: /opt/rocm/share/rocm/cmake

-- Configuring done
-- Generating done
-- Build files have been written to: ROCm/ROCm-CompilerSupport/lib/comgr/build
$ env -i PATH='/opt/rocm/llvm/bin:/usr/bin' make VERBOSE=1

Which gave a whole host of errors, e.g.:

In file included from /opt/rocm/llvm/include/llvm/Support/SwapByteOrder.h:17:
/opt/rocm/llvm/include/llvm/ADT/bit.h:64:51: error: template argument for non-type template parameter must be an expression
template <typename T, typename = std::enable_if_t<std::is_integral_v<T>>>
                                                  ^~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/type_traits:2613:17: note: template parameter is declared here
  template<bool _Cond, typename _Tp = void>
                ^

Full log: comgr.build.log


I'm thinking the fact it searches /usr/lib/gcc is an issue. Maybe there's a library search path var that I'm meant to override also?

lamb-j commented 1 year ago

Can you provide the exact commits you're using for LLVM, device-libs, and support (Comgr)?

After discussing with @slinder1, trying to compile with a rocm/clang may not be the best idea. Your system GCC 12 should work fine. However, he noticed in your log that your Comgr build commands are setting "-std=c++14", which I think is the exact cause of your errors. When I tried using the provided build steps I got the expected "-std=c++17".

/opt/rocm/llvm/bin/clang -DAMD_COMGR_EXPORT -D_GNU_SOURCE -D_GNU_SOURCE -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_LIBCPP_ENABLE_ASSERTIONS -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -DSTDC_LIMIT_MACROS -DSTDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -Damd_comgr_EXPORTS -I/opt/rocm/llvm/include -I$HOME/ROCm/ROCm-CompilerSupport/lib/comgr/src -I$HOME/ROCm/ROCm-CompilerSupport/lib/comgr/build/include -fPIC -fno-rtti -Wall -Wno-attributes -fms-extensions -fvisibility=hidden -fno-strict-aliasing -std=c++14 -MD -MT CMakeFiles/amd_comgr.dir/src/comgr-compiler.cpp.o -MF CMakeFiles/amd_comgr.dir/src/comgr-compiler.cpp.o.d -o CMakeFiles/amd_comgr.dir/src/comgr-compiler.cpp.o -c $HOME/ROCm/ROCm-CompilerSupport/lib/comgr/src/comgr-compiler.cpp

SamuelMarks commented 1 year ago

RadeonOpenCompute/llvm-project@73507

RadeonOpenCompute/ROCm-CompilerSupport (cogmr)@ be624c66c58a5ff60081538dff70a235248a8131

RadeonOpenCompute/ROCm-Device-Libs@936a78

$ rg -Ftcmake 'CMAKE_CXX_STANDARD'
hipSPARSE/clients/CMakeLists.txt:set(CMAKE_CXX_STANDARD 11)
hipSPARSE/clients/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
hipSPARSE/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
hipSPARSE/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
llvm-project/compiler-rt/CMakeLists.txt:  set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
llvm-project/compiler-rt/CMakeLists.txt:  set(CMAKE_CXX_STANDARD_REQUIRED YES)
llvm-project/llvm/tools/llvm-config/CMakeLists.txt:set(LLVM_CXXFLAGS "${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION} ${LLVM_CXX_STDLIB_FLAG} ${COMPILE_FLAGS} ${LLVM_DEFINITIONS}")
llvm-project/llvm/cmake/platforms/WinMsvc.cmake:set(CMAKE_CXX_STANDARD_LIBRARIES "" CACHE STRING "" FORCE)
llvm-project/llvm/CMakeLists.txt:# If we find that the cache contains CMAKE_CXX_STANDARD it means that it's a old CMakeCache.txt
llvm-project/llvm/CMakeLists.txt:if($CACHE{CMAKE_CXX_STANDARD} AND $CACHE{CMAKE_CXX_STANDARD} LESS ${LLVM_REQUIRED_CXX_STANDARD})
llvm-project/llvm/CMakeLists.txt:  message(WARNING "Resetting cache value for CMAKE_CXX_STANDARD to ${LLVM_REQUIRED_CXX_STANDARD}")
llvm-project/llvm/CMakeLists.txt:  unset(CMAKE_CXX_STANDARD CACHE)
llvm-project/llvm/CMakeLists.txt:# if CMAKE_CXX_STANDARD is still set after the cache unset above it means that the user requested it
llvm-project/llvm/CMakeLists.txt:if(DEFINED CMAKE_CXX_STANDARD AND CMAKE_CXX_STANDARD LESS ${LLVM_REQUIRED_CXX_STANDARD})
llvm-project/llvm/CMakeLists.txt:  message(FATAL_ERROR "Requested CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} which is less than the required ${LLVM_REQUIRED_CXX_STANDARD}.")
llvm-project/llvm/CMakeLists.txt:set(CMAKE_CXX_STANDARD ${LLVM_REQUIRED_CXX_STANDARD} CACHE STRING "C++ standard to conform to")
llvm-project/llvm/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED YES)
llvm-project/lld/CMakeLists.txt:  set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
llvm-project/lld/CMakeLists.txt:  set(CMAKE_CXX_STANDARD_REQUIRED YES)
llvm-project/clang/CMakeLists.txt:  set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
llvm-project/clang/CMakeLists.txt:  set(CMAKE_CXX_STANDARD_REQUIRED YES)
llvm-project/third-party/benchmark/CMakeLists.txt:  set(EXTRA_CXX_FLAGS "-DCMAKE_CXX_STANDARD=14")
llvm-project/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt:set(CMAKE_CXX_STANDARD 20)
llvm-project/libclc/CMakeLists.txt:set(CMAKE_CXX_STANDARD 17)
llvm-project/flang/CMakeLists.txt:set(CMAKE_CXX_STANDARD 17)
llvm-project/flang/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
llvm-project/lldb/CMakeLists.txt:  set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
llvm-project/lldb/CMakeLists.txt:  set(CMAKE_CXX_STANDARD_REQUIRED YES)
llvm-project/flang/lib/Decimal/CMakeLists.txt:  set(CMAKE_CXX_STANDARD 17)
llvm-project/flang/lib/Decimal/CMakeLists.txt:  set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
llvm-project/flang/runtime/CMakeLists.txt:  set(CMAKE_CXX_STANDARD 17)
llvm-project/flang/runtime/CMakeLists.txt:  set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
llvm-project/mlir/examples/standalone/CMakeLists.txt:set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
llvm-project/mlir/CMakeLists.txt:set(CMAKE_CXX_STANDARD 17)
llvm-project/bolt/CMakeLists.txt:set(CMAKE_CXX_STANDARD 17)
llvm-project/libc/CMakeLists.txt:set(CMAKE_CXX_STANDARD 17)
llvm-project/libc/cmake/modules/LLVMLibCObjectRules.cmake:    set(ADD_GPU_OBJ_CXX_STANDARD ${CMAKE_CXX_STANDARD})
llvm-project/libc/cmake/modules/LLVMLibCObjectRules.cmake:    set(ADD_OBJECT_CXX_STANDARD ${CMAKE_CXX_STANDARD})
llvm-project/libc/cmake/modules/LLVMLibCObjectRules.cmake:    set(ADD_ENTRYPOINT_OBJ_CXX_STANDARD ${CMAKE_CXX_STANDARD})
llvm-project/libc/cmake/modules/LLVMLibCTestRules.cmake:    set(LIBC_UNITTEST_CXX_STANDARD ${CMAKE_CXX_STANDARD})
llvm-project/libc/benchmarks/CMakeLists.txt:          -DCMAKE_CXX_STANDARD:STRING=14
llvm-project/bolt/runtime/CMakeLists.txt:set(CMAKE_CXX_STANDARD 17)
rocSPARSE/clients/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
rocSPARSE/clients/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
rocSPARSE/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
rocSPARSE/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
rocPRIM/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
rocPRIM/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
rocPRIM/cmake/Dependencies.cmake:      CMAKE_ARGS     -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} -DBENCHMARK_ENABLE_TESTING=OFF -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> -DCMAKE_CXX_STANDARD=14 ${COMPILER_OVERRIDE}
MIVisionX/utilities/loom_io_media/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/samples/model_compiler_samples/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/samples/c_samples/canny/CMakeLists.txt:set (CMAKE_CXX_STANDARD 14)
MIVisionX/samples/c_samples/opencv_orb/CMakeLists.txt:set (CMAKE_CXX_STANDARD 14)
MIVisionX/utilities/loom_shell/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/utilities/inference_generator/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/samples/inference/mv_objdetect/CMakeLists.txt:set (CMAKE_CXX_STANDARD 14)
MIVisionX/utilities/runcl/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/utilities/rocAL/rocAL_basic_test/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/utilities/rocAL/rocAL_performance_tests_with_depth/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/utilities/rocAL/rocAL_unittests/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/utilities/rocAL/rocAL_dataloader_mt/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/utilities/rocAL/rocAL_performance_tests/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/utilities/rocAL/rocAL_dataloader/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/utilities/rocAL/rocAL_video_unittests/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/utilities/mv_deploy/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/utilities/runvx/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/amd_openvx_extensions/amd_migraphx/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/amd_openvx_extensions/amd_rpp/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/amd_openvx_extensions/amd_custom/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/amd_openvx_extensions/amd_custom/custom_lib/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/amd_openvx_extensions/amd_media/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/amd_openvx_extensions/amd_loomsl/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/amd_openvx_extensions/amd_opencv/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/amd_openvx_extensions/amd_nn/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/apps/image_augmentation/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/amd_openvx/openvx/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/apps/optical_flow/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/apps/cloud_inference/server_app/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/apps/bubble_pop/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/apps/dg_test/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/rocAL/rocAL/CMakeLists.txt:    set(CMAKE_CXX_STANDARD 17)
MIVisionX/rocAL/rocAL_pybind/third_party_lib/pybind11/tools/pybind11Tools.cmake:if(NOT PYBIND11_CPP_STANDARD AND NOT CMAKE_CXX_STANDARD)
MIVisionX/tests/amd_migraphx_tests/runMIGraphXTests/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/tests/amd_migraphx_tests/resnet50/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/tests/amd_migraphx_tests/mnist/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/tests/zen_dnn_tests/mnist_app/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/tests/zen_dnn_tests/mnist/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/tests/zen_dnn_tests/conv/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
rocBLAS/cmake/toolchain-options.cmake:set( CMAKE_CXX_STANDARD 17 )
rocThrust/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
rocThrust/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
rocPRIM/test/extra/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
rocPRIM/test/extra/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
rocThrust/extra/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
rocThrust/extra/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
roctracer/CMakeLists.txt:set(CMAKE_CXX_STANDARD 17)
roctracer/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
rdc/CMakeLists.txt:set(CMAKE_CXX_STANDARD 11 CACHE STRING "The C++ standard to use")
rdc/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
Tensile/HostLibraryTests/CMakeLists.txt:set( CMAKE_CXX_STANDARD 14 )
MIOpen/src/composable_kernel/CMakeLists.txt:set(CMAKE_CXX_STANDARD 17)
MIOpen/src/composable_kernel/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
HIPCC/CMakeLists.txt:set(CMAKE_CXX_STANDARD 17)
HIPCC/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED True)
hipBLAS/clients/CMakeLists.txt:set( CMAKE_CXX_STANDARD 14 )
AMDMIGraphX/examples/migraphx/custom_op_miopen_kernel/CMakeLists.txt:set (CMAKE_CXX_STANDARD 14)
AMDMIGraphX/examples/migraphx/custom_op_rocblas_kernel/CMakeLists.txt:set (CMAKE_CXX_STANDARD 14)
AMDMIGraphX/examples/migraphx/custom_op_hip_kernel/CMakeLists.txt:set (CMAKE_CXX_STANDARD 14)
AMDMIGraphX/examples/migraphx/cpp_parse_load_save/CMakeLists.txt:set (CMAKE_CXX_STANDARD 14)
AMDMIGraphX/examples/vision/cpp_mnist/CMakeLists.txt:set (CMAKE_CXX_STANDARD 14)
AMDMIGraphX/CMakeLists.txt:set(CMAKE_CXX_STANDARD_DEFAULT "")
HIP/samples/2_Cookbook/20_hip_vulkan/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
hipBLAS/CMakeLists.txt:set( CMAKE_CXX_STANDARD 14 )
ROCR-Runtime/src/build/CMakeFiles/3.25.1/CMakeCXXCompiler.cmake:set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "17")
rocWMMA/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
rocWMMA/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
hipCUB/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
hipCUB/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
hipCUB/cmake/Dependencies.cmake:      CMAKE_ARGS     -DCMAKE_BUILD_TYPE=RELEASE -DBENCHMARK_ENABLE_TESTING=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> -DCMAKE_CXX_STANDARD=14 ${COMPILER_OVERRIDE}
hipCUB/test/extra/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
hipCUB/test/extra/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
rocSOLVER/CMakeLists.txt:set(CMAKE_CXX_STANDARD 17)
rocSOLVER/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
hipSOLVER/CMakeLists.txt:set( CMAKE_CXX_STANDARD 14 )
hipSOLVER/clients/CMakeLists.txt:set( CMAKE_CXX_STANDARD 14 )
ROCm-CompilerSupport/lib/comgr/build/CMakeFiles/3.25.1/CMakeCXXCompiler.cmake:set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "17")
rocRAND/CMakeLists.txt:set(CMAKE_CXX_STANDARD 11)
rocRAND/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
rocRAND/cmake/Dependencies.cmake:      CMAKE_ARGS     -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBUILD_SHARED_LIBS=OFF -DBENCHMARK_ENABLE_TESTING=OFF -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> -DCMAKE_CXX_STANDARD=14 ${COMPILER_OVERRIDE}
rocALUTION/clients/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
rocALUTION/clients/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
rocALUTION/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
rocALUTION/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
rccl/CMakeLists.txt:set( CMAKE_CXX_STANDARD 14 )
hipFFT/CMakeLists.txt:set( CMAKE_CXX_STANDARD 14 )

Want me to send pull requests to all these [non-LLVM] projects to bump to C++17?

slinder1 commented 1 year ago

RadeonOpenCompute/llvm-project@73507

RadeonOpenCompute/ROCm-CompilerSupport (cogmr)@ be624c6

RadeonOpenCompute/ROCm-Device-Libs@936a78

$ rg -Ftcmake 'CMAKE_CXX_STANDARD'
hipSPARSE/clients/CMakeLists.txt:set(CMAKE_CXX_STANDARD 11)
hipSPARSE/clients/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
hipSPARSE/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
hipSPARSE/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
llvm-project/compiler-rt/CMakeLists.txt:  set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
llvm-project/compiler-rt/CMakeLists.txt:  set(CMAKE_CXX_STANDARD_REQUIRED YES)
llvm-project/llvm/tools/llvm-config/CMakeLists.txt:set(LLVM_CXXFLAGS "${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION} ${LLVM_CXX_STDLIB_FLAG} ${COMPILE_FLAGS} ${LLVM_DEFINITIONS}")
llvm-project/llvm/cmake/platforms/WinMsvc.cmake:set(CMAKE_CXX_STANDARD_LIBRARIES "" CACHE STRING "" FORCE)
llvm-project/llvm/CMakeLists.txt:# If we find that the cache contains CMAKE_CXX_STANDARD it means that it's a old CMakeCache.txt
llvm-project/llvm/CMakeLists.txt:if($CACHE{CMAKE_CXX_STANDARD} AND $CACHE{CMAKE_CXX_STANDARD} LESS ${LLVM_REQUIRED_CXX_STANDARD})
llvm-project/llvm/CMakeLists.txt:  message(WARNING "Resetting cache value for CMAKE_CXX_STANDARD to ${LLVM_REQUIRED_CXX_STANDARD}")
llvm-project/llvm/CMakeLists.txt:  unset(CMAKE_CXX_STANDARD CACHE)
llvm-project/llvm/CMakeLists.txt:# if CMAKE_CXX_STANDARD is still set after the cache unset above it means that the user requested it
llvm-project/llvm/CMakeLists.txt:if(DEFINED CMAKE_CXX_STANDARD AND CMAKE_CXX_STANDARD LESS ${LLVM_REQUIRED_CXX_STANDARD})
llvm-project/llvm/CMakeLists.txt:  message(FATAL_ERROR "Requested CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} which is less than the required ${LLVM_REQUIRED_CXX_STANDARD}.")
llvm-project/llvm/CMakeLists.txt:set(CMAKE_CXX_STANDARD ${LLVM_REQUIRED_CXX_STANDARD} CACHE STRING "C++ standard to conform to")
llvm-project/llvm/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED YES)
llvm-project/lld/CMakeLists.txt:  set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
llvm-project/lld/CMakeLists.txt:  set(CMAKE_CXX_STANDARD_REQUIRED YES)
llvm-project/clang/CMakeLists.txt:  set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
llvm-project/clang/CMakeLists.txt:  set(CMAKE_CXX_STANDARD_REQUIRED YES)
llvm-project/third-party/benchmark/CMakeLists.txt:  set(EXTRA_CXX_FLAGS "-DCMAKE_CXX_STANDARD=14")
llvm-project/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt:set(CMAKE_CXX_STANDARD 20)
llvm-project/libclc/CMakeLists.txt:set(CMAKE_CXX_STANDARD 17)
llvm-project/flang/CMakeLists.txt:set(CMAKE_CXX_STANDARD 17)
llvm-project/flang/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
llvm-project/lldb/CMakeLists.txt:  set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
llvm-project/lldb/CMakeLists.txt:  set(CMAKE_CXX_STANDARD_REQUIRED YES)
llvm-project/flang/lib/Decimal/CMakeLists.txt:  set(CMAKE_CXX_STANDARD 17)
llvm-project/flang/lib/Decimal/CMakeLists.txt:  set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
llvm-project/flang/runtime/CMakeLists.txt:  set(CMAKE_CXX_STANDARD 17)
llvm-project/flang/runtime/CMakeLists.txt:  set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
llvm-project/mlir/examples/standalone/CMakeLists.txt:set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
llvm-project/mlir/CMakeLists.txt:set(CMAKE_CXX_STANDARD 17)
llvm-project/bolt/CMakeLists.txt:set(CMAKE_CXX_STANDARD 17)
llvm-project/libc/CMakeLists.txt:set(CMAKE_CXX_STANDARD 17)
llvm-project/libc/cmake/modules/LLVMLibCObjectRules.cmake:    set(ADD_GPU_OBJ_CXX_STANDARD ${CMAKE_CXX_STANDARD})
llvm-project/libc/cmake/modules/LLVMLibCObjectRules.cmake:    set(ADD_OBJECT_CXX_STANDARD ${CMAKE_CXX_STANDARD})
llvm-project/libc/cmake/modules/LLVMLibCObjectRules.cmake:    set(ADD_ENTRYPOINT_OBJ_CXX_STANDARD ${CMAKE_CXX_STANDARD})
llvm-project/libc/cmake/modules/LLVMLibCTestRules.cmake:    set(LIBC_UNITTEST_CXX_STANDARD ${CMAKE_CXX_STANDARD})
llvm-project/libc/benchmarks/CMakeLists.txt:          -DCMAKE_CXX_STANDARD:STRING=14
llvm-project/bolt/runtime/CMakeLists.txt:set(CMAKE_CXX_STANDARD 17)
rocSPARSE/clients/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
rocSPARSE/clients/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
rocSPARSE/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
rocSPARSE/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
rocPRIM/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
rocPRIM/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
rocPRIM/cmake/Dependencies.cmake:      CMAKE_ARGS     -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} -DBENCHMARK_ENABLE_TESTING=OFF -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> -DCMAKE_CXX_STANDARD=14 ${COMPILER_OVERRIDE}
MIVisionX/utilities/loom_io_media/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/samples/model_compiler_samples/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/samples/c_samples/canny/CMakeLists.txt:set (CMAKE_CXX_STANDARD 14)
MIVisionX/samples/c_samples/opencv_orb/CMakeLists.txt:set (CMAKE_CXX_STANDARD 14)
MIVisionX/utilities/loom_shell/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/utilities/inference_generator/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/samples/inference/mv_objdetect/CMakeLists.txt:set (CMAKE_CXX_STANDARD 14)
MIVisionX/utilities/runcl/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/utilities/rocAL/rocAL_basic_test/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/utilities/rocAL/rocAL_performance_tests_with_depth/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/utilities/rocAL/rocAL_unittests/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/utilities/rocAL/rocAL_dataloader_mt/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/utilities/rocAL/rocAL_performance_tests/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/utilities/rocAL/rocAL_dataloader/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/utilities/rocAL/rocAL_video_unittests/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/utilities/mv_deploy/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/utilities/runvx/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/amd_openvx_extensions/amd_migraphx/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/amd_openvx_extensions/amd_rpp/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/amd_openvx_extensions/amd_custom/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/amd_openvx_extensions/amd_custom/custom_lib/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/amd_openvx_extensions/amd_media/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/amd_openvx_extensions/amd_loomsl/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/amd_openvx_extensions/amd_opencv/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/amd_openvx_extensions/amd_nn/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/apps/image_augmentation/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/amd_openvx/openvx/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/apps/optical_flow/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/apps/cloud_inference/server_app/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/apps/bubble_pop/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/apps/dg_test/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/rocAL/rocAL/CMakeLists.txt:    set(CMAKE_CXX_STANDARD 17)
MIVisionX/rocAL/rocAL_pybind/third_party_lib/pybind11/tools/pybind11Tools.cmake:if(NOT PYBIND11_CPP_STANDARD AND NOT CMAKE_CXX_STANDARD)
MIVisionX/tests/amd_migraphx_tests/runMIGraphXTests/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/tests/amd_migraphx_tests/resnet50/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/tests/amd_migraphx_tests/mnist/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/tests/zen_dnn_tests/mnist_app/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/tests/zen_dnn_tests/mnist/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
MIVisionX/tests/zen_dnn_tests/conv/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
rocBLAS/cmake/toolchain-options.cmake:set( CMAKE_CXX_STANDARD 17 )
rocThrust/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
rocThrust/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
rocPRIM/test/extra/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
rocPRIM/test/extra/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
rocThrust/extra/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
rocThrust/extra/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
roctracer/CMakeLists.txt:set(CMAKE_CXX_STANDARD 17)
roctracer/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
rdc/CMakeLists.txt:set(CMAKE_CXX_STANDARD 11 CACHE STRING "The C++ standard to use")
rdc/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
Tensile/HostLibraryTests/CMakeLists.txt:set( CMAKE_CXX_STANDARD 14 )
MIOpen/src/composable_kernel/CMakeLists.txt:set(CMAKE_CXX_STANDARD 17)
MIOpen/src/composable_kernel/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
HIPCC/CMakeLists.txt:set(CMAKE_CXX_STANDARD 17)
HIPCC/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED True)
hipBLAS/clients/CMakeLists.txt:set( CMAKE_CXX_STANDARD 14 )
AMDMIGraphX/examples/migraphx/custom_op_miopen_kernel/CMakeLists.txt:set (CMAKE_CXX_STANDARD 14)
AMDMIGraphX/examples/migraphx/custom_op_rocblas_kernel/CMakeLists.txt:set (CMAKE_CXX_STANDARD 14)
AMDMIGraphX/examples/migraphx/custom_op_hip_kernel/CMakeLists.txt:set (CMAKE_CXX_STANDARD 14)
AMDMIGraphX/examples/migraphx/cpp_parse_load_save/CMakeLists.txt:set (CMAKE_CXX_STANDARD 14)
AMDMIGraphX/examples/vision/cpp_mnist/CMakeLists.txt:set (CMAKE_CXX_STANDARD 14)
AMDMIGraphX/CMakeLists.txt:set(CMAKE_CXX_STANDARD_DEFAULT "")
HIP/samples/2_Cookbook/20_hip_vulkan/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
hipBLAS/CMakeLists.txt:set( CMAKE_CXX_STANDARD 14 )
ROCR-Runtime/src/build/CMakeFiles/3.25.1/CMakeCXXCompiler.cmake:set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "17")
rocWMMA/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
rocWMMA/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
hipCUB/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
hipCUB/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
hipCUB/cmake/Dependencies.cmake:      CMAKE_ARGS     -DCMAKE_BUILD_TYPE=RELEASE -DBENCHMARK_ENABLE_TESTING=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> -DCMAKE_CXX_STANDARD=14 ${COMPILER_OVERRIDE}
hipCUB/test/extra/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
hipCUB/test/extra/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
rocSOLVER/CMakeLists.txt:set(CMAKE_CXX_STANDARD 17)
rocSOLVER/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
hipSOLVER/CMakeLists.txt:set( CMAKE_CXX_STANDARD 14 )
hipSOLVER/clients/CMakeLists.txt:set( CMAKE_CXX_STANDARD 14 )
ROCm-CompilerSupport/lib/comgr/build/CMakeFiles/3.25.1/CMakeCXXCompiler.cmake:set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "17")
rocRAND/CMakeLists.txt:set(CMAKE_CXX_STANDARD 11)
rocRAND/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
rocRAND/cmake/Dependencies.cmake:      CMAKE_ARGS     -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBUILD_SHARED_LIBS=OFF -DBENCHMARK_ENABLE_TESTING=OFF -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> -DCMAKE_CXX_STANDARD=14 ${COMPILER_OVERRIDE}
rocALUTION/clients/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
rocALUTION/clients/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
rocALUTION/CMakeLists.txt:set(CMAKE_CXX_STANDARD 14)
rocALUTION/CMakeLists.txt:set(CMAKE_CXX_STANDARD_REQUIRED ON)
rccl/CMakeLists.txt:set( CMAKE_CXX_STANDARD 14 )
hipFFT/CMakeLists.txt:set( CMAKE_CXX_STANDARD 14 )

Want me to send pull requests to all these [non-LLVM] projects to bump to C++17?

There should be no need to send PRs, the code has already been updated. See for example https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/blob/17ca9f705d6452dd49dc8ea012f53bad651e4630/lib/comgr/CMakeLists.txt#L185

How are you determining what commits to use for these projects? You are mixing an old Comgr ref (release/rocm-rel-5.4 circa November 2022) with a bleeding-edge LLVM ref (amd-stg-open circa May 2023).

There is a lot of room for improvement in terms of documenting how to build our stack (and I'm working internally on merging Comgr, LLVM, and device-libs to avoid mixing incompatible versions), but it seems like the guide you linked to at https://gist.github.com/rigtorp/d9483af100fb77cee57e4c9fa3c74245 should at least get you a recent Comgr ref from amd-stg-open:

git clone -b amd-stg-open https://github.com/RadeonOpenCompute/ROCm-CompilerSupport

Perhaps you just haven't fetched the latest changes on the branch? Can you try git pull in the Comgr repo followed by a clean build?

SamuelMarks commented 1 year ago

Issues at 17ca9f7:

$ git fetch roc-github amd-stg-open
$ git checkout amd-stg-open
$ rm -rf build ; mkdir "$_" && cd "$_"
$ $ env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake -DCMAKE_INSTALL_PREFIX='/opt/rocm' -DCMAKE_CXX_COMPILER='clang' -DCMAKE_C_COMPILER='clang' ..
$ env -i PATH='/opt/rocm/llvm/bin:/usr/bin' make VERBOSE=1

logggg.log

slinder1 commented 1 year ago

Issues at 17ca9f7:

$ git fetch roc-github amd-stg-open
$ git checkout amd-stg-open
$ rm -rf build ; mkdir "$_" && cd "$_"
$ $ env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake -DCMAKE_INSTALL_PREFIX='/opt/rocm' -DCMAKE_CXX_COMPILER='clang' -DCMAKE_C_COMPILER='clang' ..
$ env -i PATH='/opt/rocm/llvm/bin:/usr/bin' make VERBOSE=1

logggg.log

Have you also updated and rebuilt LLVM? Generally you need to update these components (LLVM, Comgr, device-libs, at least) in lockstep as there is no true interface between them. Any change in any component can break the build.

kzhuravl commented 1 year ago

Author

The getDesc* was updated in https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/commit/edea3631e2c1cd49c93f6fff883fea2affdfa2d1 due to a commit coming from llvm: https://github.com/llvm/llvm-project/commit/689715f335aeffc0e9583ac1b2a5629b6dd47876.

If you want to work with latest sources, I'd suggest checking out amd-stg-open branch of llvm, device-libs, compiler-support at a relatively same time. As mentioned by Scott and Jacob, older llvm may be incompatible with newer compiler-support due to API changes, etc.

Scott is also working on integrating device-libs and compiler-support sources into our fork of llvm to mitigate issues like this.

SamuelMarks commented 1 year ago

After running looping through my ROCm directory and running git pull on each, I received the same issue @:

ROCm-CompilerSupport/lib/comgr/build$ env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake -DCMAKE_INSTALL_PREFIX=/opt/rocm ..
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test Terminfo_LINKABLE
-- Performing Test Terminfo_LINKABLE - Success
-- Found Terminfo: 
/usr/lib/x86_64-linux-gnu/libtinfo.so  
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.13") 
-- Found zstd: /usr/lib/x86_64-linux-gnu/libzstd.so  
-- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so (found version "2.9.14") 

------------LLVM_DIR: /opt/rocm/llvm/lib/cmake/llvm
---LLVM_INCLUDE_DIRS: /opt/rocm/llvm/include
---LLVM_LIBRARY_DIRS: /opt/rocm/llvm/lib
-----------Clang_DIR: /opt/rocm/llvm/lib/cmake/clang
--CLANG_INCLUDE_DIRS: /opt/rocm/llvm/include
----LLD_INCLUDE_DIRS: /opt/rocm/llvm/include
---AMDDeviceLibs_DIR: /opt/rocm/lib/cmake/AMDDeviceLibs
------------ROCM_DIR: /opt/rocm/share/rocm/cmake

-- Configuring done
-- Generating done
-- Build files have been written to: $HOME/ROCm/ROCm-CompilerSupport/lib/comgr/build
$ env -i PATH='/opt/rocm/llvm/bin:/usr/bin' make VERBOSE=1

logggg.log

EDIT: Tried with env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake -DCMAKE_INSTALL_PREFIX='/opt/rocm' -DCMAKE_CXX_COMPILER='clang' -DCMAKE_C_COMPILER='clang' .. also but got same errors like:

ROCm-CompilerSupport/lib/comgr/src/comgr-metadata.cpp:591:24: error: too many arguments to function call, expected 0, have 1
      if (Note.getDesc(4).size() <
          ~~~~~~~~~~~~ ^
/opt/rocm/llvm/include/llvm/Object/ELFTypes.h:638:21: note: 'getDesc' declared here
  ArrayRef<uint8_t> getDesc() const {
                    ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
slinder1 commented 1 year ago

After running looping through my ROCm directory and running git pull on each, I received the same issue @:

ROCm-CompilerSupport/lib/comgr/build$ env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake -DCMAKE_INSTALL_PREFIX=/opt/rocm ..
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test Terminfo_LINKABLE
-- Performing Test Terminfo_LINKABLE - Success
-- Found Terminfo: 
/usr/lib/x86_64-linux-gnu/libtinfo.so  
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.13") 
-- Found zstd: /usr/lib/x86_64-linux-gnu/libzstd.so  
-- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so (found version "2.9.14") 

------------LLVM_DIR: /opt/rocm/llvm/lib/cmake/llvm
---LLVM_INCLUDE_DIRS: /opt/rocm/llvm/include
---LLVM_LIBRARY_DIRS: /opt/rocm/llvm/lib
-----------Clang_DIR: /opt/rocm/llvm/lib/cmake/clang
--CLANG_INCLUDE_DIRS: /opt/rocm/llvm/include
----LLD_INCLUDE_DIRS: /opt/rocm/llvm/include
---AMDDeviceLibs_DIR: /opt/rocm/lib/cmake/AMDDeviceLibs
------------ROCM_DIR: /opt/rocm/share/rocm/cmake

-- Configuring done
-- Generating done
-- Build files have been written to: $HOME/ROCm/ROCm-CompilerSupport/lib/comgr/build
$ env -i PATH='/opt/rocm/llvm/bin:/usr/bin' make VERBOSE=1

logggg.log

EDIT: Tried with env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake -DCMAKE_INSTALL_PREFIX='/opt/rocm' -DCMAKE_CXX_COMPILER='clang' -DCMAKE_C_COMPILER='clang' .. also but got same errors like:

ROCm-CompilerSupport/lib/comgr/src/comgr-metadata.cpp:591:24: error: too many arguments to function call, expected 0, have 1
      if (Note.getDesc(4).size() <
          ~~~~~~~~~~~~ ^
/opt/rocm/llvm/include/llvm/Object/ELFTypes.h:638:21: note: 'getDesc' declared here
  ArrayRef<uint8_t> getDesc() const {
                    ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

Ah, sorry for suggesting things piecemeal, I hadn't considered that you were building Comgr against an installed copy of LLVM in /opt/rocm

If you are building Comgr from source you either need to use a Comgr revision you know is compatible with whatever ROCm installation you are using, or you need to explicitly point the Comgr build at another build of LLVM and device-libs. I don't know that we have a public repository which documents what revisions of components were used to create ROCm releases, so the former option is more difficult. The latter option is generally achievable by just pulling the latest revision for corresponding branches (as you have just done).

The README for Comgr does cover this, but unfortunately due to the nested nature of the repository it is buried in the lib/comgr directory: https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/blob/amd-stg-open/lib/comgr/README.md#building-the-code-object-manager

(The extra nesting will be removed as part of the merging of the repositories.)

In short: when running cmake's configure step for Comgr you should point it at the local builds you have for LLVM and device-libs using -DCMAKE_PREFIX_PATH="$LLVM_PROJECT/build;$DEVICE_LIBS/build". You can confirm it is using the local builds you expect via the lines it prints when running the configure step, i.e. you should not see /opt/rocm/ for anything but ROCM_DIR below:

------------LLVM_DIR: /opt/rocm/llvm/lib/cmake/llvm
---LLVM_INCLUDE_DIRS: /opt/rocm/llvm/include
---LLVM_LIBRARY_DIRS: /opt/rocm/llvm/lib
-----------Clang_DIR: /opt/rocm/llvm/lib/cmake/clang
--CLANG_INCLUDE_DIRS: /opt/rocm/llvm/include
----LLD_INCLUDE_DIRS: /opt/rocm/llvm/include
---AMDDeviceLibs_DIR: /opt/rocm/lib/cmake/AMDDeviceLibs
------------ROCM_DIR: /opt/rocm/share/rocm/cmake
SamuelMarks commented 1 year ago

I already have that. My filtered ~/.bash_history from yesterday:

rm -rf 'llvm-project/llvm/build'
mkdir "$_" && pushd "$_"
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/rocm/llvm -DLLVM_ENABLE_ASSERTIONS=1 -DLLVM_TARGETS_TO_BUILD="AMDGPU;X86" -DLLVM_ENABLE_PROJECTS="compiler-rt;lld;clang" "$HOME"'/ROCm/llvm-project/llvm'
cmake --build .
for f in *; do [[ "$f" != 'llvm-project' ]] && ( pushd "$f" && git pull ; popd) ; done
for d in 'rocm-cmake' 'ROCT-Thunk-Interface'; do
  rm -rf "$d"'/build' && mkdir "$_" && pushd "$_" && cmake -DCMAKE_INSTALL_PREFIX='/opt/rocm' .. && cmake --build . && sudo make install && popd;
done
sudo cp -r 'ROCT-Thunk-Interface/include' /opt/rocm/
rm -rf 'ROCR-Runtime/src/build'
mkdir "$_" && pushd "$_"
env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake -DCMAKE_INSTALL_PREFIX=/opt/rocm -DHSAKMT_INC_PATH=/opt/rocm/include -DHSAKMT_LIB_PATH=/opt/rocm/lib64 ..
env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake --build .
sudo make install
popd
rm -rf rocminfo/build
mkdir "$_" && pushd "$_"
env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake -DCMAKE_INSTALL_PREFIX=/opt/rocm -DROCM_DIR=/opt/rocm ..
env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake --build .
sudo make install
popd
rm -rf ROCm-Device-Libs/build
mkdir "$_" && pushd "$_"
env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake -DCMAKE_INSTALL_PREFIX=/opt/rocm ..
env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake --build .
sudo make install
popd
rm -rf ROCm-CompilerSupport/lib/comgr/build
mkdir "$_" && pushd "$_"
env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake -DCMAKE_INSTALL_PREFIX=/opt/rocm ..
env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake -DCMAKE_INSTALL_PREFIX='/opt/rocm' -DCMAKE_CXX_COMPILER='clang' -DCMAKE_C_COMPILER='clang' ..
env -i PATH='/opt/rocm/llvm/bin:/usr/bin' make VERBOSE=1 &> logggg.log
popd
slinder1 commented 1 year ago

I already have that. My filtered ~/.bash_history from yesterday:

rm -rf 'llvm-project/llvm/build'
mkdir "$_" && pushd "$_"
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/rocm/llvm -DLLVM_ENABLE_ASSERTIONS=1 -DLLVM_TARGETS_TO_BUILD="AMDGPU;X86" -DLLVM_ENABLE_PROJECTS="compiler-rt;lld;clang" "$HOME"'/ROCm/llvm-project/llvm'
cmake --build .
for f in *; do [[ "$f" != 'llvm-project' ]] && ( pushd "$f" && git pull ; popd) ; done
for d in 'rocm-cmake' 'ROCT-Thunk-Interface'; do
  rm -rf "$d"'/build' && mkdir "$_" && pushd "$_" && cmake -DCMAKE_INSTALL_PREFIX='/opt/rocm' .. && cmake --build . && sudo make install && popd;
done
sudo cp -r 'ROCT-Thunk-Interface/include' /opt/rocm/
rm -rf 'ROCR-Runtime/src/build'
mkdir "$_" && pushd "$_"
env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake -DCMAKE_INSTALL_PREFIX=/opt/rocm -DHSAKMT_INC_PATH=/opt/rocm/include -DHSAKMT_LIB_PATH=/opt/rocm/lib64 ..
env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake --build .
sudo make install
popd
rm -rf rocminfo/build
mkdir "$_" && pushd "$_"
env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake -DCMAKE_INSTALL_PREFIX=/opt/rocm -DROCM_DIR=/opt/rocm ..
env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake --build .
sudo make install
popd
rm -rf ROCm-Device-Libs/build
mkdir "$_" && pushd "$_"
env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake -DCMAKE_INSTALL_PREFIX=/opt/rocm ..
env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake --build .
sudo make install
popd
rm -rf ROCm-CompilerSupport/lib/comgr/build
mkdir "$_" && pushd "$_"
env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake -DCMAKE_INSTALL_PREFIX=/opt/rocm ..
env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake -DCMAKE_INSTALL_PREFIX='/opt/rocm' -DCMAKE_CXX_COMPILER='clang' -DCMAKE_C_COMPILER='clang' ..
env -i PATH='/opt/rocm/llvm/bin:/usr/bin' make VERBOSE=1 &> logggg.log
popd

I don't see any mention of CMAKE_PREFIX_PATH; maybe you are mixing it up with CMAKE_INSTALL_PREFIX?

SamuelMarks commented 1 year ago

Oh right on non Windows you have rpaths. Not sure if CMAKE_INSTALL_PREFIX is needed when I use this syntax:

rm -rf 'llvm-project/llvm/build'
mkdir "$_" && pushd "$_"
cmake -DCMAKE_BUILD_TYPE='Release' -DCMAKE_INSTALL_PREFIX='/opt/rocm/llvm' -DLLVM_ENABLE_ASSERTIONS=1 -DLLVM_TARGETS_TO_BUILD="AMDGPU;X86" -DLLVM_ENABLE_PROJECTS="compiler-rt;lld;clang" #"$HOME"'/ROCm/llvm-project/llvm'
cmake --build .
sudo cmake --install . --prefix '/opt/rocm'

for f in *; do [[ "$f" != 'llvm-project' ]] && ( pushd "$f" && git pull ; popd) ; done

for d in 'rocm-cmake' 'ROCT-Thunk-Interface'; do
  rm -rf "$d"'/build' && mkdir "$_" && pushd "$_" && cmake -DCMAKE_INSTALL_PREFIX='/opt/rocm' -DCMAKE_PREFIX_PATH='/opt/rocm' .. && cmake --build . && sudo cmake --install . --prefix '/opt/rocm' && popd;
done

sudo cp -r 'ROCT-Thunk-Interface/include' /opt/rocm/
rm -rf 'ROCR-Runtime/src/build'
mkdir "$_" && pushd "$_"
env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake -DCMAKE_INSTALL_PREFIX='/opt/rocm' -DCMAKE_PREFIX_PATH='/opt/rocm' -DHSAKMT_INC_PATH='/opt/rocm/include' -DHSAKMT_LIB_PATH='/opt/rocm/lib64' ..
env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake --build .
sudo cmake --install . --prefix '/opt/rocm'
popd

rm -rf 'rocminfo/build'
mkdir "$_" && pushd "$_"
env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake -DCMAKE_INSTALL_PREFIX='/opt/rocm' -DCMAKE_PREFIX_PATH='/opt/rocm' -DROCM_DIR='/opt/rocm' ..
env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake --build .
sudo cmake --install . --prefix '/opt/rocm'
popd

rm -rf 'ROCm-Device-Libs/build'
mkdir "$_" && pushd "$_"
env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake -DCMAKE_INSTALL_PREFIX='/opt/rocm' -DCMAKE_PREFIX_PATH='/opt/rocm' ..
env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake --build .
sudo cmake --install . --prefix '/opt/rocm'
popd

rm -rf 'ROCm-CompilerSupport/lib/comgr/build'
mkdir "$_" && pushd "$_"
env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake -DCMAKE_INSTALL_PREFIX='/opt/rocm' -DCMAKE_PREFIX_PATH='/opt/rocm' -DCMAKE_CXX_COMPILER='clang' -DCMAKE_C_COMPILER='clang' ..
env -i PATH='/opt/rocm/llvm/bin:/usr/bin' make VERBOSE=1 &> logggg.log
# sudo cmake --install . --prefix '/opt/rocm'
popd

Relevant sections:

~/ROCm/ROCm-CompilerSupport/lib/comgr/build ~/ROCm
-- The C compiler identification is Clang 17.0.0
-- The CXX compiler identification is Clang 17.0.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/rocm/llvm/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/rocm/llvm/bin/clang - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test Terminfo_LINKABLE
-- Performing Test Terminfo_LINKABLE - Success
-- Found Terminfo: /usr/lib/x86_64-linux-gnu/libtinfo.so  
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.13") 
-- Found zstd: /usr/lib/x86_64-linux-gnu/libzstd.so  
-- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so (found version "2.9.14") 

------------LLVM_DIR: /opt/rocm/llvm/lib/cmake/llvm
---LLVM_INCLUDE_DIRS: /opt/rocm/llvm/include
---LLVM_LIBRARY_DIRS: /opt/rocm/llvm/lib
-----------Clang_DIR: /opt/rocm/llvm/lib/cmake/clang
--CLANG_INCLUDE_DIRS: /opt/rocm/llvm/include
----LLD_INCLUDE_DIRS: /opt/rocm/llvm/include
---AMDDeviceLibs_DIR: /opt/rocm/lib/cmake/AMDDeviceLibs
------------ROCM_DIR: /opt/rocm/share/rocm/cmake

-- Configuring done
-- Generating done
-- Build files have been written to: $HOME/ROCm/ROCm-CompilerSupport/lib/comgr/build

logggg.log

Which again is this:

/opt/rocm/llvm/include/llvm/Object/ELFTypes.h:638:21: note: 'getDesc' declared here
  ArrayRef<uint8_t> getDesc() const {
                    ^
$HOME/ROCm/ROCm-CompilerSupport/lib/comgr/src/comgr-metadata.cpp:581:24: error: too many arguments to function call, expected 0, have 1
      if (Note.getDesc(4).size() < sizeof(amdgpu_hsa_note_hsail_s)) {
          ~~~~~~~~~~~~ ^
/opt/rocm/llvm/include/llvm/Object/ELFTypes.h:638:21: note: 'getDesc' declared here
  ArrayRef<uint8_t> getDesc() const {
                    ^
$HOME/ROCm/ROCm-CompilerSupport/lib/comgr/src/comgr-metadata.cpp:591:24: error: too many arguments to function call, expected 0, have 1
      if (Note.getDesc(4).size() <
          ~~~~~~~~~~~~ ^
/opt/rocm/llvm/include/llvm/Object/ELFTypes.h:638:21: note: 'getDesc' declared here
  ArrayRef<uint8_t> getDesc() const {
                    ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

So trying again, this time with the last block containing:

rm -rf 'ROCm-CompilerSupport/lib/comgr/build'
mkdir "$_" && pushd "$_"
env -i PATH='/opt/rocm/llvm/bin:/usr/bin' cmake -DCMAKE_INSTALL_PREFIX='/opt/rocm' -DCMAKE_PREFIX_PATH='/opt/rocm' -DCMAKE_PREFIX_PATH="$HOME"'/ROCm/llvm-project/build;'"$HOME"'/ROCm/ROCm-Device-Libs/build' -DCMAKE_CXX_COMPILER='clang' -DCMAKE_C_COMPILER='clang' ..
env -i PATH='/opt/rocm/llvm/bin:/usr/bin' make VERBOSE=1 &> logggg.log
# sudo cmake --install . --prefix '/opt/rocm'
popd
~/ROCm/ROCm-CompilerSupport/lib/comgr/build ~/ROCm ~/ROCm
-- The C compiler identification is Clang 17.0.0
-- The CXX compiler identification is Clang 17.0.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: $HOME/ROCm/llvm-project/build/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: $HOME/ROCm/llvm-project/build/bin/clang - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test Terminfo_LINKABLE
-- Performing Test Terminfo_LINKABLE - Success
-- Found Terminfo: /usr/lib/x86_64-linux-gnu/libtinfo.so  
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.13") 
-- Found zstd: /usr/lib/x86_64-linux-gnu/libzstd.so  
-- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so (found version "2.9.14") 

------------LLVM_DIR: $HOME/ROCm/llvm-project/build/lib/cmake/llvm
---LLVM_INCLUDE_DIRS: $HOME/ROCm/llvm-project/llvm/include;$HOME/ROCm/llvm-project/build/include
---LLVM_LIBRARY_DIRS: $HOME/ROCm/llvm-project/build/./lib
-----------Clang_DIR: $HOME/ROCm/llvm-project/build/lib/cmake/clang
--CLANG_INCLUDE_DIRS: $HOME/ROCm/llvm-project/clang/include;$HOME/ROCm/llvm-project/build/tools/clang/include
----LLD_INCLUDE_DIRS: $HOME/ROCm/llvm-project/lld/include;$HOME/ROCm/llvm-project/build/tools/lld/include
---AMDDeviceLibs_DIR: $HOME/ROCm/ROCm-Device-Libs/build/lib/cmake/AMDDeviceLibs
------------ROCM_DIR: /opt/rocm/share/rocm/cmake

-- Configuring done
-- Generating done
-- Build files have been written to: $HOME/ROCm/ROCm-CompilerSupport/lib/comgr/build
$ env -i PATH='/opt/rocm/llvm/bin:/usr/bin' make VERBOSE=1

So many errors then occurred that it doesn't fit in GitHub comment max. Here it is in a gist: https://gist.github.com/SamuelMarks/25b3c6a793c5b786bc9ec66a2182b472

For example:

> /usr/bin/ld: AMDGPUAttributor.cpp:(.text._ZN12_GLOBAL__N_122AAAMDFlatWorkGroupSizeD0Ev+0x4d): undefined reference to `operator delete[](void*)'

Is the wrong linker being used? - Or some other issue at play?

aaronmondal commented 1 year ago

Scott is also working on integrating device-libs and compiler-support sources into our fork of llvm to mitigate issues like this.

Is that really necessary/Wouldn't it be better to directly integrate these repos into upstream LLVM instead? It's already hard enough to build ROCm against regular LLVM, but having critical dependencies like device-libs and comgr in the amd-llvm fork would make it close to impossible to build ROCm against the non-amd LLVM.

There is always that "ah we can upstream this later" thought, but realistically this will just end like dpc++ which just stopped upstreaming at some point. For distro maintainers it can be a huge pain to build custom llvm variants because it takes really long, is an error-prone build, and potentially interferes with system dependencies like the host toolchain.

slinder1 commented 1 year ago

Scott is also working on integrating device-libs and compiler-support sources into our fork of llvm to mitigate issues like this.

Is that really necessary/Wouldn't it be better to directly integrate these repos into upstream LLVM instead? It's already hard enough to build ROCm against regular LLVM, but having critical dependencies like device-libs and comgr in the amd-llvm fork would make it close to impossible to build ROCm against the non-amd LLVM.

There is always that "ah we can upstream this later" thought, but realistically this will just end like dpc++ which just stopped upstreaming at some point. For distro maintainers it can be a huge pain to build custom llvm variants because it takes really long, is an error-prone build, and potentially interferes with system dependencies like the host toolchain.

I understand your frustration, and we do see upstreaming as possible a little further down the line, but there are significant blockers which currently prevent this. For Comgr, this is mostly a function of code-quality concerns that require large features/refactors of existing LLVM/Clang code to address.

There is a non-trivial amount of duplicated code in Comgr currently because the relevant LLVM/Clang functionality simply isn't exposed as a library upstream. Comgr currently acts as a means to present a library interface where one does not already exist, even when that requires accumulating some technical debt.

Eliminating this debt depends on significant features/refactoring upstream, including at least:

The device-libs have their own set of constraints that I'm less familiar with, but their maintainer is not comfortable with an upstreaming effort being undertaken currently.

Again, we do see the value in upstreaming, and have been working towards it. We work upstream as a rule, but have to accept practical compromises to ship a functional product in the meantime. It is simply not feasible to drop other efforts and focus on completing all the work needed to even consider upstreaming. We can, however, take steps to reduce the barriers for external developers, and combining repositories where we see a path to eventual upstreaming is a relatively simple first-step which we think will bring value for every party involved.

but having critical dependencies like device-libs and comgr in the amd-llvm fork would make it close to impossible to build ROCm against the non-amd LLVM.

We have kept this in mind and will not be dropping support for building these components against/as-part-of another LLVM. With e.g. git-worktrees it will not even require separate git repositories to achieve this. All we will be doing is making one logical repository which captures the true interface guarantees between these components (i.e. no guarantees between commits!), but anyone who is aware of this and wants to backport changes to make builds against upstream LLVM work will still be able to do so without any additional friction.

slinder1 commented 1 year ago

@SamuelMarks

-DCMAKE_CXX_COMPILER='clang'

My first guess is just that you need to use clang++ as your CXX_COMPILER, as just clang will not link against the the C++ support libraries you need (and so you'll never link against an implementation of e.g. operator delete[](void*))

SamuelMarks commented 1 year ago

Thanks @slinder1 that fixed the issue, will continue working through the gist then (finally) can work on contributing support for my Navi 22 (AMD Radeon™ RX 6850M XT 12GB GDDR6).

slinder1 commented 1 year ago

Glad to hear it! Please open another issue or re-open this one if you have any more build issues!