This is an archive of the discontinued LLVM Phabricator instance.

[CUDA] Make min/max shims host+device.
ClosedPublic

Authored by jlebar on Jun 11 2018, 10:36 AM.

Details

Summary

Fixes PR37753: min/max can't be called from host device
functions in C++14 mode.

Testcase in a separate test-suite commit.

Event Timeline

jlebar created this revision.Jun 11 2018, 10:36 AM
tra added a subscriber: tra.Jun 12 2018, 11:21 AM

Last comment in the bug pointed out that those overloads should be constexpr in c++14. Maybe in a separate patch, though.

https://bugs.llvm.org/show_bug.cgi?id=37753#c5

Last comment in the bug pointed out that those overloads should be constexpr in c++14. Maybe in a separate patch, though.

Yeah, would prefer to do it in a separate patch. It's possible that having constexpr min/max in C++14 mode *without a C++14 standard library* will cause problems. (Don't mean to FUD it -- we should try. I just would like to be able to roll them back separately. :)

@rsmith friendly ping on this one.

@rsmith friendly ping on this one.

rsmith accepted this revision.Jun 29 2018, 3:15 PM

Looks right to me (other than the missing constexpr in C++14 onwards). Though this is subtle enough that I suspect the only way to know for sure is to try it.

This revision is now accepted and ready to land.Jun 29 2018, 3:15 PM

Looks right to me (other than the missing constexpr in C++14 onwards). Though this is subtle enough that I suspect the only way to know for sure is to try it.

Thanks a lot, Richard. FTR the missing constexpr is in D48151.

This revision was automatically updated to reflect the committed changes.