Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat 565 remove redundant thrust dialect conditional #566

Merged
merged 34 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
73b4d3b
Remove redundant conditional
ZelboK Oct 14, 2023
071855d
remove redundant conditional
ZelboK Oct 14, 2023
8c1bf79
clean up
ZelboK Oct 14, 2023
865fe91
Update thrust/thrust/type_traits/is_trivially_relocatable.h
ZelboK Oct 16, 2023
320628e
Update thrust/thrust/zip_function.h
ZelboK Oct 16, 2023
23ed74c
Merge branch 'main' into feat-565-remove-thrust-conditional
ZelboK Oct 16, 2023
ea143a1
Merge branch 'feat-565-remove-thrust-conditional' of github.com:Zelbo…
ZelboK Oct 16, 2023
79ad206
Address comments
ZelboK Oct 16, 2023
00653b8
newline
ZelboK Oct 16, 2023
433d355
merge main
ZelboK Oct 22, 2023
f076bf4
remove all useless dialect conditionals, remove alignof macro and it'…
ZelboK Oct 22, 2023
a2dfe09
remove cache
ZelboK Oct 22, 2023
e5b86b0
remove useless folder
ZelboK Oct 22, 2023
c1dc79a
undo unintended changes
ZelboK Oct 22, 2023
0e7b039
undo changes in docs
ZelboK Oct 22, 2023
764ed89
remove comments
ZelboK Oct 22, 2023
72e107b
Update thrust/testing/zip_function.cu
ZelboK Oct 22, 2023
e67c6d7
Update thrust/thrust/mr/allocator.h
ZelboK Oct 22, 2023
190f990
Update thrust/thrust/detail/allocator_aware_execution_policy.h
ZelboK Oct 22, 2023
4ee453e
clean up, remove tuple.inl
ZelboK Oct 22, 2023
89fd454
Update thrust/thrust/detail/allocator_aware_execution_policy.h
ZelboK Oct 22, 2023
a0e238c
Merge branch 'main' into feat-565-remove-thrust-conditional
ZelboK Oct 24, 2023
aaa2f2e
Merge branch 'feat-565-remove-thrust-conditional' of github.com:Zelbo…
ZelboK Oct 24, 2023
64ffa2f
Merge branch 'main' into feat-565-remove-thrust-conditional
ZelboK Oct 24, 2023
8d58a63
Merge branch 'main' into feat-565-remove-thrust-conditional
ZelboK Nov 7, 2023
307f50b
Merge branch 'main' into feat-565-remove-thrust-conditional
ZelboK Feb 19, 2024
f4b11ee
fix up merge
ZelboK Feb 19, 2024
c9a3529
Remove old code from merge
ZelboK Feb 19, 2024
6b9e529
fix up merge
ZelboK Feb 19, 2024
038accc
fix up merge
ZelboK Feb 19, 2024
8b5886f
test
ZelboK Feb 19, 2024
06d382f
test
ZelboK Feb 19, 2024
a900757
Merge branch 'main' into feat-565-remove-thrust-conditional
ZelboK Mar 12, 2024
fb589f2
Merge branch 'main' into feat-565-remove-thrust-conditional
miscco Mar 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions thrust/examples/arbitrary_transformation.cu
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include <thrust/detail/config.h>

#if _CCCL_STD_VER >= 2011 && !defined(THRUST_LEGACY_GCC)
#if !defined(THRUST_LEGACY_GCC)
#include <thrust/zip_function.h>
#endif // >= C++11

Expand Down Expand Up @@ -52,7 +52,8 @@ struct arbitrary_functor1
}
};

#if _CCCL_STD_VER >= 2011 && !defined(THRUST_LEGACY_GCC)

#if !defined(THRUST_LEGACY_GCC)
struct arbitrary_functor2
{
__host__ __device__
Expand Down Expand Up @@ -89,8 +90,9 @@ int main(void)
for(int i = 0; i < 5; i++)
std::cout << A[i] << " + " << B[i] << " * " << C[i] << " = " << D1[i] << std::endl;


// apply the transformation using zip_function
#if _CCCL_STD_VER >= 2011 && !defined(THRUST_LEGACY_GCC)
#if !defined(THRUST_LEGACY_GCC)
thrust::device_vector<float> D2(5);
thrust::for_each(thrust::make_zip_iterator(thrust::make_tuple(A.begin(), B.begin(), C.begin(), D2.begin())),
thrust::make_zip_iterator(thrust::make_tuple(A.end(), B.end(), C.end(), D2.end())),
Expand Down
5 changes: 0 additions & 5 deletions thrust/examples/cuda/async_reduce.cu
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
#include <thrust/system/cuda/execution_policy.h>
#include <cassert>

#if _CCCL_STD_VER >= 2011
#include <future>
#endif

// This example demonstrates two ways to achieve algorithm invocations that are asynchronous with
// the calling thread.
Expand Down Expand Up @@ -59,9 +57,7 @@ int main()
// reset the result
result[0] = 0;

#if _CCCL_STD_VER >= 2011
// method 2: use std::async to create asynchrony
ZelboK marked this conversation as resolved.
Show resolved Hide resolved

// copy all the algorithm parameters
auto begin = data.begin();
auto end = data.end();
Expand All @@ -77,7 +73,6 @@ int main()

// wait on the result and check that it is correct
assert(future_result.get() == n);
#endif

return 0;
}
Expand Down
10 changes: 0 additions & 10 deletions thrust/examples/cuda/global_device_vector.cu
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ typedef thrust::system::cuda::detail::cuda_memory_resource<
thrust::cuda::pointer<void>
> device_ignore_shutdown_memory_resource;

#if _CCCL_STD_VER >= 2011
template <typename T>
using device_ignore_shutdown_allocator =
thrust::mr::stateless_resource_allocator<
Expand All @@ -30,15 +29,6 @@ typedef thrust::system::cuda::detail::cuda_memory_resource<
>;

thrust::device_vector<double, device_ignore_shutdown_allocator<double>> d;
#else
thrust::device_vector<
double,
thrust::mr::stateless_resource_allocator<
double,
thrust::device_ptr_memory_resource<device_ignore_shutdown_memory_resource>
>
> d;
#endif

int main() {
d.resize(25);
Expand Down
4 changes: 1 addition & 3 deletions thrust/examples/uninitialized_vector.cu
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ template<typename T>
__host__
~uninitialized_allocator() {}

#if _CCCL_STD_VER >= 2011
uninitialized_allocator & operator=(const uninitialized_allocator &) = default;
#endif
uninitialized_allocator & operator=(const uninitialized_allocator &) = default;

// for correctness, you should also redefine rebind when you inherit
// from an allocator type; this way, if the allocator is rebound somewhere,
Expand Down
29 changes: 6 additions & 23 deletions thrust/internal/benchmark/bench.cu
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@
#include <thrust/reduce.h>
#include <thrust/scan.h>
#include <thrust/detail/config.h>

#if _CCCL_STD_VER >= 2011
#include <thrust/random.h>
#include <thrust/shuffle.h>

#include <random>
#endif

#include <algorithm>
#include <numeric>

Expand Down Expand Up @@ -47,15 +43,6 @@
#define PP_STRINGIZE(expr) PP_STRINGIZE_(expr)

#define PP_CAT(a, b) a ## b

// We don't use THRUST_NOEXCEPT because it's new, and we want this benchmark to
// be backwards-compatible to older versions of Thrust.
#if _CCCL_STD_VER >= 2011
#define NOEXCEPT noexcept
#else
#define NOEXCEPT throw()
#endif

///////////////////////////////////////////////////////////////////////////////

template <typename T>
Expand Down Expand Up @@ -699,7 +686,6 @@ struct copy_trial_base : trial_base<TrialKind>
}
};

#if _CCCL_STD_VER >= 2011
template <typename Container, typename TrialKind = regular_trial>
struct shuffle_trial_base : trial_base<TrialKind>
{
Expand All @@ -712,7 +698,6 @@ struct shuffle_trial_base : trial_base<TrialKind>
randomize(input);
}
};
#endif
ZelboK marked this conversation as resolved.
Show resolved Hide resolved

///////////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -909,7 +894,6 @@ struct copy_tester
#endif
};

#if _CCCL_STD_VER >= 2011
template <typename T>
struct shuffle_tester
{
Expand Down Expand Up @@ -938,7 +922,6 @@ struct shuffle_tester
}
};
};
#endif

///////////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -1079,8 +1062,8 @@ std::vector<std::string> split(std::string const& str, std::string const& delim)

struct command_line_option_error : std::exception
{
virtual ~command_line_option_error() NOEXCEPT {}
virtual const char* what() const NOEXCEPT = 0;
virtual ~command_line_option_error() noexcept {}
virtual const char* what() const noexcept = 0;
};

struct only_one_option_allowed : command_line_option_error
Expand Down Expand Up @@ -1109,9 +1092,9 @@ struct only_one_option_allowed : command_line_option_error
message += ".";
}

virtual ~only_one_option_allowed() NOEXCEPT {}
virtual ~only_one_option_allowed() noexcept {}

virtual const char* what() const NOEXCEPT
virtual const char* what() const noexcept
{
return message.c_str();
}
Expand All @@ -1132,9 +1115,9 @@ struct required_option_missing : command_line_option_error
message += "` option is required.";
}

