[Openmp-commits] [PATCH] D98658: [libomptarget] Build amdgcn devicertl by default

Jon Chesterfield via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Mar 16 11:41:17 PDT 2021

JonChesterfield added a comment.

There is a failure mode here. If clang is built with an llvm that has the amdgpu target disabled, it will fail to compile this library. This is because clang sets the flag amdhsa-code-object-version for amdgpu, but that flag is defined in llvm, and is excluded from the build if the amdgpu target is disabled. That can be fixed by either not building openmp, or by enabling the target, but the error message the user gets is poor:

  clang (LLVM option parsing): Unknown command line argument '--amdhsa-code-object-version=3'.  Try: 'clang (LLVM option parsing) --help'
  clang (LLVM option parsing): Did you mean '--pgo-memop-max-version=3'?

cmake has a  CHECK_CXX_COMPILER_FLAG control, but that doesn't work as CXX_COMPILER is not set to the compiler that is building the library. There is a CHECK_CXX_SOURCE_COMPILES which has the same problem.

I'm considering embedding `llc --version | grep -c amdgcn` in cmake, but can't work out how to and it seems excessively ugly.

Any suggestions on how to detect when the clang detected/specified is going to fail to build the library, and thus skip it?

  rG LLVM Github Monorepo



More information about the Openmp-commits mailing list