-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix <limits> on Windows. #86
Conversation
Thanks for this! Can you check if changing these two lines: https://github.com/NVIDIA/jitify/blob/788039b/jitify.hpp#L1924-L1925 According to this page, |
Changing those has no visible impact to the original bug, get the same "conversion from int to wchar_t" error. Even making them include a cast, made no difference. Suggesting they're not being pulled from there?
|
It appears |
I guess USHRT_MIN doesn't have a define as it should always be 0 for any unsigned vals. |
So this version works, however i've had to update the wrong branch of the Changing it to |
NVRTC is supposed to define But evidently it doesn't. The below version, where I manually define |
Hmm, so Did notice, that despite building with CUDA 11.2 and providing CUDA 11.2 include path, I was linking against CUDA 11.0's nvrtc.
Realised when I manually set the PATH variables for CUDA 11.2, had left in |
Thanks for digging into this. Is We can probably replace the OS-check with a |
Ok starting from the beginning, using CUDA 11.2, and NVRTC 11.2. The original version produces this error, same as the error reported in #85, except reported once rather than twice.
Your proposed fix, over changing L1924-1925 to
Replacing Unclear whether this also works with CUDA 11.0 (and my mix/match of cuda 11.0 and 11.2 was causing the predef macro to go AWOL). I'll update the PR commit and then try and test it with cuda 11.0. |
So the current version in this PR works for CUDA 11.2, but not 11.0. For some reason 11.0 does not predefine I haven't got 11.1 installed, so can't test that. |
To the best of my understanding preprocessor can't evaluate It could be easier to move the |
The second commit applies this change, and works for me with both CUDA 11.0 and 11.2 (on Windows). |
Clarity on the 11.0. Docs archive link for 11.0 docs is for 11.0.3 (has same link as 11.0 update 1). My installed 11.0 docs state nvrtc version 11.0,182, and do not include |
Using the host compiler macro looks like a good solution. I think it would be best to put this in the preinclude header here so that it fixes all usages:
(I haven't tested this on Windows myself yet; let me know if you see anything wrong with it). |
A quick test shows that works as expected, fixing my CUDA 11.0. Have reverted the previous fix and added your change instead. Let me know if you want me to squash. all the changes into a single commit/remove the two commits that cancel etc. |
A squash or rebase to remove the canceled commits would be great, thanks. Apart from that this looks good. |
Tested with VS2019, CUDA 11.0 and 11.2 Closes NVIDIA#85
Have rebased, also re-ordered the 2 commits as they're technically separate issues but one is dependent on the other. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
This adds an explicit cast to the two literal values which building with
<limits>
on windows complains about.Tested that it fixes the reported error in #85, by adding
"#include <limits>\n"
totest_simple
ofjitify_example.cpp
.Haven't tested it on Linux, where presumably
<limits>
was already working.Closes #85