NVIDIA/jitify

#include <limits> fails on Windows

Robadob opened this issue · 0 comments

Visual Studio 2019
CUDA 11.2

Adding #include <limits> to any RTC kernel causes a compilation error at runtime.

---------------------------------------------------
--- JIT compile log for my_program ---
---------------------------------------------------
limits(124): error: invalid narrowing conversion from "int" to "wchar_t": constant value does not fit in destination type

limits(124): error: invalid narrowing conversion from "int" to "wchar_t": constant value does not fit in destination type

2 errors detected in the compilation of "my_program".

---------------------------------------------------

Appears to be unhappy about this line:

jitify/jitify.hpp

Line 1628 in 5f8f0a1

__jitify_detail::IntegerLimits<wchar_t, WCHAR_MIN, WCHAR_MAX> {};

Update: Based on further debugging in #86. There are two issues at play.

  1. Jitify defines WCHAR_MIN/WCHAR_MAX as signed short rather than unsigned on windows.
  2. CUDA versions prior to 11.0.x do not predefine _WIN64 during NVRTC compilation. (So these CUDA versions use the Linux defines of WCHAR_MIN/WCHAR_MAX)