Page MenuHomePhabricator

[OpenMP] Search llvm package to find bc file compiler and linker if not specified by a user
AbandonedPublic

Authored by guansong on Apr 3 2018, 11:38 AM.

Details

Reviewers
grokos
Summary

This is a small improvement over the command line option to specify compiler and linker for bc files processing.

It includes considerations for both built and installed version of clang and also search the the path for the build compiler used for the runtime.

Diff Detail

Repository
rOMP OpenMP

Event Timeline

guansong created this revision.Apr 3 2018, 11:38 AM

I'm not sure what cases this helps as the code already uses CMAKE_CXX_COMPILER that the user specified. We had a very long discussion during the initial check-in of libomptarget, please do read that.

This is only for compiler and linker used for building bclib. It is not the default build compiler.

With this patch, if a user does not specify compiler and linker for the bc library, but uses -DLIBOMPTARGET_NVPTX_ENABLE_BCLIB=1, the cmake script will try to locate if the build compiler is clang and can be used for building the bc lib.

This is only for compiler and linker used for building bclib. It is not the default build compiler.

With this patch, if a user does not specify compiler and linker for the bc library, but uses -DLIBOMPTARGET_NVPTX_ENABLE_BCLIB=1, the cmake script will try to locate if the build compiler is clang and can be used for building the bc lib.

We had discussed this exact issue when upstreaming the nvptx RTL and the concesus was that we don't want to use the just-built compiler for the BC lib. If the installed compiler cannot build the BC lib, then the user must install the just-built compiler first and then use it to produce the BC lib.

That is fine. I don't think this conflicts with what you said?

The patch will allow one to do this

env CC=/bc-capibile-compiler CXX=/bc-capibile-compiler cmake .... -DLIBOMPTARGET_NVPTX_ENABLE_BCLIB=1 the_openmp_dir

i.e. without adding explicitly what compiler and linker to use for the bc file, as long as you enable the BCLIB and it can find a compiler.

If your installed compiler is happend to be bc file capibile, then with out setting CC and CXX, you will also be able to build the bc file.

The patch will allow one to do this

env CC=/bc-capibile-compiler CXX=/bc-capibile-compiler cmake .... -DLIBOMPTARGET_NVPTX_ENABLE_BCLIB=1 the_openmp_dir

That's very much already possible, please have a look at the defaults for LIBOMPTARGET_NVPTX_CUDA_COMPILER. This change will magically use a compiler which is not what the user specified. Please read the discussion end of December in D14254.

I see. I was trying to set the bc file utilities using find_pacakge(llvm...) instead of using COMPILER_ID and common it to an upper level as we search things like elf and ffi.

The intention was to keep the user interface the same as what we have now, (if not adding more). But now look back at the comments, I realized I may consider cuda compiler to be clang++, it is actually should be clang?

I see. I was trying to set the bc file utilities using find_pacakge(llvm...) instead of using COMPILER_ID and common it to an upper level as we search things like elf and ffi.

The intention was to keep the user interface the same as what we have now, (if not adding more). But now look back at the comments, I realized I may consider cuda compiler to be clang++, it is actually should be clang?

I am not sure I understand the question, but you can use clang/clang++ as a CUDA compiler.

It seems this revision does not lead anywhere, should we abandon it?

Ok, let me abandon this one and think on this again.

guansong abandoned this revision.Apr 12 2018, 2:16 PM