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

Async sort algorithm test doesn't compile with MSVC #1098

Closed
alliepiper opened this issue Apr 8, 2020 · 9 comments
Closed

Async sort algorithm test doesn't compile with MSVC #1098

alliepiper opened this issue Apr 8, 2020 · 9 comments
Assignees
Milestone

Comments

@alliepiper
Copy link
Collaborator

This looks to be a bug in cudafe, similar to nvbug 2732194:

../testing/async_sort.cu(148): error #871: template instantiation resulted in unexpected function type of 
  "thrust::event<thrust::cuda_cub::tag> (thrust::execution_policy<thrust::cuda_cub::tag> &,
                                         thrust::detail::normal_iterator<thrust::device_ptr<char>> &&,
                                         thrust::detail::normal_iterator<thrust::device_ptr<char>> &&, 
                                         thrust::less<char> &&)" 
    (the meaning of a name may have changed since the template declaration -- the type of the template is 
      "thrust::event<DerivedPolicy> (thrust::execution_policy<DerivedPolicy> &, 
                                     ForwardIt &&, 
                                     Sentinel &&, 
                                     StrictWeakOrdering &&)"
    )
          detected during:
            instantiation of "thrust::async::fallback::async_sort" based on template arguments <thrust::cuda_cub::tag, thrust::detail::normal_iterator<thrust::device_ptr<char>>, thrust::detail::normal_iterator<thrust::device_ptr<char>>, thrust::less<char>> 
(148): here
            instantiation of "void test_async_sort<SortInvoker, WaitPolicy>::tester<T>::operator()(size_t) [with SortInvoker=sort_invoker, WaitPolicy=wait_for_futures, T=char]" 
../testing\unittest/meta.h(104): here
            instantiation of "void unittest::for_each_type<TypeList, Function, T, i>::operator()(U) [with TypeList=NumericTypes, Function=test_async_sort<sort_invoker, wait_for_futures>::tester, T=char, i=0U, U=size_t]" 
../testing\unittest/testframework.h(534): here
            instantiation of "void VariableUnitTest<TestName, TypeList>::run() [with TestName=test_async_sort<sort_invoker, wait_for_futures>::tester, TypeList=NumericTypes]" 

This is triaged by disabling the async copy algorithm + test on MSVC, but needs further investigation.

alliepiper added a commit to alliepiper/thrust that referenced this issue Apr 8, 2020
- MSVC isn't a fan of `decltype(...)::some_member` syntax.
  - WAR by aliasing the `decltype(...)` and doing `NewAlias::some_member`
- Missing `template` keyword when rebinding pointer in `async/reduce.h`
- Silence warning C4494 `declspec(allocator) used on non-pointer/ref type`
  - Bug in MSVC STL: microsoft/STL#696
- Disable async sort algo + test on MSVC
  - Triage. Looks like a bug in cudafe? See NVIDIA#1098.
- Add pointer<T>::pointer_to(reference)
  - Required for C++11, hard compile error on MSVC.
alliepiper added a commit to alliepiper/thrust that referenced this issue Apr 8, 2020
- MSVC isn't a fan of `decltype(...)::some_member` syntax.
  - WAR by aliasing the `decltype(...)` and doing `NewAlias::some_member`
- Missing `template` keyword when rebinding pointer in `async/reduce.h`
- Silence warning C4494 `declspec(allocator) used on non-pointer/ref type`
  - Bug in MSVC STL: microsoft/STL#696
- Disable async sort algo + test on MSVC
  - Triage. Looks like a bug in cudafe? See NVIDIA#1098.
- Add pointer<T>::pointer_to(reference)
  - Required for C++11, hard compile error on MSVC.
- Bring a definition of `atanh` into scope for complex number impl
- Fix floating point literals be declared as floats instead of doubles
- Fix `_Pragma` check for MSVC (MSVC uses `__pragma`)
- Replace `std::remove_reference<T>::type&` with
  `std::add_lvalue_reference`.
  - Same behavior, and MSVC chokes on the other syntax when followed by
    `__host__`.
- Remove constexpr markup from defaulted functions.
  - These are constexpr by default when possible, and the compilers were
    complaining about the markup in places.

Other misc changes made for MSVC testing:

- Bump C++ standard to C++14 (prepare for deprecation)
- Add `-Xcudafe --display_error_number` to get useful diagnositics from
    cudafe.
alliepiper added a commit to alliepiper/thrust that referenced this issue Apr 8, 2020
- Clean up cub include dir spec in CMake.
- Move THRUST_DEPRECATED logic out of compiler.h and into new header.
- Fix CPP dialect detection on newer MSVC.
- Remove raw `__cplusplus` checks from source code.
- Move the namespace macros/docs out of version.h.
- Remove raw `__cplusplus` checks.
- Use `_Pragma` instead of `#pragma` in macro.
- Remove THRUST_BEGIN/END_NS macros.
  - These were used inconsistently, rendering them non-functional. Removing
    to prevent people from trying to use them.

Workarounds for msvc 2015.

- MSVC isn't a fan of `decltype(...)::some_member` syntax.
  - WAR by aliasing the `decltype(...)` and doing `NewAlias::some_member`
- Missing `template` keyword when rebinding pointer in `async/reduce.h`
- Silence warning C4494 `declspec(allocator) used on non-pointer/ref type`
  - Bug in MSVC STL: microsoft/STL#696
- Disable async sort algo + test on MSVC
  - Triage. Looks like a bug in cudafe? See NVIDIA#1098.
- Add pointer<T>::pointer_to(reference)
  - Required for C++11, hard compile error on MSVC.
- Bring a definition of `atanh` into scope for complex number impl
- Fix floating point literals be declared as floats instead of doubles
- Fix `_Pragma` check for MSVC (MSVC uses `__pragma`)
- Replace `std::remove_reference<T>::type&` with
  `std::add_lvalue_reference`.
  - Same behavior, and MSVC chokes on the other syntax when followed by
    `__host__`.
- Remove constexpr markup from defaulted functions.
  - These are constexpr by default when possible, and the compilers were
    complaining about the markup in places.

Other misc changes made for MSVC testing:

- Bump C++ standard to C++14 (prepare for deprecation)
- Add `-Xcudafe --display_error_number` to get useful diagnositics from
    cudafe.
alliepiper added a commit to alliepiper/thrust that referenced this issue Apr 9, 2020
Build infrastructure and static configuration fixes:

- Bump CMAKE_CXX_STANDARD to 14
- Add `-Werror all-warnings` to NVCC to promote warnings to errors
- Add `-Xcudafe --display_error_number` to get useful diagnositics from
    cudafe.
- Clean up cub include dir spec in CMake.
- Move THRUST_DEPRECATED logic out of compiler.h and into new header.
- Fix CPP dialect detection on newer MSVC.
- Remove raw `__cplusplus` checks from source code.
- Move the namespace macros/docs out of version.h.
- Remove raw `__cplusplus` checks.
- Use `_Pragma` instead of `#pragma` in macro.
- Remove THRUST_BEGIN/END_NS macros.
  - These were used inconsistently, rendering them non-functional. Removing
    to prevent people from trying to use them.

Workarounds for msvc 2015:

- MSVC isn't a fan of `decltype(...)::some_member` syntax.
  - WAR by aliasing the `decltype(...)` and doing `NewAlias::some_member`
- Missing `template` keyword when rebinding pointer in `async/reduce.h`
- Silence warning C4494 `declspec(allocator) used on non-pointer/ref type`
  - Bug in MSVC STL: microsoft/STL#696
- Disable async sort algo + test on MSVC
  - Triage. Looks like a bug in cudafe? See NVIDIA#1098.
- Add pointer<T>::pointer_to(reference)
  - Required for C++11, hard compile error on MSVC.
- Bring a definition of `atanh` into scope for complex number impl
- Fix floating point literals be declared as floats instead of doubles
- Fix `_Pragma` check for MSVC (MSVC uses `__pragma`)
- Replace `std::remove_reference<T>::type&` with
  `std::add_lvalue_reference`.
  - Same behavior, and MSVC chokes on the other syntax when followed by
    `__host__`.
- Remove constexpr markup from defaulted functions.
  - These are constexpr by default when possible, and the compilers were
    complaining about the markup in places.
alliepiper added a commit to alliepiper/thrust that referenced this issue Apr 9, 2020
Build infrastructure and static configuration fixes:

- Bump CMAKE_CXX_STANDARD to 14
- Add `-Werror all-warnings` to NVCC to promote warnings to errors
- Add `-Xcudafe --display_error_number` to get useful diagnositics from
    cudafe.
- Clean up cub include dir spec in CMake.
- Move THRUST_DEPRECATED logic out of compiler.h and into new header.
- Fix CPP dialect detection on newer MSVC.
- Remove raw `__cplusplus` checks from source code.
- Move the namespace macros/docs out of version.h.
- Remove raw `__cplusplus` checks.
- Use `_Pragma` instead of `#pragma` in macro.
- Remove THRUST_BEGIN/END_NS macros.
  - These were used inconsistently, rendering them non-functional. Removing
    to prevent people from trying to use them.

Workarounds for msvc 2015:

- MSVC isn't a fan of `decltype(...)::some_member` syntax.
  - WAR by aliasing the `decltype(...)` and doing `NewAlias::some_member`
- Missing `template` keyword when rebinding pointer in `async/reduce.h`
- Silence warning C4494 `declspec(allocator) used on non-pointer/ref type`
  - Bug in MSVC STL: microsoft/STL#696
- Disable async sort algo + test on MSVC
  - Triage. Looks like a bug in cudafe? See NVIDIA#1098.
- Add pointer<T>::pointer_to(reference)
  - Required for C++11, hard compile error on MSVC.
- Bring a definition of `atanh` into scope for complex number impl
- Fix floating point literals be declared as floats instead of doubles
- Fix `_Pragma` check for MSVC (MSVC uses `__pragma`)
- Replace `std::remove_reference<T>::type&` with
  `std::add_lvalue_reference`.
  - Same behavior, and MSVC chokes on the other syntax when followed by
    `__host__`.
- Remove constexpr markup from defaulted functions.
  - These are constexpr by default when possible, and the compilers were
    complaining about the markup in places.

Bug 2865172
Bug 2880936
alliepiper added a commit to alliepiper/thrust that referenced this issue Apr 9, 2020
Build infrastructure and static configuration fixes:

- Bump CMAKE_CXX_STANDARD to 14
- Add `-Werror all-warnings` to NVCC to promote warnings to errors
- Add `-Xcudafe --display_error_number` to get useful diagnositics from
    cudafe.
- Clean up cub include dir spec in CMake.
- Move THRUST_DEPRECATED logic out of compiler.h and into new header.
- Fix CPP dialect detection on newer MSVC.
- Remove raw `__cplusplus` checks.
- Use `_Pragma`/`__pragma` instead of `#pragma` in macro.
- Remove THRUST_BEGIN/END_NS macros.
  - These were used inconsistently, rendering them non-functional. Removing
    to prevent people from trying to use them.

Workarounds for msvc 2015:

- MSVC isn't a fan of `decltype(...)::some_member` syntax.
  - WAR by aliasing the `decltype(...)` and doing `NewAlias::some_member`
- Missing `template` keyword when rebinding pointer in `async/reduce.h`
- Silence warning C4494 `declspec(allocator) used on non-pointer/ref type`
  - Bug in MSVC STL: microsoft/STL#696
- Disable async sort test on MSVC
  - Triage. Looks like a bug in cudafe? See NVIDIA#1098.
- Add pointer<T>::pointer_to(reference)
  - Required for C++11, hard compile error on MSVC.
- Bring a definition of `atanh` into scope for complex number impl
- Fix floating point literals be declared as floats instead of doubles
- Replace `std::remove_reference<T>::type&` with
  `std::add_lvalue_reference`.
  - Same behavior, and MSVC chokes on the other syntax when followed by
    `__host__`.
- Remove constexpr markup from defaulted functions.
  - These are constexpr by default when possible, and the compilers were
    complaining about the markup in places.
- Use `thrust::detail::integer_traits` instead of `std::numeric_limits`
  in device code.

Bug 2865172
Bug 2880936
alliepiper added a commit to alliepiper/thrust that referenced this issue Apr 11, 2020
Build infrastructure and static configuration fixes:

- Bump CMAKE_CXX_STANDARD to 14
- Add `-Werror all-warnings` to NVCC to promote warnings to errors
- Add `-Xcudafe --display_error_number` to get useful diagnositics from
    cudafe.
- Clean up cub include dir spec in CMake.
- Move THRUST_DEPRECATED logic out of compiler.h and into new header.
- Fix CPP dialect detection on newer MSVC.
- Remove raw `__cplusplus` checks.
- Use `_Pragma`/`__pragma` instead of `#pragma` in macro.
- Remove THRUST_BEGIN/END_NS macros.
  - These were used inconsistently, rendering them non-functional. Removing
    to prevent people from trying to use them.

Workarounds for msvc:

- MSVC isn't a fan of `decltype(...)::some_member` syntax.
  - WAR by aliasing the `decltype(...)` and doing `NewAlias::some_member`
- Missing `template` keyword when rebinding pointer in `async/reduce.h`
- Silence warning C4494 `declspec(allocator) used on non-pointer/ref type`
  - Bug in MSVC STL: microsoft/STL#696
- Disable async sort test on MSVC
  - Triage. Looks like a bug in cudafe? See NVIDIA#1098.
- Add pointer<T>::pointer_to(reference)
  - Required for C++11, hard compile error on MSVC.
- Bring a definition of `atanh` into scope for complex number impl
- Fix floating point literals be declared as floats instead of doubles
- Replace `std::remove_reference<T>::type&` with
  `std::add_lvalue_reference`.
  - Same behavior, and MSVC chokes on the other syntax when followed by
    `__host__`.
- Remove constexpr markup from defaulted functions.
  - These are constexpr by default when possible, and the compilers were
    complaining about the markup in places.
- Use `thrust::detail::integer_traits` instead of `std::numeric_limits`
  in device code.
- Avoid aligning beyond platform limits in alignment.cu.
- Pass /bigobj to MSVC so it can handle the async tests
- Work around MSVC compiler bug by replacing SFINAE with static dispatch

Bug 2865172
Bug 2880936
alliepiper added a commit to alliepiper/thrust that referenced this issue Apr 11, 2020
Build infrastructure and static configuration fixes:

- Bump CMAKE_CXX_STANDARD to 14
- Add `-Werror all-warnings` to NVCC to promote warnings to errors
- Add `-Xcudafe --display_error_number` to get useful diagnositics from
    cudafe.
- Clean up cub include dir spec in CMake.
- Move THRUST_DEPRECATED logic out of compiler.h and into new header.
- Fix CPP dialect detection on newer MSVC.
- Remove raw `__cplusplus` checks.
- Use `_Pragma`/`__pragma` instead of `#pragma` in macro.
- Remove THRUST_BEGIN/END_NS macros.
  - These were used inconsistently, rendering them non-functional. Removing
    to prevent people from trying to use them.

Workarounds for msvc:

- MSVC isn't a fan of `decltype(...)::some_member` syntax.
  - WAR by aliasing the `decltype(...)` and doing `NewAlias::some_member`
- Missing `template` keyword when rebinding pointer in `async/reduce.h`
- Silence warning C4494 `declspec(allocator) used on non-pointer/ref type`
  - Bug in MSVC STL: microsoft/STL#696
- Disable async sort test on MSVC
  - Triage. Looks like a bug in cudafe? See NVIDIA#1098.
- Add pointer<T>::pointer_to(reference)
  - Required for C++11, hard compile error on MSVC.
- Bring a definition of `atanh` into scope for complex number impl
- Fix floating point literals be declared as floats instead of doubles
- Replace `std::remove_reference<T>::type&` with
  `std::add_lvalue_reference`.
  - Same behavior, and MSVC chokes on the other syntax when followed by
    `__host__`.
- Remove constexpr markup from defaulted functions.
  - These are constexpr by default when possible, and the compilers were
    complaining about the markup in places.
- Use `thrust::detail::integer_traits` instead of `std::numeric_limits`
  in device code.
- Avoid aligning beyond platform limits in alignment.cu.
- Pass /bigobj to MSVC so it can handle the async tests
- Work around MSVC compiler bug by replacing SFINAE with static dispatch

Bug 2865172
Bug 2880936
alliepiper added a commit to alliepiper/thrust that referenced this issue Apr 13, 2020
Build infrastructure and static configuration fixes:

- Bump CMAKE_CXX_STANDARD to 14
- Add `-Werror all-warnings` to NVCC to promote warnings to errors
- Add `-Xcudafe --display_error_number` to get useful diagnositics from
    cudafe.
- Clean up cub include dir spec in CMake.
- Move THRUST_DEPRECATED logic out of compiler.h and into new header.
- Fix CPP dialect detection on newer MSVC.
- Remove raw `__cplusplus` checks.
- Use `_Pragma`/`__pragma` instead of `#pragma` in macro.
- Remove THRUST_BEGIN/END_NS macros.
  - These were used inconsistently, rendering them non-functional. Removing
    to prevent people from trying to use them.

Workarounds for msvc:

- MSVC isn't a fan of `decltype(...)::some_member` syntax.
  - WAR by aliasing the `decltype(...)` and doing `NewAlias::some_member`
- Missing `template` keyword when rebinding pointer in `async/reduce.h`
- Silence warning C4494 `declspec(allocator) used on non-pointer/ref type`
  - Bug in MSVC STL: microsoft/STL#696
- Disable async sort test on MSVC
  - Triage. Looks like a bug in cudafe? See NVIDIA#1098.
- Add pointer<T>::pointer_to(reference)
  - Required for C++11, hard compile error on MSVC.
- Bring a definition of `atanh` into scope for complex number impl
- Fix floating point literals be declared as floats instead of doubles
- Replace `std::remove_reference<T>::type&` with
  `std::add_lvalue_reference`.
  - Same behavior, and MSVC chokes on the other syntax when followed by
    `__host__`.
- Remove constexpr markup from defaulted functions.
  - These are constexpr by default when possible, and the compilers were
    complaining about the markup in places.
- Use `thrust::detail::integer_traits` instead of `std::numeric_limits`
  in device code.
- Avoid aligning beyond platform limits in alignment.cu.
- Pass /bigobj to MSVC so it can handle the async tests
- Work around MSVC compiler bug by replacing SFINAE with static dispatch

Bug 2865172
Bug 2880936
alliepiper added a commit to alliepiper/thrust that referenced this issue Apr 13, 2020
Build infrastructure and static configuration fixes:

- Bump CMAKE_CXX_STANDARD to 14
- Add `-Werror all-warnings` to NVCC to promote warnings to errors
- Add `-Xcudafe --display_error_number` to get useful diagnositics from
    cudafe.
- Clean up cub include dir spec in CMake.
- Move THRUST_DEPRECATED logic out of compiler.h and into new header.
- Fix CPP dialect detection on newer MSVC.
- Remove raw `__cplusplus` checks.
- Use `_Pragma`/`__pragma` instead of `#pragma` in macro.
- Remove THRUST_BEGIN/END_NS macros.
  - These were used inconsistently, rendering them non-functional. Removing
    to prevent people from trying to use them.

Workarounds for msvc:

- MSVC isn't a fan of `decltype(...)::some_member` syntax.
  - WAR by aliasing the `decltype(...)` and doing `NewAlias::some_member`
- Missing `template` keyword when rebinding pointer in `async/reduce.h`
- Silence warning C4494 `declspec(allocator) used on non-pointer/ref type`
  - Bug in MSVC STL: microsoft/STL#696
- Disable async sort test on MSVC
  - Triage. Looks like a bug in cudafe? See NVIDIA#1098.
- Add pointer<T>::pointer_to(reference)
  - Required for C++11, hard compile error on MSVC.
- Bring a definition of `atanh` into scope for complex number impl
- Fix floating point literals be declared as floats instead of doubles
- Replace `std::remove_reference<T>::type&` with
  `std::add_lvalue_reference`.
  - Same behavior, and MSVC chokes on the other syntax when followed by
    `__host__`.
- Remove constexpr markup from defaulted functions.
  - These are constexpr by default when possible, and the compilers were
    complaining about the markup in places.
- Use `thrust::detail::integer_traits` instead of `std::numeric_limits`
  in device code.
- Avoid aligning beyond platform limits in alignment.cu.
- Pass /bigobj to MSVC so it can handle the async tests
- Work around MSVC compiler bug by replacing SFINAE with static dispatch

Bug 2865172
Bug 2880936
alliepiper added a commit to alliepiper/thrust that referenced this issue Apr 15, 2020
Build infrastructure and static configuration fixes:

- Bump CMAKE_CXX_STANDARD to 14
- Add `-Werror all-warnings` to NVCC to promote warnings to errors
- Add `-Xcudafe --display_error_number` to get useful diagnositics from
    cudafe.
- Clean up cub include dir spec in CMake.
- Move THRUST_DEPRECATED logic out of compiler.h and into new header.
- Fix CPP dialect detection on newer MSVC.
- Remove raw `__cplusplus` checks.
- Use `_Pragma`/`__pragma` instead of `#pragma` in macro.
- Remove THRUST_BEGIN/END_NS macros.
  - These were used inconsistently, rendering them non-functional. Removing
    to prevent people from trying to use them.

Workarounds for msvc:

- MSVC isn't a fan of `decltype(...)::some_member` syntax.
  - WAR by aliasing the `decltype(...)` and doing `NewAlias::some_member`
- Missing `template` keyword when rebinding pointer in `async/reduce.h`
- Silence warning C4494 `declspec(allocator) used on non-pointer/ref type`
  - Bug in MSVC STL: microsoft/STL#696
- Disable async sort test on MSVC
  - Triage. Looks like a bug in cudafe? See NVIDIA#1098.
- Add pointer<T>::pointer_to(reference)
  - Required for C++11, hard compile error on MSVC.
- Bring a definition of `atanh` into scope for complex number impl
- Fix floating point literals be declared as floats instead of doubles
- Replace `std::remove_reference<T>::type&` with
  `std::add_lvalue_reference`.
  - Same behavior, and MSVC chokes on the other syntax when followed by
    `__host__`.
- Remove constexpr markup from defaulted functions.
  - These are constexpr by default when possible, and the compilers were
    complaining about the markup in places.
- Use `thrust::detail::integer_traits` instead of `std::numeric_limits`
  in device code.
- Avoid aligning beyond platform limits in alignment.cu.
- Pass /bigobj to MSVC so it can handle the async tests
- Work around MSVC compiler bug by replacing SFINAE with static dispatch

Bug 2865172
Bug 2880936
alliepiper added a commit to alliepiper/thrust that referenced this issue Apr 15, 2020
Build infrastructure and static configuration fixes:

- Bump CMAKE_CXX_STANDARD to 14
- Add `-Werror all-warnings` to NVCC to promote warnings to errors
- Add `-Xcudafe --display_error_number` to get useful diagnositics from
    cudafe.
- Clean up cub include dir spec in CMake.
- Move THRUST_DEPRECATED logic out of compiler.h and into new header.
- Fix CPP dialect detection on newer MSVC.
- Remove raw `__cplusplus` checks.
- Use `_Pragma`/`__pragma` instead of `#pragma` in macro.
- Remove THRUST_BEGIN/END_NS macros.
  - These were used inconsistently, rendering them non-functional. Removing
    to prevent people from trying to use them.

Workarounds for msvc:

- MSVC isn't a fan of `decltype(...)::some_member` syntax.
  - WAR by aliasing the `decltype(...)` and doing `NewAlias::some_member`
- Missing `template` keyword when rebinding pointer in `async/reduce.h`
- Silence warning C4494 `declspec(allocator) used on non-pointer/ref type`
  - Bug in MSVC STL: microsoft/STL#696
- Disable async sort test on MSVC
  - Triage. Looks like a bug in cudafe? See NVIDIA#1098.
- Add pointer<T>::pointer_to(reference)
  - Required for C++11, hard compile error on MSVC.
- Bring a definition of `atanh` into scope for complex number impl
- Fix floating point literals be declared as floats instead of doubles
- Replace `std::remove_reference<T>::type&` with
  `std::add_lvalue_reference`.
  - Same behavior, and MSVC chokes on the other syntax when followed by
    `__host__`.
- Remove constexpr markup from defaulted functions.
  - These are constexpr by default when possible, and the compilers were
    complaining about the markup in places.
- Use `thrust::detail::integer_traits` instead of `std::numeric_limits`
  in device code.
- Avoid aligning beyond platform limits in alignment.cu.
- Pass /bigobj to MSVC so it can handle the async tests
- Work around MSVC compiler bug by replacing SFINAE with static dispatch

Bug 2865172
Bug 2880936
alliepiper added a commit to alliepiper/thrust that referenced this issue Apr 17, 2020
Build infrastructure and static configuration fixes:

- Bump CMAKE_CXX_STANDARD to 14
- Add `-Werror all-warnings` to NVCC to promote warnings to errors
- Add `-Xcudafe --display_error_number` to get useful diagnositics from
    cudafe.
- Clean up cub include dir spec in CMake.
- Move THRUST_DEPRECATED logic out of compiler.h and into new header.
- Fix CPP dialect detection on newer MSVC.
- Remove raw `__cplusplus` checks.
- Use `_Pragma`/`__pragma` instead of `#pragma` in macro.
- Remove THRUST_BEGIN/END_NS macros.
  - These were used inconsistently, rendering them non-functional. Removing
    to prevent people from trying to use them.

Workarounds for msvc:

- MSVC isn't a fan of `decltype(...)::some_member` syntax.
  - WAR by aliasing the `decltype(...)` and doing `NewAlias::some_member`
- Missing `template` keyword when rebinding pointer in `async/reduce.h`
- Silence warning C4494 `declspec(allocator) used on non-pointer/ref type`
  - Bug in MSVC STL: microsoft/STL#696
- Disable async sort test on MSVC
  - Triage. Looks like a bug in cudafe? See NVIDIA#1098.
- Add pointer<T>::pointer_to(reference)
  - Required for C++11, hard compile error on MSVC.
- Bring a definition of `atanh` into scope for complex number impl
- Fix floating point literals be declared as floats instead of doubles
- Replace `std::remove_reference<T>::type&` with
  `std::add_lvalue_reference`.
  - Same behavior, and MSVC chokes on the other syntax when followed by
    `__host__`.
- Remove constexpr markup from defaulted functions.
  - These are constexpr by default when possible, and the compilers were
    complaining about the markup in places.
- Use `thrust::detail::integer_traits` instead of `std::numeric_limits`
  in device code.
- Avoid aligning beyond platform limits in alignment.cu.
- Pass /bigobj to MSVC so it can handle the async tests
- Work around MSVC compiler bug by replacing SFINAE with static dispatch

Bug 2865172
Bug 2880936
alliepiper added a commit to alliepiper/thrust that referenced this issue Apr 17, 2020
Build infrastructure and static configuration fixes:

- Bump CMAKE_CXX_STANDARD to 14
- Add `-Werror all-warnings` to NVCC to promote warnings to errors
- Add `-Xcudafe --display_error_number` to get useful diagnositics from
    cudafe.
- Clean up cub include dir spec in CMake.
- Move THRUST_DEPRECATED logic out of compiler.h and into new header.
- Fix CPP dialect detection on newer MSVC.
- Remove raw `__cplusplus` checks.
- Use `_Pragma`/`__pragma` instead of `#pragma` in macro.
- Remove THRUST_BEGIN/END_NS macros.
  - These were used inconsistently, rendering them non-functional. Removing
    to prevent people from trying to use them.

Workarounds for msvc:

- MSVC isn't a fan of `decltype(...)::some_member` syntax.
  - WAR by aliasing the `decltype(...)` and doing `NewAlias::some_member`
- Missing `template` keyword when rebinding pointer in `async/reduce.h`
- Silence warning C4494 `declspec(allocator) used on non-pointer/ref type`
  - Bug in MSVC STL: microsoft/STL#696
- Disable async sort test on MSVC
  - Triage. Looks like a bug in cudafe? See NVIDIA#1098.
- Add pointer<T>::pointer_to(reference)
  - Required for C++11, hard compile error on MSVC.
- Bring a definition of `atanh` into scope for complex number impl
- Fix floating point literals be declared as floats instead of doubles
- Replace `std::remove_reference<T>::type&` with
  `std::add_lvalue_reference`.
  - Same behavior, and MSVC chokes on the other syntax when followed by
    `__host__`.
- Remove constexpr markup from defaulted functions.
  - These are constexpr by default when possible, and the compilers were
    complaining about the markup in places.
- Use `thrust::detail::integer_traits` instead of `std::numeric_limits`
  in device code.
- Avoid aligning beyond platform limits in alignment.cu.
- Pass /bigobj to MSVC so it can handle the async tests
- Work around MSVC compiler bug by replacing SFINAE with static dispatch

Bug 2865172
Bug 2880936
alliepiper added a commit to alliepiper/thrust that referenced this issue Apr 17, 2020
Build infrastructure and static configuration fixes:

- Bump CMAKE_CXX_STANDARD to 14
- Add `-Werror all-warnings` to NVCC to promote warnings to errors
- Add `-Xcudafe --display_error_number` to get useful diagnositics from
    cudafe.
- Clean up cub include dir spec in CMake.
- Move THRUST_DEPRECATED logic out of compiler.h and into new header.
- Fix CPP dialect detection on newer MSVC.
- Remove raw `__cplusplus` checks.
- Use `_Pragma`/`__pragma` instead of `#pragma` in macro.
- Remove THRUST_BEGIN/END_NS macros.
  - These were used inconsistently, rendering them non-functional. Removing
    to prevent people from trying to use them.

Workarounds for msvc:

- MSVC isn't a fan of `decltype(...)::some_member` syntax.
  - WAR by aliasing the `decltype(...)` and doing `NewAlias::some_member`
- Missing `template` keyword when rebinding pointer in `async/reduce.h`
- Silence warning C4494 `declspec(allocator) used on non-pointer/ref type`
  - Bug in MSVC STL: microsoft/STL#696
- Disable async sort test on MSVC
  - Triage. Looks like a bug in cudafe? See NVIDIA#1098.
- Add pointer<T>::pointer_to(reference)
  - Required for C++11, hard compile error on MSVC.
- Bring a definition of `atanh` into scope for complex number impl
- Fix floating point literals be declared as floats instead of doubles
- Replace `std::remove_reference<T>::type&` with
  `std::add_lvalue_reference`.
  - Same behavior, and MSVC chokes on the other syntax when followed by
    `__host__`.
- Remove constexpr markup from defaulted functions.
  - These are constexpr by default when possible, and the compilers were
    complaining about the markup in places.
- Use `thrust::detail::integer_traits` instead of `std::numeric_limits`
  in device code.
- Avoid aligning beyond platform limits in alignment.cu.
- Pass /bigobj to MSVC so it can handle the async tests
- Work around MSVC compiler bug by replacing SFINAE with static dispatch

Bug 2865172
Bug 2880936
alliepiper added a commit to alliepiper/thrust that referenced this issue Apr 17, 2020
Build infrastructure and static configuration fixes:

- Bump CMAKE_CXX_STANDARD to 14
- Add `-Werror all-warnings` to NVCC to promote warnings to errors
- Add `-Xcudafe --display_error_number` to get useful diagnositics from
    cudafe.
- Clean up cub include dir spec in CMake.
- Move THRUST_DEPRECATED logic out of compiler.h and into new header.
- Fix CPP dialect detection on newer MSVC.
- Remove raw `__cplusplus` checks.
- Use `_Pragma`/`__pragma` instead of `#pragma` in macro.
- Remove THRUST_BEGIN/END_NS macros.
  - These were used inconsistently, rendering them non-functional. Removing
    to prevent people from trying to use them.

Workarounds for msvc:

- MSVC isn't a fan of `decltype(...)::some_member` syntax.
  - WAR by aliasing the `decltype(...)` and doing `NewAlias::some_member`
- Missing `template` keyword when rebinding pointer in `async/reduce.h`
- Silence warning C4494 `declspec(allocator) used on non-pointer/ref type`
  - Bug in MSVC STL: microsoft/STL#696
- Disable async sort test on MSVC
  - Triage. Looks like a bug in cudafe? See NVIDIA#1098.
- Add pointer<T>::pointer_to(reference)
  - Required for C++11, hard compile error on MSVC.
- Bring a definition of `atanh` into scope for complex number impl
- Fix floating point literals be declared as floats instead of doubles
- Replace `std::remove_reference<T>::type&` with
  `std::add_lvalue_reference`.
  - Same behavior, and MSVC chokes on the other syntax when followed by
    `__host__`.
- Remove constexpr markup from defaulted functions.
  - These are constexpr by default when possible, and the compilers were
    complaining about the markup in places.
- Use `thrust::detail::integer_traits` instead of `std::numeric_limits`
  in device code.
- Avoid aligning beyond platform limits in alignment.cu.
- Pass /bigobj to MSVC so it can handle the async tests
- Work around MSVC compiler bug by replacing SFINAE with static dispatch

Bug 2865172
Bug 2880936
@RAMitchell
Copy link
Contributor

I am having similar issues with async reduction when attempting to migrate our xgboost codebase to new asynchronous APIs. Any compile failures on MSVC will be problematic for us as we will be stuck with performance regressions from old synchronous functions.

alliepiper added a commit to alliepiper/thrust that referenced this issue Apr 18, 2020
Build infrastructure and static configuration fixes:

- Bump CMAKE_CXX_STANDARD to 14
- Add `-Werror all-warnings` to NVCC to promote warnings to errors
- Add `-Xcudafe --display_error_number` to get useful diagnositics from
    cudafe.
- Clean up cub include dir spec in CMake.
- Move THRUST_DEPRECATED logic out of compiler.h and into new header.
- Fix CPP dialect detection on newer MSVC.
- Remove raw `__cplusplus` checks.
- Use `_Pragma`/`__pragma` instead of `#pragma` in macro.
- Remove THRUST_BEGIN/END_NS macros.
  - These were used inconsistently, rendering them non-functional. Removing
    to prevent people from trying to use them.

Workarounds for msvc:

- MSVC isn't a fan of `decltype(...)::some_member` syntax.
  - WAR by aliasing the `decltype(...)` and doing `NewAlias::some_member`
- Missing `template` keyword when rebinding pointer in `async/reduce.h`
- Silence warning C4494 `declspec(allocator) used on non-pointer/ref type`
  - Bug in MSVC STL: microsoft/STL#696
- Disable async sort test on MSVC
  - Triage. Looks like a bug in cudafe? See NVIDIA#1098.
- Add pointer<T>::pointer_to(reference)
  - Required for C++11, hard compile error on MSVC.
- Bring a definition of `atanh` into scope for complex number impl
- Fix floating point literals be declared as floats instead of doubles
- Replace `std::remove_reference<T>::type&` with
  `std::add_lvalue_reference`.
  - Same behavior, and MSVC chokes on the other syntax when followed by
    `__host__`.
- Remove constexpr markup from defaulted functions.
  - These are constexpr by default when possible, and the compilers were
    complaining about the markup in places.
- Use `thrust::detail::integer_traits` instead of `std::numeric_limits`
  in device code.
- Avoid aligning beyond platform limits in alignment.cu.
- Pass /bigobj to MSVC so it can handle the async tests
- Work around MSVC compiler bug by replacing SFINAE with static dispatch

Bug 2865172
Bug 2880936
@alliepiper
Copy link
Collaborator Author

@RAMitchell Are you seeing the template instantiation resulted in unexpected function type of ... error in the async reduce algorithm? If you have a small example that reproduces it, I'll take a look.

As a heads up, the async algorithms haven't gotten a ton of testing on MSVC. We're working on improving CI to shake out bugs, but those algorithms on that compiler might be flakey for a little while.

@RAMitchell
Copy link
Contributor

RAMitchell commented Apr 19, 2020

If I compile this

#include <thrust/async/reduce.h>
#include <thrust/device_vector.h>

int main()
{
  int n = 5;
  thrust::device_vector<int> x(n, 1);
  auto result = thrust::async::reduce(x.begin(), x.end());
}

Adding the following as a compile argument to convince thrust that c++11 exists:
-Xcompiler "/Zc:__cplusplus"

I get the following:

1>------ Build started: Project: thrust_async, Configuration: Debug x64 ------
1>Compiling CUDA source file kernel.cu...
1>
1>C:\Users\Rory\source\repos\thrust_async\thrust_async>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin\nvcc.exe" -gencode=arch=compute_30,code=\"sm_30,compute_30\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64" -x cu  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include"  -G   --keep-dir x64\Debug -maxrregcount=0  --machine 64 --compile -cudart static -Xcompiler "/Zc:__cplusplus" -g   -DWIN32 -DWIN64 -D_DEBUG -D_CONSOLE -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /Fdx64\Debug\vc141.pdb /FS /Zi /RTC1 /MDd " -o x64\Debug\kernel.cu.obj "C:\Users\Rory\source\repos\thrust_async\thrust_async\kernel.cu"
1>C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include\thrust/detail/execute_with_dependencies.h(193): warning : __declspec attributes ignored
1>
1>C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include\thrust/detail/execute_with_dependencies.h(193): warning : __declspec attributes ignored
1>
1>C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include\thrust/system/cuda/detail/async/reduce.h(77): error : template parameter "thrust::detail::allocator_traits<Alloc>::rebind_traits [with Alloc=const auto]" may not have a template argument list
1>
1>1 error detected in the compilation of "C:/Users/Rory/AppData/Local/Temp/tmpxft_00004884_00000000-5_kernel.cpp4.ii".
1>kernel.cu
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\BuildCustomizations\CUDA 10.2.targets(764,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin\nvcc.exe" -gencode=arch=compute_30,code=\"sm_30,compute_30\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64" -x cu  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include"  -G   --keep-dir x64\Debug -maxrregcount=0  --machine 64 --compile -cudart static -Xcompiler "/Zc:__cplusplus" -g   -DWIN32 -DWIN64 -D_DEBUG -D_CONSOLE -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /Fdx64\Debug\vc141.pdb /FS /Zi /RTC1 /MDd " -o x64\Debug\kernel.cu.obj "C:\Users\Rory\source\repos\thrust_async\thrust_async\kernel.cu"" exited with code 2.
1>Done building project "thrust_async.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

This is a problem for us, I have to migrate the entire xgboost code base off thrust onto cub until synchronisation issues are resolved. See dmlc/xgboost#5560.

@alliepiper
Copy link
Collaborator Author

Ah, gotcha, that's a different bug than the one in this github issue. That compile error (and many other issues on MSVC) are fixed in #1089 and thrust/cub#21, which I hope to have merged soon. If you get a chance to try those out, let me know if you find any other issues.

@alliepiper
Copy link
Collaborator Author

alliepiper commented Apr 19, 2020

Also, -Xcompiler "/Zc:__cplusplus" is no longer necessary on that branch. We will properly detect the C++ standard now on supported versions of MSVC.

alliepiper added a commit to alliepiper/thrust that referenced this issue Apr 20, 2020
Build infrastructure and static configuration fixes:

- Bump CMAKE_CXX_STANDARD to 14
- Add `-Werror all-warnings` to NVCC to promote warnings to errors
- Add `-Xcudafe --display_error_number` to get useful diagnositics from
    cudafe.
- Clean up cub include dir spec in CMake.
- Move THRUST_DEPRECATED logic out of compiler.h and into new header.
- Fix CPP dialect detection on newer MSVC.
- Remove raw `__cplusplus` checks.
- Use `_Pragma`/`__pragma` instead of `#pragma` in macro.
- Remove THRUST_BEGIN/END_NS macros.
  - These were used inconsistently, rendering them non-functional. Removing
    to prevent people from trying to use them.

Workarounds for msvc:

- MSVC isn't a fan of `decltype(...)::some_member` syntax.
  - WAR by aliasing the `decltype(...)` and doing `NewAlias::some_member`
- Missing `template` keyword when rebinding pointer in `async/reduce.h`
- Silence warning C4494 `declspec(allocator) used on non-pointer/ref type`
  - Bug in MSVC STL: microsoft/STL#696
- Disable async sort test on MSVC
  - Triage. Looks like a bug in cudafe? See NVIDIA#1098.
- Add pointer<T>::pointer_to(reference)
  - Required for C++11, hard compile error on MSVC.
- Bring a definition of `atanh` into scope for complex number impl
- Fix floating point literals be declared as floats instead of doubles
- Replace `std::remove_reference<T>::type&` with
  `std::add_lvalue_reference`.
  - Same behavior, and MSVC chokes on the other syntax when followed by
    `__host__`.
- Remove constexpr markup from defaulted functions.
  - These are constexpr by default when possible, and the compilers were
    complaining about the markup in places.
- Use `thrust::detail::integer_traits` instead of `std::numeric_limits`
  in device code.
- Avoid aligning beyond platform limits in alignment.cu.
- Pass /bigobj to MSVC so it can handle the async tests
- Work around MSVC compiler bug by replacing SFINAE with static dispatch

Bug 2865172
Bug 2880936

Reviewed-by:  Bryce Adelstein Lelbach aka wash <[email protected]>
Reviewed-by: Michał 'Griwes' Dominiak <[email protected]>
alliepiper added a commit to alliepiper/thrust that referenced this issue Apr 20, 2020
Build infrastructure and static configuration fixes:

- Bump CMAKE_CXX_STANDARD to 14
- Add `-Werror all-warnings` to NVCC to promote warnings to errors
- Add `-Xcudafe --display_error_number` to get useful diagnositics from
    cudafe.
- Clean up cub include dir spec in CMake.
- Move THRUST_DEPRECATED logic out of compiler.h and into new header.
- Fix CPP dialect detection on newer MSVC.
- Remove raw `__cplusplus` checks.
- Use `_Pragma`/`__pragma` instead of `#pragma` in macro.
- Remove THRUST_BEGIN/END_NS macros.
  - These were used inconsistently, rendering them non-functional. Removing
    to prevent people from trying to use them.

Workarounds for msvc:

- MSVC isn't a fan of `decltype(...)::some_member` syntax.
  - WAR by aliasing the `decltype(...)` and doing `NewAlias::some_member`
- Missing `template` keyword when rebinding pointer in `async/reduce.h`
- Silence warning C4494 `declspec(allocator) used on non-pointer/ref type`
  - Bug in MSVC STL: microsoft/STL#696
- Disable async sort test on MSVC
  - Triage. Looks like a bug in cudafe? See NVIDIA#1098.
- Add pointer<T>::pointer_to(reference)
  - Required for C++11, hard compile error on MSVC.
- Bring a definition of `atanh` into scope for complex number impl
- Fix floating point literals be declared as floats instead of doubles
- Replace `std::remove_reference<T>::type&` with
  `std::add_lvalue_reference`.
  - Same behavior, and MSVC chokes on the other syntax when followed by
    `__host__`.
- Remove constexpr markup from defaulted functions.
  - These are constexpr by default when possible, and the compilers were
    complaining about the markup in places.
- Use `thrust::detail::integer_traits` instead of `std::numeric_limits`
  in device code.
- Avoid aligning beyond platform limits in alignment.cu.
- Pass /bigobj to MSVC so it can handle the async tests
- Work around MSVC compiler bug by replacing SFINAE with static dispatch

Bug 2865172
Bug 2880936

Reviewed-by:  Bryce Adelstein Lelbach aka wash <[email protected]>
Reviewed-by: Michał 'Griwes' Dominiak <[email protected]>
alliepiper added a commit that referenced this issue Apr 20, 2020
Build infrastructure and static configuration fixes:

- Bump CMAKE_CXX_STANDARD to 14
- Add `-Werror all-warnings` to NVCC to promote warnings to errors
- Add `-Xcudafe --display_error_number` to get useful diagnositics from
    cudafe.
- Clean up cub include dir spec in CMake.
- Move THRUST_DEPRECATED logic out of compiler.h and into new header.
- Fix CPP dialect detection on newer MSVC.
- Remove raw `__cplusplus` checks.
- Use `_Pragma`/`__pragma` instead of `#pragma` in macro.
- Remove THRUST_BEGIN/END_NS macros.
  - These were used inconsistently, rendering them non-functional. Removing
    to prevent people from trying to use them.

Workarounds for msvc:

- MSVC isn't a fan of `decltype(...)::some_member` syntax.
  - WAR by aliasing the `decltype(...)` and doing `NewAlias::some_member`
- Missing `template` keyword when rebinding pointer in `async/reduce.h`
- Silence warning C4494 `declspec(allocator) used on non-pointer/ref type`
  - Bug in MSVC STL: microsoft/STL#696
- Disable async sort test on MSVC
  - Triage. Looks like a bug in cudafe? See #1098.
- Add pointer<T>::pointer_to(reference)
  - Required for C++11, hard compile error on MSVC.
- Bring a definition of `atanh` into scope for complex number impl
- Fix floating point literals be declared as floats instead of doubles
- Replace `std::remove_reference<T>::type&` with
  `std::add_lvalue_reference`.
  - Same behavior, and MSVC chokes on the other syntax when followed by
    `__host__`.
- Remove constexpr markup from defaulted functions.
  - These are constexpr by default when possible, and the compilers were
    complaining about the markup in places.
- Use `thrust::detail::integer_traits` instead of `std::numeric_limits`
  in device code.
- Avoid aligning beyond platform limits in alignment.cu.
- Pass /bigobj to MSVC so it can handle the async tests
- Work around MSVC compiler bug by replacing SFINAE with static dispatch

Bug 2865172
Bug 2880936

Reviewed-by:  Bryce Adelstein Lelbach aka wash <[email protected]>
Reviewed-by: Michał 'Griwes' Dominiak <[email protected]>
@alliepiper
Copy link
Collaborator Author

The issue in the description can be reproduced with the following minimal reducer on:

  • MSVC 2017 x64
  • CUDA 10.2
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.21
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community>cd \Users\Allie\src\repro-thrust-1098

C:\Users\allie\src\repro-thrust-1098>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin\nvcc.exe" -c repro.cu
repro.cu
repro.cu(83): error: template instantiation resulted in unexpected function type of "thrust::event<thrust::cuda::par_t> (thrust::cuda::par_t)" (the meaning of a name may have changed since the template declaration -- the type of the template is "thrust::event<T> (T)")
          detected during instantiation of "thrust::fallback::async_sort" based on template argument <thrust::cuda::par_t>
(83): here

repro.cu(83): error: no instance of function template "thrust::sort_detail::sort_fn::call" matches the argument list
            argument types are: (const thrust::cuda::par_t)

2 errors detected in the compilation of "C:/Users/allie/AppData/Local/Temp/tmpxft_00005444_00000000-10_repro.cpp1.ii".

repro.cu:

#include <utility> // for declval

namespace thrust
{

template <typename DerivedPolicy>
struct execution_policy {};

namespace cuda
{

template <class Derived>
struct execution_policy : thrust::execution_policy<Derived> {};

struct par_t : execution_policy<par_t> {};

static constexpr par_t par;

struct unique_eager_event {};

} // namespace cuda

// Unimplemented, only used in decltype contexts
template <typename DerivedPolicy>
thrust::cuda::unique_eager_event
unique_eager_event_type(thrust::cuda::execution_policy<DerivedPolicy> const&) noexcept;

namespace unimplemented
{

struct no_unique_eager_event_type_found {};

inline __host__
no_unique_eager_event_type_found
unique_eager_event_type(...) noexcept;

} // namespace unimplemented

namespace unique_eager_event_type_detail
{

using unimplemented::unique_eager_event_type;

template <typename System>
using select = decltype(unique_eager_event_type(std::declval<System>()));

} // namespace unique_eager_event_type_detail

template <typename System>
using unique_eager_event = unique_eager_event_type_detail::select<System>;

template <typename System>
using event = unique_eager_event<System>;

namespace fallback
{

template <typename T>
thrust::event<T> async_sort(T val) { return {}; }

} // namespace fallback

namespace sort_detail
{

using fallback::async_sort;

struct sort_fn final
{
  template <typename T>
  static auto call(T exec) -> decltype(async_sort(exec))
  {
    return async_sort(exec);
  }
};

} // namespace sort_detail

} // end namespace thrust

void foo()
{
  thrust::sort_detail::sort_fn::call(thrust::cuda::par);
}

@alliepiper
Copy link
Collaborator Author

Filed an internal bug against nvcc: nvbug id 2947213

@alliepiper alliepiper added this to the 1.10.0 milestone Jul 10, 2020
@alliepiper
Copy link
Collaborator Author

Just confirmed that this will be fixed in a future version of NVCC.

Need to update the guard at the top of async_sort.cu to only disable the test on nvcc && nvcc < (tentatively) 11.1.

alliepiper added a commit to alliepiper/thrust that referenced this issue Jul 29, 2020
alliepiper added a commit to alliepiper/thrust that referenced this issue Jul 30, 2020
alliepiper added a commit that referenced this issue Aug 3, 2020
Fixes #1224.
Ref #1098 for testing/async_sort.cu NVCC version check.
@alliepiper
Copy link
Collaborator Author

#1225 re-enables this test on MSVC when nvcc > 11.0 detected.

neon60 pushed a commit to ROCm/rocThrust that referenced this issue Nov 20, 2020
Build infrastructure and static configuration fixes:

- Bump CMAKE_CXX_STANDARD to 14
- Add `-Werror all-warnings` to NVCC to promote warnings to errors
- Add `-Xcudafe --display_error_number` to get useful diagnositics from
    cudafe.
- Clean up cub include dir spec in CMake.
- Move THRUST_DEPRECATED logic out of compiler.h and into new header.
- Fix CPP dialect detection on newer MSVC.
- Remove raw `__cplusplus` checks.
- Use `_Pragma`/`__pragma` instead of `#pragma` in macro.
- Remove THRUST_BEGIN/END_NS macros.
  - These were used inconsistently, rendering them non-functional. Removing
    to prevent people from trying to use them.

Workarounds for msvc:

- MSVC isn't a fan of `decltype(...)::some_member` syntax.
  - WAR by aliasing the `decltype(...)` and doing `NewAlias::some_member`
- Missing `template` keyword when rebinding pointer in `async/reduce.h`
- Silence warning C4494 `declspec(allocator) used on non-pointer/ref type`
  - Bug in MSVC STL: microsoft/STL#696
- Disable async sort test on MSVC
  - Triage. Looks like a bug in cudafe? See NVIDIA/thrust#1098.
- Add pointer<T>::pointer_to(reference)
  - Required for C++11, hard compile error on MSVC.
- Bring a definition of `atanh` into scope for complex number impl
- Fix floating point literals be declared as floats instead of doubles
- Replace `std::remove_reference<T>::type&` with
  `std::add_lvalue_reference`.
  - Same behavior, and MSVC chokes on the other syntax when followed by
    `__host__`.
- Remove constexpr markup from defaulted functions.
  - These are constexpr by default when possible, and the compilers were
    complaining about the markup in places.
- Use `thrust::detail::integer_traits` instead of `std::numeric_limits`
  in device code.
- Avoid aligning beyond platform limits in alignment.cu.
- Pass /bigobj to MSVC so it can handle the async tests
- Work around MSVC compiler bug by replacing SFINAE with static dispatch

Bug 2865172
Bug 2880936

Reviewed-by:  Bryce Adelstein Lelbach aka wash <[email protected]>
Reviewed-by: Michał 'Griwes' Dominiak <[email protected]>
neon60 pushed a commit to ROCm/rocThrust that referenced this issue Nov 20, 2020
Build infrastructure and static configuration fixes:

- Bump CMAKE_CXX_STANDARD to 14
- Add `-Werror all-warnings` to NVCC to promote warnings to errors
- Add `-Xcudafe --display_error_number` to get useful diagnositics from
    cudafe.
- Clean up cub include dir spec in CMake.
- Move THRUST_DEPRECATED logic out of compiler.h and into new header.
- Fix CPP dialect detection on newer MSVC.
- Remove raw `__cplusplus` checks.
- Use `_Pragma`/`__pragma` instead of `#pragma` in macro.
- Remove THRUST_BEGIN/END_NS macros.
  - These were used inconsistently, rendering them non-functional. Removing
    to prevent people from trying to use them.

Workarounds for msvc:

- MSVC isn't a fan of `decltype(...)::some_member` syntax.
  - WAR by aliasing the `decltype(...)` and doing `NewAlias::some_member`
- Missing `template` keyword when rebinding pointer in `async/reduce.h`
- Silence warning C4494 `declspec(allocator) used on non-pointer/ref type`
  - Bug in MSVC STL: microsoft/STL#696
- Disable async sort test on MSVC
  - Triage. Looks like a bug in cudafe? See NVIDIA/thrust#1098.
- Add pointer<T>::pointer_to(reference)
  - Required for C++11, hard compile error on MSVC.
- Bring a definition of `atanh` into scope for complex number impl
- Fix floating point literals be declared as floats instead of doubles
- Replace `std::remove_reference<T>::type&` with
  `std::add_lvalue_reference`.
  - Same behavior, and MSVC chokes on the other syntax when followed by
    `__host__`.
- Remove constexpr markup from defaulted functions.
  - These are constexpr by default when possible, and the compilers were
    complaining about the markup in places.
- Use `thrust::detail::integer_traits` instead of `std::numeric_limits`
  in device code.
- Avoid aligning beyond platform limits in alignment.cu.
- Pass /bigobj to MSVC so it can handle the async tests
- Work around MSVC compiler bug by replacing SFINAE with static dispatch

Bug 2865172
Bug 2880936

Reviewed-by:  Bryce Adelstein Lelbach aka wash <[email protected]>
Reviewed-by: Michał 'Griwes' Dominiak <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants