meson icon indicating copy to clipboard operation
meson copied to clipboard

Add compiler detection for Intel oneAPI DPC++/C++ Compiler.

Open vinsonlee opened this issue 3 years ago • 8 comments
trafficstars

Reported-by: Marcus Seyfarth [email protected] Suggested-by: Harry van Haaren [email protected] Tested-by: Vinson Lee [email protected] Tested-by: Marcus Seyfarth [email protected] Signed-off-by: Vinson Lee [email protected]

vinsonlee avatar Jan 20 '22 06:01 vinsonlee

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 67.80%. Comparing base (acef5a9) to head (d436118). Report is 2744 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9850      +/-   ##
==========================================
- Coverage   67.80%   67.80%   -0.01%     
==========================================
  Files         400      400              
  Lines       85522    85522              
  Branches    18825    18825              
==========================================
- Hits        57987    57986       -1     
- Misses      23035    23036       +1     
  Partials     4500     4500              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jan 20 '22 06:01 codecov[bot]

Just a note that this PR is the output of the longer discussion on issue https://github.com/mesonbuild/meson/issues/8113, and the code-change workings is described in https://github.com/mesonbuild/meson/issues/8113#issuecomment-961945940.

Merging this PR will enable Meson to correctly detect and use the OneAPI compiler.

harry-van-haaren avatar Jan 20 '22 09:01 harry-van-haaren

As this is new functionality it should have a release note snippet.

jpakkane avatar Jan 21 '22 23:01 jpakkane

Isn't this going to result in using th eIntel compiler with an Id as clang? Even if it uses clang under the hood, there are still some differences right, enough to justify having at least a unique name like "oneAPI" or "Intel DPC" or something (just not intel or intel-cl)?

dcbaker avatar Jan 21 '22 23:01 dcbaker

I think a new ID is called for (CMake gives it IntelLLVM, but oneapi or intel-oneapi is probably fine). As a concrete use case, the Intel OneAPI compiler has some…interesting decisions around some flag defaults that projects probably want to be able to detect it specifically (of note, -fp-model=precise is needed to remove -ffast-math-like behaviors on -O1 and above).

mathstuf avatar Feb 17 '22 16:02 mathstuf

That's... interesting. And means that the implementation in Meson needs to override the optimization levels as well, so that we add -fp-mode=precise to the arguments by default

dcbaker avatar Feb 17 '22 18:02 dcbaker

I think a new ID is called for (CMake gives it IntelLLVM,

This is what gh-10909 does. So that probably supercedes this PR.

rgommers avatar Oct 09 '22 16:10 rgommers

It adds a new class, but doesn't override anything such as the ID.

It is the right approach, just not all the way there. :)

eli-schwartz avatar Oct 09 '22 16:10 eli-schwartz

Just noting that this hasn't been touched in 2 years, and it'd be really nice to have!

aaronsuydam avatar Sep 17 '24 15:09 aaronsuydam

@aaronsuydam #10909 implements this, and has been landed for almost 2 years. The only think I see here that we don't have upstream is the note about the -fp-model=precise. Since the intention of this is already upstream, I'm going to close this.

dcbaker avatar Sep 17 '24 15:09 dcbaker

@dcbaker ah ok great. There's nothing in the web docs about this having been implemented (that I saw), what's the meson.build option I need to use? Haven't been able to get it to work.

aaronsuydam avatar Sep 18 '24 13:09 aaronsuydam

@aaronsuydam there isn't a meson.build option. It is supporting a new compiler and compilers are defined in the toolchain ("machine") file or inferred by setting the environment variables CC and CXX.

The meson docs include a reference table listing supported compilers alongside the ID return values for checking inside meson.build "which compiler is this build directory + toolchain configured to use".

intel-llvm --> Intel oneAPI LLVM-based compiler

It's also mentioned in the release notes for meson 0.64.0

eli-schwartz avatar Sep 18 '24 14:09 eli-schwartz