Skip to content

Portable kernel build fails on Windows #12702

@GregoryComer

Description

@GregoryComer

🐛 Describe the bug

The portable kernels library fails to build on Windows with Clang. From a quick look + Google, it looks like the call to isnan fails on Windows when passed an integer. The specific failure below is from op_amax, but there are likely more.

Error:

    In file included from D:\src\executorch\kernels\portable\cpu\op_amax.cpp:9:
    In file included from D:\src\executorch\runtime\core\portable_type\c10\c10/util/irange.h:7:
    In file included from F:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\algorithm:10:
    In file included from F:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\xmemory:11:
    In file included from F:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\cstdlib:11:
    In file included from C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\math.h:11:
  C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt_math.h(419,16): error : call to 'fpclassify' is ambiguous [D:\src\executorch\pip-out\temp.win-amd64-cpython-312\cmake-out\kernels\portable\portable_kernels.vcxproj]
  D:\src\executorch\kernels\portable\cpu\op_amax.cpp(54,31): message : in instantiation of function template specialization 'isnan<unsigned char>' requested here [D:\src\executorch\pip-out\temp.win-amd64-cpython-312\cmake-out\kernels\portable\portable_kernels.vcxproj]
  D:\src\executorch\..\executorch/runtime/kernel/thread_parallel_interface.h(85,20): message : in instantiation of function template specialization 'executorch::extension::internal::parallel_for_no_threadpool<(lambda at D:\src\executorch\kernels\portable\cpu\op_amax.cpp:47:3)>' requested here [D:\src\executorch\pip-out\temp.win-amd64-cpython-312\cmake-out\kernels\portable\portable_kernels.vcxproj]
  D:\src\executorch\..\executorch/kernels/portable/cpu/util/reduce_util.h(844,33): message : in instantiation of function template specialization 'executorch::extension::parallel_for<(lambda at D:\src\executorch\kernels\portable\cpu\op_amax.cpp:47:3)>' requested here [D:\src\executorch\pip-out\temp.win-amd64-cpython-312\cmake-out\kernels\portable\portable_kernels.vcxproj]

Versions

clang version 17.0.3 (VS 2022)

cc @larryliu0820 @manuelcandales @jathu

Metadata

Metadata

Assignees

No one assigned

    Labels

    module: build/installIssues related to the cmake and buck2 builds, and to installing ExecuTorchmodule: kernelsIssues related to kernel libraries and utilities, and code under kernels/

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions