kokkos-kernels icon indicating copy to clipboard operation
kokkos-kernels copied to clipboard

Windows Intel OneAPI compiler build issue with pop_count()/least_set_bit()

Open hkthorn opened this issue 5 months ago • 1 comments

Xyce is encountering a compile-time error trying to build the Trilinos development branch on Windows using Intel oneAPI (Version 2022.1.0) compiler with VS2022 (version 17.4.2).

  • In KokkosKernels_BitUtils.hpp, the functions pop_count() and least_set_bit() need to include a definition that will compile with the Windows Intel OneAPI compiler. Since the MSVC definitions are compatible with the OneAPI compiler, we recommend always using the MSVC implementation on Windows. The attached patch file includes the recommended change.

kokkos_fix_intrinsics_on_windows.patch

Side Note:

Selecting the right preprocessor definitions to check for including the appropriate intrinsic function definitions was a bit confusing. There are a mix of references to native compiler flags (i.e. GNUC and IBMC) and KOKKOS_COMPILER flags (i.e. KOKKOS_COMPILER_MSVC and KOKKOS_COMPILER_IBM).

Furthermore, there are no conditional definitions for the Intel OneAPI compiler in packages\kokkos-kernels\common\src\KokkosKernels_BitUtils.hpp (no references to either KOKKOS_COMPILER_INTEL_LLVM or __INTEL_LLVM_COMPILER). The pop_count() function includes a definition if __INTEL_COMPILER is defined, but my understanding is that flag is for the Intel Classic Compiler. The OneAPI compiler uses __INTEL__LLVM_COMPILER, and is not guaranteed to set __INTEL_COMPILER.

hkthorn avatar Sep 24 '25 16:09 hkthorn

@hkthorn sorry for not checking with you earlier, we made changes in PR #2786 that hopefully resolved your issue. Let us know if that's not the case?

lucbv avatar Nov 15 '25 21:11 lucbv