Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Prevent usage of cuda::atomic::fetch_max/min for non-integral types. #282

Merged
merged 1 commit into from
Jun 2, 2022

Conversation

wmaxey
Copy link
Member

@wmaxey wmaxey commented Jun 1, 2022

I've used a static_assert instead of adding a proper inheritance layer. This should serve as a temporary stop-gap and provide meaningful output for users if they attempt to use fetch_max/min on non-integral types.

This doesn't seem to impact other units and the output is somewhat understandable.

C:/sbf/libcudacxx/include\cuda/std/atomic(111): error: static assertion failed with "fetch_max/min is available for integral types only"
          detected during:
            instantiation of "_Tp cuda::__4::atomic<_Tp, _Sco>::fetch_min(const _Tp &, cuda::__4::memory_order) volatile noexcept [with _Tp=float, _Sco=cuda::std::__4::__detail::thread_scope_system]"
C:\sbf\libcudacxx\.upstream-tests\test\cuda\atomics\atomic.ext\atomic_fetch.fail.cpp(30): here
            instantiation of "void TestFn<T, Selector, <unnamed>>::operator()() const [with T=float, Selector=local_memory_selector, <unnamed>=cuda::std::__4::__detail::thread_scope_thread]"
C:\sbf\libcudacxx\.upstream-tests\test\cuda\atomics\atomic.ext\atomic_fetch.fail.cpp(53): here

@wmaxey wmaxey added this to the 1.9.0 milestone Jun 1, 2022
@wmaxey wmaxey requested review from griwes and jrhemstad June 1, 2022 22:11
@wmaxey wmaxey self-assigned this Jun 1, 2022
@wmaxey wmaxey merged commit b6908c6 into main Jun 2, 2022
@wmaxey wmaxey deleted the bugfix/disable_fp_cuda_atomic_fetch branch June 2, 2022 23:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants