In file included from <built-in>:1:
In file included from h:\llvm-project-15.0.0\build\Debug\lib\clang\15.0.0\include\openmp_wrappers\__clang_openmp_device_functions.h:69:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cstdlib:9:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\yvals_core.h:400:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\vcruntime.h:58:
In file included from h:\llvm-project-15.0.0\build\Debug\lib\clang\15.0.0\include\vadefs.h:18:
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\vadefs.h:61:33: error: expected ';' after top level declarator
typedef unsigned __int64 uintptr_t;
^
In file included from <built-in>:1:
In file included from h:\llvm-project-15.0.0\build\Debug\lib\clang\15.0.0\include\openmp_wrappers\__clang_openmp_device_functions.h:69:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cstdlib:9:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\yvals_core.h:400:
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\vcruntime.h:96:1: error: a type specifier is required for all declarations
_CRT_BEGIN_C_HEADER
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\vcruntime.h:69:9: note: expanded from macro '_CRT_BEGIN_C_HEADER'
__pragma(pack(push, _CRT_PACKING)) \
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\vcruntime.h:96:1: error: use of undeclared identifier 'push'
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\vcruntime.h:69:23: note: expanded from macro '_CRT_BEGIN_C_HEADER'
__pragma(pack(push, _CRT_PACKING)) \
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\vcruntime.h:96:1: error: expected ';' after top level declarator
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\vcruntime.h:70:9: note: expanded from macro '_CRT_BEGIN_C_HEADER'
extern "C" {
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\vcruntime.h:193:29: error: expected ';' after top level declarator
typedef unsigned __int64 size_t;
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\vcruntime.h:228:22: error: 'short wchar_t' is invalid
typedef unsigned short wchar_t;
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\vcruntime.h:252:42: error: unknown type name 'size_t'
template <typename _CountofType, size_t _SizeOfArray>
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\vcruntime.h:253:33: error: unknown type name '__unaligned'
char (*__countof_helper(_UNALIGNED _CountofType (&_Array)[_SizeOfArray]))[_SizeOfArray];
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\vcruntime.h:240:24: note: expanded from macro '_UNALIGNED'
#define _UNALIGNED __unaligned
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\vcruntime.h:253:59: error: a type specifier is required for all declarations
char (*__countof_helper(_UNALIGNED _CountofType (&_Array)[_SizeOfArray]))[_SizeOfArray];
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\vcruntime.h:253:44: error: declaration of '_CountofType' shadows template parameter
char (*__countof_helper(_UNALIGNED _CountofType (&_Array)[_SizeOfArray]))[_SizeOfArray];
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\vcruntime.h:252:28: note: template parameter is declared here
template <typename _CountofType, size_t _SizeOfArray>
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\vcruntime.h:368:51: error: unknown type name 'uintptr_t'; did you mean 'intptr_t'?
void __cdecl __security_check_cookie(_In_ uintptr_t _StackCookie);
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\vcruntime.h:195:30: note: 'intptr_t' declared here
typedef __int64 intptr_t;
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\vcruntime.h:369:9: error: '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec
attributes
__declspec(noreturn) void __cdecl __report_gsfailure(_In_ uintptr_t _StackCookie);
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\vcruntime.h:369:67: error: unknown type name 'uintptr_t'; did you mean 'intptr_t'?
__declspec(noreturn) void __cdecl __report_gsfailure(_In_ uintptr_t _StackCookie);
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\vcruntime.h:195:30: note: 'intptr_t' declared here
typedef __int64 intptr_t;
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\vcruntime.h:373:8: error: unknown type name 'uintptr_t'; did you mean 'intptr_t'?
extern uintptr_t __security_cookie;
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\vcruntime.h:195:30: note: 'intptr_t' declared here
typedef __int64 intptr_t;
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\vcruntime.h:381:1: error: a type specifier is required for all declarations
_CRT_END_C_HEADER
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\vcruntime.h:74:9: note: expanded from macro '_CRT_END_C_HEADER'
__pragma(pack(pop))
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\vcruntime.h:381:1: error: use of undeclared identifier 'pop'
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\vcruntime.h:74:23: note: expanded from macro '_CRT_END_C_HEADER'
__pragma(pack(pop))
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\vcruntime.h:381:18: error: expected ';' after top level declarator
_CRT_END_C_HEADER
^
In file included from <built-in>:1:
In file included from h:\llvm-project-15.0.0\build\Debug\lib\clang\15.0.0\include\openmp_wrappers\__clang_openmp_device_functions.h:69:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cstdlib:12:
In file included from h:\llvm-project-15.0.0\build\Debug\lib\clang\15.0.0\include\openmp_wrappers\math.h:20:
In file included from h:\llvm-project-15.0.0\build\Debug\lib\clang\15.0.0\include\openmp_wrappers\cmath:21:
In file included from h:\llvm-project-15.0.0\build\Debug\lib\clang\15.0.0\include\openmp_wrappers\math.h:38:
In file included from C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\stdlib.h:14:
In file included from C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt_search.h:14:
h:\llvm-project-15.0.0\build\Debug\lib\clang\15.0.0\include\stddef.h:74:9: error: 'short wchar_t' is invalid
typedef __WCHAR_TYPE__ wchar_t;
^
<built-in>:521:33: note: expanded from here
#define __WCHAR_TYPE__ unsigned short
^
In file included from <built-in>:1:
In file included from h:\llvm-project-15.0.0\build\Debug\lib\clang\15.0.0\include\openmp_wrappers\__clang_openmp_device_functions.h:69:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cstdlib:12:
In file included from h:\llvm-project-15.0.0\build\Debug\lib\clang\15.0.0\include\openmp_wrappers\math.h:20:
In file included from h:\llvm-project-15.0.0\build\Debug\lib\clang\15.0.0\include\openmp_wrappers\cmath:21:
In file included from h:\llvm-project-15.0.0\build\Debug\lib\clang\15.0.0\include\openmp_wrappers\math.h:38:
In file included from C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\stdlib.h:14:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt_search.h:20:1: error: a type specifier is required for all declarations
_CRT_BEGIN_C_HEADER
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\vcruntime.h:69:9: note: expanded from macro '_CRT_BEGIN_C_HEADER'
__pragma(pack(push, _CRT_PACKING)) \
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
Clang and OpenMP were built with cmake version 3.22.2:
cmake DCMAKE_BUILD_TYPE=Debug -DCLANG_OPENMP_NVPTX_DEFAULT_ARCH=sm_52 -DLLVM_TARGETS_TO_BUILD="X86;NVPTX" -DLLVM_ENABLE_PROJECTS="clang;openmp" -A x64 -Thost=x64 ..\llvm
We do not support OpenMP offloading on Windows. To this end, I am not sure we ever build the toolchain with a windows clang compiler. Even if we work on the errors you see, the actual offloading will most likely not work.
FWIW, the first error is due to the MS extension type __int64 which clang doesn’t seem to recognize here. I assume there is a clang option to make it understand those.
Some later errors are consequences, e.g., that it doesn’t know size_t.
Also, --libomptarget-nvptx-bc-path should not be necessary and if so should point into the clang build/install directory, not into cuda’s.
Nowadays we recommend to build openmp as runtime not as project if you want offloading, so remove it from the project list in the cmake command and add -DLLVM_ENABLE_RUNTIMES=openmp.
All of the above will probably not fix the general inability to actually offload on windows though, or at least it is not tested.
If you want to help setup support for windows offload, let us know and we can try to come up with necessary steps
I added clang++'s option -fms-extensions - result:
In file included from <built-in>:1:
In file included from h:\llvm-project-15.0.0\build\Debug\lib\clang\15.0.0\include\openmp_wrappers\__clang_openmp_device_functions.h:69:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cstdlib:12:
In file included from h:\llvm-project-15.0.0\build\Debug\lib\clang\15.0.0\include\openmp_wrappers\math.h:20:
In file included from h:\llvm-project-15.0.0\build\Debug\lib\clang\15.0.0\include\openmp_wrappers\cmath:17:
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:37:18: error: no member
named 'acosf' in the global namespace; did you mean 'acos'?
return _CSTD acosf(_Xx);
~~~~~ ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:36:40: note: 'acos'
declared here
_NODISCARD _Check_return_ inline float acos(_In_ float _Xx) noexcept /* strengthened */ {
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:41:18: error: no member
named 'acoshf' in the global namespace; did you mean 'acosh'?
return _CSTD acoshf(_Xx);
~~~~~ ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:40:40: note: 'acosh'
declared here
_NODISCARD _Check_return_ inline float acosh(_In_ float _Xx) noexcept /* strengthened */ {
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:45:18: error: no member
named 'asinf' in the global namespace; did you mean 'asin'?
return _CSTD asinf(_Xx);
~~~~~ ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:44:40: note: 'asin'
declared here
_NODISCARD _Check_return_ inline float asin(_In_ float _Xx) noexcept /* strengthened */ {
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:49:18: error: no member
named 'asinhf' in the global namespace; did you mean 'asinh'?
return _CSTD asinhf(_Xx);
~~~~~ ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:48:40: note: 'asinh'
declared here
_NODISCARD _Check_return_ inline float asinh(_In_ float _Xx) noexcept /* strengthened */ {
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:53:18: error: no member
named 'atanf' in the global namespace; did you mean 'atan'?
return _CSTD atanf(_Xx);
~~~~~ ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:52:40: note: 'atan'
declared here
_NODISCARD _Check_return_ inline float atan(_In_ float _Xx) noexcept /* strengthened */ {
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:57:18: error: no member
named 'atanhf' in the global namespace; did you mean 'atanh'?
return _CSTD atanhf(_Xx);
~~~~~ ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:56:40: note: 'atanh'
declared here
_NODISCARD _Check_return_ inline float atanh(_In_ float _Xx) noexcept /* strengthened */ {
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:61:18: error: no member
named 'atan2f' in the global namespace; did you mean 'atan2'?
return _CSTD atan2f(_Yx, _Xx);
~~~~~ ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:60:40: note: 'atan2'
declared here
_NODISCARD _Check_return_ inline float atan2(_In_ float _Yx, _In_ float _Xx) noexcept /* strengthened */ {
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:65:18: error: no member
named 'cbrtf' in the global namespace; did you mean 'cbrt'?
return _CSTD cbrtf(_Xx);
~~~~~ ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:64:40: note: 'cbrt'
declared here
_NODISCARD _Check_return_ inline float cbrt(_In_ float _Xx) noexcept /* strengthened */ {
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:89:18: error: no member
named 'cosf' in the global namespace; did you mean 'cos'?
return _CSTD cosf(_Xx);
~~~~~ ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:88:40: note: 'cos'
declared here
_NODISCARD _Check_return_ inline float cos(_In_ float _Xx) noexcept /* strengthened */ {
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:93:18: error: no member
named 'coshf' in the global namespace; did you mean 'cosh'?
return _CSTD coshf(_Xx);
~~~~~ ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:92:40: note: 'cosh'
declared here
_NODISCARD _Check_return_ inline float cosh(_In_ float _Xx) noexcept /* strengthened */ {
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:97:18: error: no member
named 'erff' in the global namespace; did you mean 'erf'?
return _CSTD erff(_Xx);
~~~~~ ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:96:40: note: 'erf'
declared here
_NODISCARD _Check_return_ inline float erf(_In_ float _Xx) noexcept /* strengthened */ {
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:101:18: error: no member
named 'erfcf' in the global namespace; did you mean 'erfc'?
return _CSTD erfcf(_Xx);
~~~~~ ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:100:40: note: 'erfc'
declared here
_NODISCARD _Check_return_ inline float erfc(_In_ float _Xx) noexcept /* strengthened */ {
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:105:18: error: no member
named 'expf' in the global namespace; did you mean 'exp'?
return _CSTD expf(_Xx);
~~~~~ ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:104:40: note: 'exp'
declared here
_NODISCARD _Check_return_ inline float exp(_In_ float _Xx) noexcept /* strengthened */ {
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:109:18: error: no member
named 'exp2f' in the global namespace; did you mean 'exp2'?
return _CSTD exp2f(_Xx);
~~~~~ ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:108:40: note: 'exp2'
declared here
_NODISCARD _Check_return_ inline float exp2(_In_ float _Xx) noexcept /* strengthened */ {
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:113:18: error: no member
named 'expm1f' in the global namespace; did you mean 'expm1'?
return _CSTD expm1f(_Xx);
~~~~~ ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:112:40: note: 'expm1'
declared here
_NODISCARD _Check_return_ inline float expm1(_In_ float _Xx) noexcept /* strengthened */ {
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:117:18: error: no member
named 'fabsf' in the global namespace; did you mean 'fabs'?
return _CSTD fabsf(_Xx);
~~~~~ ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:116:40: note: 'fabs'
declared here
_NODISCARD _Check_return_ inline float fabs(_In_ float _Xx) noexcept /* strengthened */ {
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:121:18: error: no member
named 'fdimf' in the global namespace; did you mean 'fdim'?
return _CSTD fdimf(_Xx, _Yx);
~~~~~ ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:120:40: note: 'fdim'
declared here
_NODISCARD _Check_return_ inline float fdim(_In_ float _Xx, _In_ float _Yx) noexcept /* strengthened */ {
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:135:18: error: no member
named 'fmaf' in the global namespace; did you mean 'fma'?
return _CSTD fmaf(_Xx, _Yx, _Zx);
~~~~~ ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:134:40: note: 'fma'
declared here
_NODISCARD _Check_return_ inline float fma(_In_ float _Xx, _In_ float _Yx, _In_ float _Zx) noexcept /* strengthened */ {
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:139:18: error: no member
named 'fmaxf' in the global namespace; did you mean 'fmax'?
return _CSTD fmaxf(_Xx, _Yx);
~~~~~ ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\cmath:138:40: note: 'fmax'
declared here
_NODISCARD _Check_return_ inline float fmax(_In_ float _Xx, _In_ float _Yx) noexcept /* strengthened */ {
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
Maybe this can be fixed?
In any case, I will try to build openmp as runtime.