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

Patch compiler error when building using nvcc #1370

Merged
merged 1 commit into from
Oct 22, 2019
Merged

Conversation

kent-tri
Copy link
Contributor

@kent-tri kent-tri commented Oct 21, 2019

If you compile using nvcc and pass the option --expt-relaxed-constexpr it will crash with an internal compiler error. This modification prevents using constexpr in fmtlib when compiling using nvcc and prevents the crash.

To clarify, this seems to be necessary on CUDA 10 with gcc(5->7) as the host compiler (every gcc version I tested). I did not have the chance to validate if other CUDA versions suffer from this same issue.

I agree that my contributions are licensed under the {fmt} license, and agree to future changes to the licensing.

@@ -58,10 +58,12 @@
// Check if relaxed C++14 constexpr is supported.
// GCC doesn't allow throw in constexpr until version 6 (bug 67371).
#ifndef FMT_USE_CONSTEXPR
#if !(defined(__NVCC__) || defined(__CUDACC__))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary to check both __NVCC__ and __CUDACC__? Can one be set and another not?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not necessary as __CUDACC__ can be considered a subset of __NVCC__. I'll remove the __CUDACC__ check: https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#nvcc-identification-macro

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

If you compile using `nvcc` and pass the option `--expt-relaxed-constexpr` it will crash with an internal compiler error. This modification prevents using `constexpr` in `fmtlib` when compiling using `nvcc` and prevents the crash.
@vitaut
Copy link
Contributor

vitaut commented Oct 22, 2019

Thanks!

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.

3 participants