virtual ~required_option_missing() NOEXCEPT {}
virtual ~required_option_missing() noexcept {}

virtual const char* what() const NOEXCEPT
virtual const char* what() const noexcept
{
return message.c_str();
}
Expand Down
106 changes: 53 additions & 53 deletions thrust/testing/alignment.cu
Original file line number Diff line number Diff line change
Expand Up @@ -67,29 +67,29 @@ DECLARE_UNITTEST(test_alignof_mocks_sizes);

void test_alignof()
{
ASSERT_EQUAL(THRUST_ALIGNOF(bool) , sizeof(bool));
ASSERT_EQUAL(THRUST_ALIGNOF(signed char) , sizeof(signed char));
ASSERT_EQUAL(THRUST_ALIGNOF(unsigned char) , sizeof(unsigned char));
ASSERT_EQUAL(THRUST_ALIGNOF(char) , sizeof(char));
ASSERT_EQUAL(THRUST_ALIGNOF(short int) , sizeof(short int));
ASSERT_EQUAL(THRUST_ALIGNOF(unsigned short int) , sizeof(unsigned short int));
ASSERT_EQUAL(THRUST_ALIGNOF(int) , sizeof(int));
ASSERT_EQUAL(THRUST_ALIGNOF(unsigned int) , sizeof(unsigned int));
ASSERT_EQUAL(THRUST_ALIGNOF(long int) , sizeof(long int));
ASSERT_EQUAL(THRUST_ALIGNOF(unsigned long int) , sizeof(unsigned long int));
ASSERT_EQUAL(THRUST_ALIGNOF(long long int) , sizeof(long long int));
ASSERT_EQUAL(THRUST_ALIGNOF(unsigned long long int), sizeof(unsigned long long int));
ASSERT_EQUAL(THRUST_ALIGNOF(float) , sizeof(float));
ASSERT_EQUAL(THRUST_ALIGNOF(double) , sizeof(double));
ASSERT_EQUAL(THRUST_ALIGNOF(long double) , sizeof(long double));
ASSERT_EQUAL(alignof(bool) , sizeof(bool));
ASSERT_EQUAL(alignof(signed char) , sizeof(signed char));
ASSERT_EQUAL(alignof(unsigned char) , sizeof(unsigned char));
ASSERT_EQUAL(alignof(char) , sizeof(char));
ASSERT_EQUAL(alignof(short int) , sizeof(short int));
ASSERT_EQUAL(alignof(unsigned short int) , sizeof(unsigned short int));
ASSERT_EQUAL(alignof(int) , sizeof(int));
ASSERT_EQUAL(alignof(unsigned int) , sizeof(unsigned int));
ASSERT_EQUAL(alignof(long int) , sizeof(long int));
ASSERT_EQUAL(alignof(unsigned long int) , sizeof(unsigned long int));
ASSERT_EQUAL(alignof(long long int) , sizeof(long long int));
ASSERT_EQUAL(alignof(unsigned long long int), sizeof(unsigned long long int));
ASSERT_EQUAL(alignof(float) , sizeof(float));
ASSERT_EQUAL(alignof(double) , sizeof(double));
ASSERT_EQUAL(alignof(long double) , sizeof(long double));

ASSERT_EQUAL(THRUST_ALIGNOF(alignof_mock_0), sizeof(char));
ASSERT_EQUAL(THRUST_ALIGNOF(alignof_mock_1), sizeof(int));
ASSERT_EQUAL(THRUST_ALIGNOF(alignof_mock_2), sizeof(int));
ASSERT_EQUAL(THRUST_ALIGNOF(alignof_mock_3), sizeof(int));
ASSERT_EQUAL(THRUST_ALIGNOF(alignof_mock_4), sizeof(int));
ASSERT_EQUAL(THRUST_ALIGNOF(alignof_mock_5), sizeof(int));
ASSERT_EQUAL(THRUST_ALIGNOF(alignof_mock_6), sizeof(int));
ASSERT_EQUAL(alignof(alignof_mock_0), sizeof(char));
ASSERT_EQUAL(alignof(alignof_mock_1), sizeof(int));
ASSERT_EQUAL(alignof(alignof_mock_2), sizeof(int));
ASSERT_EQUAL(alignof(alignof_mock_3), sizeof(int));
ASSERT_EQUAL(alignof(alignof_mock_4), sizeof(int));
ASSERT_EQUAL(alignof(alignof_mock_5), sizeof(int));
ASSERT_EQUAL(alignof(alignof_mock_6), sizeof(int));
}
DECLARE_UNITTEST(test_alignof);

Expand Down Expand Up @@ -192,7 +192,7 @@ void test_aligned_type_instantiation()
{
typedef typename thrust::detail::aligned_type<Align>::type type;
ASSERT_GEQUAL(sizeof(type), 1lu);
ASSERT_EQUAL(THRUST_ALIGNOF(type), Align);
ASSERT_EQUAL(alignof(type), Align);
ASSERT_EQUAL(thrust::detail::alignment_of<type>::value, Align);
}

Expand All @@ -212,64 +212,64 @@ DECLARE_UNITTEST(test_aligned_type);
void test_max_align_t()
{
ASSERT_GEQUAL(
THRUST_ALIGNOF(thrust::detail::max_align_t)
, THRUST_ALIGNOF(bool)
alignof(thrust::detail::max_align_t)
, alignof(bool)
);
ASSERT_GEQUAL(
THRUST_ALIGNOF(thrust::detail::max_align_t)
, THRUST_ALIGNOF(signed char)
alignof(thrust::detail::max_align_t)
, alignof(signed char)
);
ASSERT_GEQUAL(
THRUST_ALIGNOF(thrust::detail::max_align_t)
, THRUST_ALIGNOF(unsigned char)
alignof(thrust::detail::max_align_t)
, alignof(unsigned char)
);
ASSERT_GEQUAL(
THRUST_ALIGNOF(thrust::detail::max_align_t)
, THRUST_ALIGNOF(char)
alignof(thrust::detail::max_align_t)
, alignof(char)
);
ASSERT_GEQUAL(
THRUST_ALIGNOF(thrust::detail::max_align_t)
, THRUST_ALIGNOF(short int)
alignof(thrust::detail::max_align_t)
, alignof(short int)
);
ASSERT_GEQUAL(
THRUST_ALIGNOF(thrust::detail::max_align_t)
, THRUST_ALIGNOF(unsigned short int)
alignof(thrust::detail::max_align_t)
, alignof(unsigned short int)
);
ASSERT_GEQUAL(
THRUST_ALIGNOF(thrust::detail::max_align_t)
, THRUST_ALIGNOF(int)
alignof(thrust::detail::max_align_t)
, alignof(int)
);
ASSERT_GEQUAL(
THRUST_ALIGNOF(thrust::detail::max_align_t)
, THRUST_ALIGNOF(unsigned int)
alignof(thrust::detail::max_align_t)
, alignof(unsigned int)
);
ASSERT_GEQUAL(
THRUST_ALIGNOF(thrust::detail::max_align_t)
, THRUST_ALIGNOF(long int)
alignof(thrust::detail::max_align_t)
, alignof(long int)
);
ASSERT_GEQUAL(
THRUST_ALIGNOF(thrust::detail::max_align_t)
, THRUST_ALIGNOF(unsigned long int)
alignof(thrust::detail::max_align_t)
, alignof(unsigned long int)
);
ASSERT_GEQUAL(
THRUST_ALIGNOF(thrust::detail::max_align_t)
, THRUST_ALIGNOF(long long int)
alignof(thrust::detail::max_align_t)
, alignof(long long int)
);
ASSERT_GEQUAL(
THRUST_ALIGNOF(thrust::detail::max_align_t)
, THRUST_ALIGNOF(unsigned long long int)
alignof(thrust::detail::max_align_t)
, alignof(unsigned long long int)
);
ASSERT_GEQUAL(
THRUST_ALIGNOF(thrust::detail::max_align_t)
, THRUST_ALIGNOF(float)
alignof(thrust::detail::max_align_t)
, alignof(float)
);
ASSERT_GEQUAL(
THRUST_ALIGNOF(thrust::detail::max_align_t)
, THRUST_ALIGNOF(double)
alignof(thrust::detail::max_align_t)
, alignof(double)
);
ASSERT_GEQUAL(
THRUST_ALIGNOF(thrust::detail::max_align_t)
, THRUST_ALIGNOF(long double)
alignof(thrust::detail::max_align_t)
, alignof(long double)
);
}
DECLARE_UNITTEST(test_max_align_t);
Expand Down
2 changes: 0 additions & 2 deletions thrust/testing/allocator_aware_policies.cu
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,9 @@ struct TestAllocatorAttachment
test_temporary_allocation_valid(policy(const_alloc));
test_temporary_allocation_valid(policy(&test_memory_resource));

#if _CCCL_STD_VER >= 2011
test_temporary_allocation_valid(policy(std::allocator<int>()).after(1));
test_temporary_allocation_valid(policy(alloc).after(1));
test_temporary_allocation_valid(policy(const_alloc).after(1));
#endif
}
};

Expand Down
Loading
Loading