Skip to content
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

Correctly detect NVRTC and lack of stl support. #1073

Merged
merged 3 commits into from
May 15, 2021

Conversation

Robadob
Copy link

@Robadob Robadob commented May 13, 2021

NVRTC is Nvidia's runtime CUDA compiler. It's a pure CUDA compiler, so treats everything it sees as device code which is 'CUDA C++'. Similarly, it doesn't support system headers so Jitify is normally used, which has shims for header replacement whilst parsing the include hierarchy along with some other usability features.

When building with NVRTC (via Jitify), GLM's setup.hpp was incorrectly setting GLM_HAS_CXX11_STL to 1, I'm not sure why (compiler predefined macros), really all CUDA compilation needs this flag set to 0 as std::isnan and similar math intrisinsics in device code would normally cause compilation failure if called behind std::. This PR fixes that for NVRTC and leaves the current non-RTC CUDA behaviour unchanged by adding a new CUDA compiler flag.

This reduces compilation errors in my test case from

---------------------------------------------------
--- JIT compile log for inputdata_program ---
---------------------------------------------------
detail/setup.hpp(695): error: namespace "std" has no member "make_unsigned"

detail/func_common.inl(585): error: namespace "std" has no member "isnan"

detail/func_common.inl(624): error: namespace "std" has no member "isinf"

detail/func_common.inl(742): error: namespace "std" has no member "fma"

4 errors detected in the compilation of "inputdata_program".

to

---------------------------------------------------
--- JIT compile log for inputdata_program ---
---------------------------------------------------
detail/setup.hpp(697): error: namespace "std" has no member "make_unsigned"

1 error detected in the compilation of "inputdata_program".

I believe that final issue is one that can be fixed on Jitify's side, but I'll discuss that with them in future.

P.S. It's a shame to have lost issues since the repo was forked to g-truc, transferring the old repo to the org would have retained everything (and the old URL would be a permeant redirect to here, until a repo of same name was created in that acc).

@Robadob
Copy link
Author

Robadob commented May 14, 2021

Hmm, will look into the CI failures soon.

Didn't copy this across, good thing CI caught it.
@christophe-lunarg
Copy link

Great work, thanks for contributing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants