Skip to content

[BUG]: IPO isn't detected properly with IntelLLVM #4080

Description

@mablanchard

Required prerequisites

Problem description

Running CMake find_package(pybind11) on Windows + Intel new ICX compiler (a.k.a. IntelLLVM) gives:

-- Performing Test HAS_INTEL_IPO
-- Performing Test HAS_INTEL_IPO - Failed

From the CMakeError.log file:

clang-cl: warning: unknown argument ignored in clang-cl '-ipo'; did you mean '-Qipo'? [-Wunknown-argument]

Indeed, pybind11Common.cmake doesn't seem to handle the ICX compiler correctly and misinterpret its CMAKE_CXX_COMPILER_ID (being IntelLLVM for new ICX) for the Intel Classic compiler (being Intel for old ICC/ICL).

I believe the ICX compiler expects -ipo on UNIX but -Qipo on WIN32.

Reproducible example code

cmake_minimum_required(
VERSION 3.23.0)
set(CMAKE_C_COMPILER "icx")
set(CMAKE_CXX_COMPILER "icx")
enable_language(C CXX)
project(CMake-IntelLLVM-WIN32)
find_package(pybind11 CONFIG)
add_executable(cmake-intelllvm-win32 main.cpp)

Ran like:

cmake -G Ninja -B build\ -Dpybind11_ROOT:PATH=[...] .

Gives:

-- The C compiler identification is IntelLLVM 2022.1.0 with MSVC-like command-line
-- The CXX compiler identification is IntelLLVM 2022.1.0 with MSVC-like command-line
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/icx.exe - 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: C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/icx.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: C:/apps/Python310/python.exe (found version "3.10.4")
-- Found PythonLibs: C:/apps/Python310/libs/python310.lib
-- Performing Test HAS_INTEL_IPO
-- Performing Test HAS_INTEL_IPO - Failed
-- Found pybind11: D:/... (found version "2.9.2")
-- Configuring done
-- Generating done
-- Build files have been written to: D:/...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions