From 7ff227ae12a927ba9aa62f216f658c939d21785f Mon Sep 17 00:00:00 2001 From: Allison Vacanti Date: Wed, 8 Jul 2020 19:17:15 -0400 Subject: [PATCH] Make async algos require C++14, remove SFINAE context from entry points. Fixes #1224. Ref #1098 for testing/async_sort.cu NVCC version check. --- cmake/header_test.in | 1 + .../warningstester_create_uber_header.py | 1 + testing/async_copy.cu | 4 +- testing/async_for_each.cu | 4 +- testing/async_reduce.cu | 6 +-- testing/async_reduce_into.cu | 6 +-- testing/async_sort.cu | 15 ++++--- testing/async_transform.cu | 6 +-- thrust/async/copy.h | 13 +++--- thrust/async/for_each.h | 11 +++-- thrust/async/reduce.h | 41 +++++++++---------- thrust/async/sort.h | 27 ++++++------ thrust/async/transform.h | 11 +++-- thrust/detail/cpp14_required.h | 26 ++++++++++++ thrust/system/cuda/detail/async/copy.h | 11 +++-- .../system/cuda/detail/async/customization.h | 15 ++++--- thrust/system/cuda/detail/async/for_each.h | 7 ++-- thrust/system/cuda/detail/async/reduce.h | 9 ++-- thrust/system/cuda/detail/async/sort.h | 7 ++-- thrust/system/cuda/detail/async/transform.h | 7 ++-- 20 files changed, 126 insertions(+), 102 deletions(-) create mode 100644 thrust/detail/cpp14_required.h diff --git a/cmake/header_test.in b/cmake/header_test.in index c9d7104d4..08f8b7e97 100644 --- a/cmake/header_test.in +++ b/cmake/header_test.in @@ -1,3 +1,4 @@ #define THRUST_CPP11_REQUIRED_NO_ERROR +#define THRUST_CPP14_REQUIRED_NO_ERROR #define THRUST_MODERN_GCC_REQUIRED_NO_ERROR #include diff --git a/internal/build/warningstester_create_uber_header.py b/internal/build/warningstester_create_uber_header.py index 29a333063..cef19a43d 100644 --- a/internal/build/warningstester_create_uber_header.py +++ b/internal/build/warningstester_create_uber_header.py @@ -46,6 +46,7 @@ def find_headers(base_dir, rel_dir, exclude = ['\B']): print('#error no include files found\n') print('#define THRUST_CPP11_REQUIRED_NO_ERROR') +print('#define THRUST_CPP14_REQUIRED_NO_ERROR') print('#define THRUST_MODERN_GCC_REQUIRED_NO_ERROR') for h in headers: print('#include <' + h + '>') diff --git a/testing/async_copy.cu b/testing/async_copy.cu index 5e5aa7df5..b92024cc6 100644 --- a/testing/async_copy.cu +++ b/testing/async_copy.cu @@ -1,6 +1,6 @@ #include -#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC) +#if THRUST_CPP_DIALECT >= 2014 #include #include @@ -18,7 +18,7 @@ auto operator()( \ ForwardIt&& first, Sentinel&& last, OutputIt&& output \ ) const \ - THRUST_DECLTYPE_RETURNS( \ + THRUST_RETURNS( \ ::thrust::async::copy( \ __VA_ARGS__ \ THRUST_PP_COMMA_IF(THRUST_PP_ARITY(__VA_ARGS__)) \ diff --git a/testing/async_for_each.cu b/testing/async_for_each.cu index 7ed033e9e..a09adf255 100644 --- a/testing/async_for_each.cu +++ b/testing/async_for_each.cu @@ -1,6 +1,6 @@ #include -#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC) +#if THRUST_CPP_DIALECT >= 2014 #include @@ -16,7 +16,7 @@ auto operator()( \ ForwardIt&& first, Sentinel&& last, UnaryFunction&& f \ ) const \ - THRUST_DECLTYPE_RETURNS( \ + THRUST_RETURNS( \ ::thrust::async::for_each( \ __VA_ARGS__ \ THRUST_PP_COMMA_IF(THRUST_PP_ARITY(__VA_ARGS__)) \ diff --git a/testing/async_reduce.cu b/testing/async_reduce.cu index 5987fe6ae..a2bf5ccf0 100644 --- a/testing/async_reduce.cu +++ b/testing/async_reduce.cu @@ -2,7 +2,7 @@ #include -#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC) +#if THRUST_CPP_DIALECT >= 2014 #include #include @@ -48,7 +48,7 @@ struct custom_plus auto operator()( \ ForwardIt&& first, Sentinel&& last \ ) \ - THRUST_DECLTYPE_RETURNS( \ + THRUST_RETURNS( \ ::thrust::async::reduce( \ __VA_ARGS__ \ ) \ @@ -76,7 +76,7 @@ struct custom_plus auto operator()( \ ForwardIt&& first, Sentinel&& last \ ) \ - THRUST_DECLTYPE_RETURNS( \ + THRUST_RETURNS( \ ::thrust::reduce( \ __VA_ARGS__ \ ) \ diff --git a/testing/async_reduce_into.cu b/testing/async_reduce_into.cu index 0800a1a50..f99271294 100644 --- a/testing/async_reduce_into.cu +++ b/testing/async_reduce_into.cu @@ -2,7 +2,7 @@ #include -#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC) +#if THRUST_CPP_DIALECT >= 2014 #include #include @@ -49,7 +49,7 @@ struct custom_plus auto operator()( \ ForwardIt&& first, Sentinel&& last, OutputIt&& output \ ) \ - THRUST_DECLTYPE_RETURNS( \ + THRUST_RETURNS( \ ::thrust::async::reduce_into( \ __VA_ARGS__ \ ) \ @@ -77,7 +77,7 @@ struct custom_plus auto operator()( \ ForwardIt&& first, Sentinel&& last \ ) \ - THRUST_DECLTYPE_RETURNS( \ + THRUST_RETURNS( \ ::thrust::reduce( \ __VA_ARGS__ \ ) \ diff --git a/testing/async_sort.cu b/testing/async_sort.cu index c9ae1dd34..b39db3c3b 100644 --- a/testing/async_sort.cu +++ b/testing/async_sort.cu @@ -1,8 +1,13 @@ #include -// Disabled on MSVC for GH issue #1098 -#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC) && \ - THRUST_HOST_COMPILER != THRUST_HOST_COMPILER_MSVC +// Disabled on MSVC && NVCC < 11.1 for GH issue #1098. +#if (THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_MSVC) && defined(__CUDACC__) +#if (__CUDACC_VER_MAJOR__ < 11) || (__CUDACC_VER_MAJOR__ == 11 && __CUDACC_VER_MINOR__ < 1) +#define THRUST_BUG_1098_ACTIVE +#endif // NVCC version check +#endif // MSVC + NVCC check + +#if THRUST_CPP_DIALECT >= 2014 && !defined(THRUST_BUG_1098_ACTIVE) #include @@ -50,7 +55,7 @@ struct custom_greater static auto async( \ ForwardIt&& first, Sentinel&& last \ ) \ - THRUST_DECLTYPE_RETURNS( \ + THRUST_RETURNS( \ ::thrust::async::sort( \ __VA_ARGS__ \ THRUST_PP_COMMA_IF(THRUST_PP_ARITY(__VA_ARGS__)) \ @@ -91,7 +96,7 @@ DEFINE_SORT_INVOKER( static auto async( \ ForwardIt&& first, Sentinel&& last \ ) \ - THRUST_DECLTYPE_RETURNS( \ + THRUST_RETURNS( \ ::thrust::async::sort( \ __VA_ARGS__ \ THRUST_PP_COMMA_IF(THRUST_PP_ARITY(__VA_ARGS__)) \ diff --git a/testing/async_transform.cu b/testing/async_transform.cu index 328a4e563..93b38b17d 100644 --- a/testing/async_transform.cu +++ b/testing/async_transform.cu @@ -1,6 +1,6 @@ #include -#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC) +#if THRUST_CPP_DIALECT >= 2014 #include #include @@ -48,7 +48,7 @@ struct divide_by_2 ForwardIt&& first, Sentinel&& last, OutputIt&& output \ , UnaryOperation&& op \ ) \ - THRUST_DECLTYPE_RETURNS( \ + THRUST_RETURNS( \ ::thrust::async::transform( \ __VA_ARGS__ \ ) \ @@ -78,7 +78,7 @@ struct divide_by_2 ForwardIt&& first, Sentinel&& last, OutputIt&& output \ , UnaryOperation&& op \ ) \ - THRUST_DECLTYPE_RETURNS( \ + THRUST_RETURNS( \ ::thrust::transform( \ __VA_ARGS__ \ ) \ diff --git a/thrust/async/copy.h b/thrust/async/copy.h index c3d7b3bdd..a6d792d55 100644 --- a/thrust/async/copy.h +++ b/thrust/async/copy.h @@ -21,10 +21,9 @@ #pragma once #include -#include -#include +#include -#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC) +#if THRUST_CPP_DIALECT >= 2014 #include #include @@ -82,7 +81,7 @@ struct copy_fn final , OutputIt&& output ) // ADL dispatch. - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( async_copy( thrust::detail::derived_cast(thrust::detail::strip_const(from_exec)) , thrust::detail::derived_cast(thrust::detail::strip_const(to_exec)) @@ -101,7 +100,7 @@ struct copy_fn final , ForwardIt&& first, Sentinel&& last , OutputIt&& output ) - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( copy_fn::call( thrust::detail::derived_cast(thrust::detail::strip_const(exec)) // Synthesize a suitable new execution policy, because we don't want to @@ -117,7 +116,7 @@ struct copy_fn final template __host__ static auto call(ForwardIt&& first, Sentinel&& last, OutputIt&& output) - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( copy_fn::call( thrust::detail::select_system( typename thrust::iterator_system>::type{} @@ -133,7 +132,7 @@ struct copy_fn final template THRUST_NODISCARD __host__ auto operator()(Args&&... args) const - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( call(THRUST_FWD(args)...) ) }; diff --git a/thrust/async/for_each.h b/thrust/async/for_each.h index fc1814bdc..df8e14118 100644 --- a/thrust/async/for_each.h +++ b/thrust/async/for_each.h @@ -21,10 +21,9 @@ #pragma once #include -#include -#include +#include -#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC) +#if THRUST_CPP_DIALECT >= 2014 #include #include @@ -79,7 +78,7 @@ struct for_each_fn final , UnaryFunction&& f ) // ADL dispatch. - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( async_for_each( thrust::detail::derived_cast(thrust::detail::strip_const(exec)) , THRUST_FWD(first), THRUST_FWD(last) @@ -90,7 +89,7 @@ struct for_each_fn final template __host__ static auto call(ForwardIt&& first, Sentinel&& last, UnaryFunction&& f) - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( for_each_fn::call( thrust::detail::select_system( typename iterator_system>::type{} @@ -103,7 +102,7 @@ struct for_each_fn final template THRUST_NODISCARD __host__ auto operator()(Args&&... args) const - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( call(THRUST_FWD(args)...) ) }; diff --git a/thrust/async/reduce.h b/thrust/async/reduce.h index a37499584..da2b1195d 100644 --- a/thrust/async/reduce.h +++ b/thrust/async/reduce.h @@ -21,10 +21,9 @@ #pragma once #include -#include -#include +#include -#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC) +#if THRUST_CPP_DIALECT >= 2014 #include #include @@ -82,7 +81,7 @@ struct reduce_fn final , BinaryOp&& op ) // ADL dispatch. - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( async_reduce( thrust::detail::derived_cast(thrust::detail::strip_const(exec)) , THRUST_FWD(first), THRUST_FWD(last) @@ -103,7 +102,7 @@ struct reduce_fn final , thrust::true_type ) // ADL dispatch. - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( async_reduce( thrust::detail::derived_cast(thrust::detail::strip_const(exec)) , THRUST_FWD(first), THRUST_FWD(last) @@ -124,7 +123,7 @@ struct reduce_fn final , thrust::true_type ) // ADL dispatch. - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( async_reduce( thrust::detail::derived_cast(thrust::detail::strip_const(exec)) , THRUST_FWD(first), THRUST_FWD(last) @@ -143,7 +142,7 @@ struct reduce_fn final T&& init, BinaryOp&& op, thrust::false_type) - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( reduce_fn::call( thrust::detail::select_system( typename iterator_system>::type{} @@ -159,7 +158,7 @@ struct reduce_fn final static auto call3(ForwardIt&& first, Sentinel&& last, T&& init, thrust::false_type) - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( reduce_fn::call( thrust::detail::select_system( typename iterator_system>::type{} @@ -176,7 +175,7 @@ struct reduce_fn final template __host__ static auto call(T1&& t1, T2&& t2, T3&& t3) - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( reduce_fn::call3(THRUST_FWD(t1), THRUST_FWD(t2), THRUST_FWD(t3), thrust::is_execution_policy>{}) ) @@ -184,7 +183,7 @@ struct reduce_fn final template __host__ static auto call(T1&& t1, T2&& t2, T3&& t3, T4&& t4) - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( reduce_fn::call4(THRUST_FWD(t1), THRUST_FWD(t2), THRUST_FWD(t3), THRUST_FWD(t4), thrust::is_execution_policy>{}) ) @@ -192,7 +191,7 @@ struct reduce_fn final template __host__ static auto call(ForwardIt&& first, Sentinel&& last) - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( reduce_fn::call( thrust::detail::select_system( typename iterator_system>::type{} @@ -210,7 +209,7 @@ struct reduce_fn final template THRUST_NODISCARD __host__ auto operator()(Args&&... args) const - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( call(THRUST_FWD(args)...) ) }; @@ -266,7 +265,7 @@ struct reduce_into_fn final , BinaryOp&& op ) // ADL dispatch. - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( async_reduce_into( thrust::detail::derived_cast(thrust::detail::strip_const(exec)) , THRUST_FWD(first), THRUST_FWD(last) @@ -290,7 +289,7 @@ struct reduce_into_fn final , thrust::true_type ) // ADL dispatch. - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( async_reduce_into( thrust::detail::derived_cast(thrust::detail::strip_const(exec)) , THRUST_FWD(first), THRUST_FWD(last) @@ -313,7 +312,7 @@ struct reduce_into_fn final , thrust::true_type ) // ADL dispatch. - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( async_reduce_into( thrust::detail::derived_cast(thrust::detail::strip_const(exec)) , THRUST_FWD(first), THRUST_FWD(last) @@ -339,7 +338,7 @@ struct reduce_into_fn final , BinaryOp&& op , thrust::false_type ) - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( reduce_into_fn::call( thrust::detail::select_system( typename iterator_system>::type{} @@ -363,7 +362,7 @@ struct reduce_into_fn final , T&& init , thrust::false_type ) - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( reduce_into_fn::call( thrust::detail::select_system( typename iterator_system>::type{} @@ -384,7 +383,7 @@ struct reduce_into_fn final ForwardIt&& first, Sentinel&& last , OutputIt&& output ) - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( reduce_into_fn::call( thrust::detail::select_system( typename iterator_system>::type{} @@ -407,7 +406,7 @@ struct reduce_into_fn final template __host__ static auto call(T1&& t1, T2&& t2, T3&& t3, T4&& t4) - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( reduce_into_fn::call4( THRUST_FWD(t1), THRUST_FWD(t2), THRUST_FWD(t3), THRUST_FWD(t4), thrust::is_execution_policy>{}) @@ -416,7 +415,7 @@ struct reduce_into_fn final template __host__ static auto call(T1&& t1, T2&& t2, T3&& t3, T4&& t4, T5&& t5) - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( reduce_into_fn::call5( THRUST_FWD(t1), THRUST_FWD(t2), THRUST_FWD(t3), THRUST_FWD(t4), THRUST_FWD(t5), thrust::is_execution_policy>{}) @@ -425,7 +424,7 @@ struct reduce_into_fn final template THRUST_NODISCARD __host__ auto operator()(Args&&... args) const - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( call(THRUST_FWD(args)...) ) }; diff --git a/thrust/async/sort.h b/thrust/async/sort.h index 0b6a55830..c665c6467 100644 --- a/thrust/async/sort.h +++ b/thrust/async/sort.h @@ -21,10 +21,9 @@ #pragma once #include -#include -#include +#include -#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC) +#if THRUST_CPP_DIALECT >= 2014 #include #include @@ -82,7 +81,7 @@ struct stable_sort_fn final , StrictWeakOrdering&& comp ) // ADL dispatch. - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( async_stable_sort( thrust::detail::derived_cast(thrust::detail::strip_const(exec)) , THRUST_FWD(first), THRUST_FWD(last) @@ -100,7 +99,7 @@ struct stable_sort_fn final , ForwardIt&& first, Sentinel&& last ) // ADL dispatch. - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( async_stable_sort( thrust::detail::derived_cast(thrust::detail::strip_const(exec)) , THRUST_FWD(first), THRUST_FWD(last) @@ -113,7 +112,7 @@ struct stable_sort_fn final template __host__ static auto call(ForwardIt&& first, Sentinel&& last, StrictWeakOrdering&& comp) - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( stable_sort_fn::call( thrust::detail::select_system( typename iterator_system>::type{} @@ -126,7 +125,7 @@ struct stable_sort_fn final template __host__ static auto call(ForwardIt&& first, Sentinel&& last) - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( stable_sort_fn::call( THRUST_FWD(first), THRUST_FWD(last) , thrust::less< @@ -138,7 +137,7 @@ struct stable_sort_fn final template THRUST_NODISCARD __host__ auto operator()(Args&&... args) const - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( call(THRUST_FWD(args)...) ) }; @@ -187,7 +186,7 @@ struct sort_fn final , StrictWeakOrdering&& comp ) // ADL dispatch. - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( async_sort( thrust::detail::derived_cast(thrust::detail::strip_const(exec)) , THRUST_FWD(first), THRUST_FWD(last) @@ -205,7 +204,7 @@ struct sort_fn final , ForwardIt&& first, Sentinel&& last , thrust::true_type ) - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( sort_fn::call( exec , THRUST_FWD(first), THRUST_FWD(last) @@ -220,7 +219,7 @@ struct sort_fn final static auto call3(ForwardIt&& first, Sentinel&& last, StrictWeakOrdering&& comp, thrust::false_type) - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( sort_fn::call( thrust::detail::select_system( typename iterator_system>::type{} @@ -236,7 +235,7 @@ struct sort_fn final template __host__ static auto call(T1&& t1, T2&& t2, T3&& t3) - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( sort_fn::call3(THRUST_FWD(t1), THRUST_FWD(t2), THRUST_FWD(t3), thrust::is_execution_policy>{}) ) @@ -244,7 +243,7 @@ struct sort_fn final template __host__ static auto call(ForwardIt&& first, Sentinel&& last) - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( sort_fn::call( thrust::detail::select_system( typename iterator_system>::type{} @@ -259,7 +258,7 @@ struct sort_fn final template THRUST_NODISCARD __host__ auto operator()(Args&&... args) const - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( call(THRUST_FWD(args)...) ) }; diff --git a/thrust/async/transform.h b/thrust/async/transform.h index 3011a5df7..89687e93a 100644 --- a/thrust/async/transform.h +++ b/thrust/async/transform.h @@ -21,10 +21,9 @@ #pragma once #include -#include -#include +#include -#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC) +#if THRUST_CPP_DIALECT >= 2014 #include #include @@ -84,7 +83,7 @@ struct transform_fn final , UnaryOperation&& op ) // ADL dispatch. - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( async_transform( thrust::detail::derived_cast(thrust::detail::strip_const(exec)) , THRUST_FWD(first), THRUST_FWD(last) @@ -103,7 +102,7 @@ struct transform_fn final , OutputIt&& output , UnaryOperation&& op ) - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( transform_fn::call( thrust::detail::select_system( typename iterator_system>::type{} @@ -118,7 +117,7 @@ struct transform_fn final template THRUST_NODISCARD __host__ auto operator()(Args&&... args) const - THRUST_DECLTYPE_RETURNS( + THRUST_RETURNS( call(THRUST_FWD(args)...) ) }; diff --git a/thrust/detail/cpp14_required.h b/thrust/detail/cpp14_required.h new file mode 100644 index 000000000..083c8a1ad --- /dev/null +++ b/thrust/detail/cpp14_required.h @@ -0,0 +1,26 @@ +/* + * Copyright 2018 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#ifndef THRUST_CPP14_REQUIRED_NO_ERROR +# if THRUST_CPP_DIALECT < 2014 +# error C++14 is required for this Thrust feature; please upgrade your compiler or pass the appropriate -std=c++14 flag to it. +# endif +#endif + diff --git a/thrust/system/cuda/detail/async/copy.h b/thrust/system/cuda/detail/async/copy.h index a431a190d..9b317cbb5 100644 --- a/thrust/system/cuda/detail/async/copy.h +++ b/thrust/system/cuda/detail/async/copy.h @@ -30,10 +30,9 @@ #pragma once #include -#include -#include +#include -#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC) +#if THRUST_CPP_DIALECT >= 2014 #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC @@ -487,7 +486,7 @@ auto async_copy( , Sentinel last , OutputIt output ) -THRUST_DECLTYPE_RETURNS( +THRUST_RETURNS( thrust::system::cuda::detail::async_copy_n( from_exec, to_exec, first, distance(first, last), output ) @@ -505,7 +504,7 @@ auto async_copy( , Sentinel last , OutputIt output ) -THRUST_DECLTYPE_RETURNS( +THRUST_RETURNS( thrust::system::cuda::detail::async_copy_n( from_exec, to_exec, first, distance(first, last), output ) @@ -523,7 +522,7 @@ auto async_copy( , Sentinel last , OutputIt output ) -THRUST_DECLTYPE_RETURNS( +THRUST_RETURNS( thrust::system::cuda::detail::async_copy_n( from_exec, to_exec, first, distance(first, last), output ) diff --git a/thrust/system/cuda/detail/async/customization.h b/thrust/system/cuda/detail/async/customization.h index 4cabe372f..eb52c2cf0 100644 --- a/thrust/system/cuda/detail/async/customization.h +++ b/thrust/system/cuda/detail/async/customization.h @@ -30,10 +30,9 @@ #pragma once #include -#include -#include +#include -#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC) +#if THRUST_CPP_DIALECT >= 2014 #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC @@ -64,7 +63,7 @@ template auto get_async_host_allocator( thrust::detail::execution_policy_base& ) -THRUST_DECLTYPE_RETURNS( +THRUST_RETURNS( thrust::mr::stateless_resource_allocator< thrust::detail::uint8_t, default_async_host_resource >{} @@ -82,7 +81,7 @@ template auto get_async_device_allocator( thrust::detail::execution_policy_base& ) -THRUST_DECLTYPE_RETURNS( +THRUST_RETURNS( thrust::per_device_allocator< thrust::detail::uint8_t, default_async_device_resource, par_t >{} @@ -92,7 +91,7 @@ template class BaseSystem> auto get_async_device_allocator( thrust::detail::execute_with_allocator& exec ) -THRUST_DECLTYPE_RETURNS(exec.get_allocator()) +THRUST_RETURNS(exec.get_allocator()) template class BaseSystem> auto get_async_device_allocator( @@ -100,7 +99,7 @@ auto get_async_device_allocator( Allocator, BaseSystem >& exec ) -THRUST_DECLTYPE_RETURNS(exec.get_allocator()) +THRUST_RETURNS(exec.get_allocator()) /////////////////////////////////////////////////////////////////////////////// @@ -113,7 +112,7 @@ template auto get_async_universal_host_pinned_allocator( thrust::detail::execution_policy_base& ) -THRUST_DECLTYPE_RETURNS( +THRUST_RETURNS( thrust::mr::stateless_resource_allocator< thrust::detail::uint8_t, default_async_universal_host_pinned_resource >{} diff --git a/thrust/system/cuda/detail/async/for_each.h b/thrust/system/cuda/detail/async/for_each.h index 84db848c1..750b7e829 100644 --- a/thrust/system/cuda/detail/async/for_each.h +++ b/thrust/system/cuda/detail/async/for_each.h @@ -31,10 +31,9 @@ #pragma once #include -#include -#include +#include -#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC) +#if THRUST_CPP_DIALECT >= 2014 #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC @@ -144,7 +143,7 @@ auto async_for_each( Sentinel last, UnaryFunction&& func ) -THRUST_DECLTYPE_RETURNS( +THRUST_RETURNS( thrust::system::cuda::detail::async_for_each_n( policy, first, distance(first, last), THRUST_FWD(func) ) diff --git a/thrust/system/cuda/detail/async/reduce.h b/thrust/system/cuda/detail/async/reduce.h index 4a06367ee..906928b27 100644 --- a/thrust/system/cuda/detail/async/reduce.h +++ b/thrust/system/cuda/detail/async/reduce.h @@ -32,10 +32,9 @@ #pragma once #include -#include -#include +#include -#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC) +#if THRUST_CPP_DIALECT >= 2014 #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC @@ -198,7 +197,7 @@ auto async_reduce( , T init , BinaryOp op ) -THRUST_DECLTYPE_RETURNS( +THRUST_RETURNS( thrust::system::cuda::detail::async_reduce_n( policy, first, distance(first, last), init, op ) @@ -335,7 +334,7 @@ auto async_reduce_into( , T init , BinaryOp op ) -THRUST_DECLTYPE_RETURNS( +THRUST_RETURNS( thrust::system::cuda::detail::async_reduce_into_n( policy, first, distance(first, last), output, init, op ) diff --git a/thrust/system/cuda/detail/async/sort.h b/thrust/system/cuda/detail/async/sort.h index f85035ab3..3e357fde6 100644 --- a/thrust/system/cuda/detail/async/sort.h +++ b/thrust/system/cuda/detail/async/sort.h @@ -30,10 +30,9 @@ #pragma once #include -#include -#include +#include -#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC) +#if THRUST_CPP_DIALECT >= 2014 #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC @@ -505,6 +504,8 @@ auto async_stable_sort( Sentinel last, StrictWeakOrdering comp ) +// A GCC 5 bug requires an explicit trailing return type here, so stick with +// THRUST_DECLTYPE_RETURNS for now. THRUST_DECLTYPE_RETURNS( thrust::system::cuda::detail::async_stable_sort_n( policy, first, distance(first, last), comp diff --git a/thrust/system/cuda/detail/async/transform.h b/thrust/system/cuda/detail/async/transform.h index 50e147adb..544da5cb9 100644 --- a/thrust/system/cuda/detail/async/transform.h +++ b/thrust/system/cuda/detail/async/transform.h @@ -30,10 +30,9 @@ #pragma once #include -#include -#include +#include -#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC) +#if THRUST_CPP_DIALECT >= 2014 #if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_NVCC @@ -148,7 +147,7 @@ auto async_transform( OutputIt output, UnaryOperation&& op ) -THRUST_DECLTYPE_RETURNS( +THRUST_RETURNS( thrust::system::cuda::detail::async_transform_n( policy, first, distance(first, last), output, THRUST_FWD(op) )