Skip to content

Fix <cmath> intrinsics for CUDA#1886

Merged
StephanTLavavej merged 2 commits intomicrosoft:mainfrom
StephanTLavavej:fix_intrinsics
Apr 30, 2021
Merged

Fix <cmath> intrinsics for CUDA#1886
StephanTLavavej merged 2 commits intomicrosoft:mainfrom
StephanTLavavej:fix_intrinsics

Conversation

@StephanTLavavej
Copy link
Member

Fixes #1885.

This simply selects the classic CRT implementation when __CUDACC__ is defined. I'm centralizing this in _HAS_CMATH_INTRINSICS (which is a pattern we've started using elsewhere), which makes the diff look more complicated, but the code is ultimately simpler (and easier to modify in the future if we need to).

@StephanTLavavej StephanTLavavej added bug Something isn't working high priority Important! labels Apr 29, 2021
@StephanTLavavej StephanTLavavej requested a review from a team as a code owner April 29, 2021 10:13
@sylveon
Copy link
Contributor

sylveon commented Apr 29, 2021

The Intel compiler seems to have broken too, recommend adding a check for it as well: https://community.intel.com/t5/Intel-C-Compiler/error-LNK2019-unresolved-external-symbol-floorf-referenced-in/td-p/1267096

Copy link
Contributor

@CaseyCarter CaseyCarter left a comment

Choose a reason for hiding this comment

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

Oops - I made a single comment rather than starting another review.

Intel's C++ compilers also don't grok these intrinsics; the LLVM-based compilers define `__clang__`, but the "classic" compiler does not.
Copy link
Contributor

@CaseyCarter CaseyCarter left a comment

Choose a reason for hiding this comment

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

I applied my suggestion, which I don't see being controversial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working high priority Important!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

<cmath>: New intrinsics broke CUDA

5 participants