Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ Checks:
- 'performance-*'
- '-performance-noexcept-swap'
- '-performance-enum-size'
- '-performance-unnecessary-copy-initialization'
- '-performance-unnecessary-value-param'
# END REMOVE ME
# HICPP is 99% aliased to other checks (mostly modernize-* and bugprone-*). We don't
Expand Down
5 changes: 1 addition & 4 deletions cub/cub/thread/thread_operators.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,7 @@ public:
template <typename T>
_CCCL_HOST_DEVICE _CCCL_FORCEINLINE T operator()(const T& a, const T& b)
{
T _a(a);
T _b(b);

return scan_op(_b, _a);
return scan_op(b, a);
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,14 @@ C2H_CCCLRT_TEST("cuda::buffer constructors", "[container][buffer]", test_types)
static_assert(!cuda::std::is_nothrow_copy_constructible<Buffer>::value, "");
{ // can be copy constructed from empty input
const Buffer input{stream, resource, 0, cuda::no_init};
Buffer buf(input);
Buffer buf(input); // NOLINT(performance-unnecessary-copy-initialization)
CCCLRT_CHECK(buf.empty());
CCCLRT_CHECK(buf.alignment() == input.alignment());
}

{ // can be copy constructed from non-empty input
const Buffer input{stream, resource, {T(1), T(42), T(1337), T(0), T(12), T(-1)}};
Buffer buf(input);
Buffer buf(input); // NOLINT(performance-unnecessary-copy-initialization)
CCCLRT_CHECK(buf.alignment() == input.alignment());
CCCLRT_CHECK(is_pointer_aligned(buf.data(), buf.alignment()));
CCCLRT_CHECK(check_offseted_pointer(buf.data()));
Expand All @@ -228,7 +228,7 @@ C2H_CCCLRT_TEST("cuda::buffer constructors", "[container][buffer]", test_types)
const ::cuda::std::size_t alignment = ::cuda::mr::default_cuda_malloc_alignment / 2;
const auto env = ::cuda::std::execution::prop{::cuda::allocation_alignment, alignment};
const Buffer input{stream, resource, 5, cuda::no_init, env};
Buffer buf(input);
Buffer buf(input); // NOLINT(performance-unnecessary-copy-initialization)
CCCLRT_CHECK(buf.alignment() == alignment);
CCCLRT_CHECK(input.alignment() == alignment);
CCCLRT_CHECK(cuda::allocation_alignment(buf) == alignment);
Expand Down
2 changes: 1 addition & 1 deletion thrust/testing/pair.cu
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct TestPairManipulation
ASSERT_EQUAL(p1.second, sp.second);

// test initialization
P p3 = p2;
P p3 = p2; // NOLINT(performance-unnecessary-copy-initialization)
ASSERT_EQUAL(p2.first, p3.first);
ASSERT_EQUAL(p2.second, p3.second);

Expand Down
2 changes: 1 addition & 1 deletion thrust/testing/permutation_iterator.cu
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ void TestPermutationIteratorHostDeviceScatter()
// scatter device->host
thrust::copy(d_source.begin(), d_source.end(), p_h_output);

HostVector href(dref);
HostVector href = dref;
ASSERT_EQUAL(h_output, href);
}
DECLARE_UNITTEST(TestPermutationIteratorHostDeviceScatter);
Expand Down
4 changes: 2 additions & 2 deletions thrust/testing/uninitialized_fill.cu
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ struct TestUninitializedFillNonPOD
ASSERT_EQUAL(false, exemplar.copy_constructed_on_device);
ASSERT_EQUAL(false, exemplar.copy_constructed_on_host);

T host_copy_of_exemplar(exemplar);
T host_copy_of_exemplar(exemplar); // NOLINT(performance-unnecessary-copy-initialization)
ASSERT_EQUAL(false, exemplar.copy_constructed_on_device);
ASSERT_EQUAL(true, exemplar.copy_constructed_on_host);

Expand Down Expand Up @@ -216,7 +216,7 @@ struct TestUninitializedFillNNonPOD
ASSERT_EQUAL(false, exemplar.copy_constructed_on_device);
ASSERT_EQUAL(false, exemplar.copy_constructed_on_host);

T host_copy_of_exemplar(exemplar);
T host_copy_of_exemplar(exemplar); // NOLINT(performance-unnecessary-copy-initialization)
ASSERT_EQUAL(false, exemplar.copy_constructed_on_device);
ASSERT_EQUAL(true, exemplar.copy_constructed_on_host);

Expand Down
122 changes: 61 additions & 61 deletions thrust/testing/unittest/testframework.h
Original file line number Diff line number Diff line change
Expand Up @@ -474,71 +474,71 @@ class UnitTestDriver
TEST##UnitTest TEST##Instance

// Macro to create instances of a test for several array sizes.
#define DECLARE_SIZED_UNITTEST(TEST) \
class TEST##UnitTest : public UnitTest \
{ \
public: \
TEST##UnitTest() \
: UnitTest(#TEST) \
{} \
void run() \
{ \
std::vector<size_t> sizes = get_test_sizes(); \
for (size_t i = 0; i != sizes.size(); ++i) \
{ \
TEST(sizes[i]); \
} \
} \
}; \
#define DECLARE_SIZED_UNITTEST(TEST) \
class TEST##UnitTest : public UnitTest \
{ \
public: \
TEST##UnitTest() \
: UnitTest(#TEST) \
{} \
void run() \
{ \
const std::vector<size_t>& sizes = get_test_sizes(); \
for (size_t i = 0; i != sizes.size(); ++i) \
{ \
TEST(sizes[i]); \
} \
} \
}; \
TEST##UnitTest TEST##Instance

// Macro to create instances of a test for several data types and array sizes
#define DECLARE_VARIABLE_UNITTEST(TEST) \
class TEST##UnitTest : public UnitTest \
{ \
public: \
TEST##UnitTest() \
: UnitTest(#TEST) \
{} \
void run() \
{ \
std::vector<size_t> sizes = get_test_sizes(); \
for (size_t i = 0; i != sizes.size(); ++i) \
{ \
TEST<signed char>(sizes[i]); \
TEST<unsigned char>(sizes[i]); \
TEST<short>(sizes[i]); \
TEST<unsigned short>(sizes[i]); \
TEST<int>(sizes[i]); \
TEST<unsigned int>(sizes[i]); \
TEST<float>(sizes[i]); \
TEST<double>(sizes[i]); \
} \
} \
}; \
#define DECLARE_VARIABLE_UNITTEST(TEST) \
class TEST##UnitTest : public UnitTest \
{ \
public: \
TEST##UnitTest() \
: UnitTest(#TEST) \
{} \
void run() \
{ \
const std::vector<size_t>& sizes = get_test_sizes(); \
for (size_t i = 0; i != sizes.size(); ++i) \
{ \
TEST<signed char>(sizes[i]); \
TEST<unsigned char>(sizes[i]); \
TEST<short>(sizes[i]); \
TEST<unsigned short>(sizes[i]); \
TEST<int>(sizes[i]); \
TEST<unsigned int>(sizes[i]); \
TEST<float>(sizes[i]); \
TEST<double>(sizes[i]); \
} \
} \
}; \
TEST##UnitTest TEST##Instance

#define DECLARE_INTEGRAL_VARIABLE_UNITTEST(TEST) \
class TEST##UnitTest : public UnitTest \
{ \
public: \
TEST##UnitTest() \
: UnitTest(#TEST) \
{} \
void run() \
{ \
std::vector<size_t> sizes = get_test_sizes(); \
for (size_t i = 0; i != sizes.size(); ++i) \
{ \
TEST<signed char>(sizes[i]); \
TEST<unsigned char>(sizes[i]); \
TEST<short>(sizes[i]); \
TEST<unsigned short>(sizes[i]); \
TEST<int>(sizes[i]); \
TEST<unsigned int>(sizes[i]); \
} \
} \
}; \
#define DECLARE_INTEGRAL_VARIABLE_UNITTEST(TEST) \
class TEST##UnitTest : public UnitTest \
{ \
public: \
TEST##UnitTest() \
: UnitTest(#TEST) \
{} \
void run() \
{ \
const std::vector<size_t>& sizes = get_test_sizes(); \
for (size_t i = 0; i != sizes.size(); ++i) \
{ \
TEST<signed char>(sizes[i]); \
TEST<unsigned char>(sizes[i]); \
TEST<short>(sizes[i]); \
TEST<unsigned short>(sizes[i]); \
TEST<int>(sizes[i]); \
TEST<unsigned int>(sizes[i]); \
} \
} \
}; \
TEST##UnitTest TEST##Instance

#define DECLARE_GENERIC_UNITTEST_WITH_TYPES_AND_NAME(TEST, TYPES, NAME) \
Expand Down Expand Up @@ -590,7 +590,7 @@ class VariableUnitTest : public UnitTest

void run()
{
std::vector<size_t> sizes = get_test_sizes();
const std::vector<size_t>& sizes = get_test_sizes();
for (size_t i = 0; i != sizes.size(); ++i)
{
// get the first type in the list
Expand Down
6 changes: 4 additions & 2 deletions thrust/thrust/detail/memory_algorithms.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ _CCCL_HOST_DEVICE ForwardIt destroy(Allocator const& alloc, ForwardIt first, For
using traits =
typename ::cuda::std::allocator_traits<::cuda::std::remove_cvref_t<Allocator>>::template rebind_traits<T>;

typename traits::allocator_type alloc_T(alloc);
// allocator_type might not be same as Allocator
const typename traits::allocator_type alloc_T(alloc); // NOLINT(performance-unnecessary-copy-initialization)

for (; first != last; ++first)
{
Expand Down Expand Up @@ -93,7 +94,8 @@ _CCCL_HOST_DEVICE ForwardIt destroy_n(Allocator const& alloc, ForwardIt first, S
using traits =
typename ::cuda::std::allocator_traits<::cuda::std::remove_cvref_t<Allocator>>::template rebind_traits<T>;

typename traits::allocator_type alloc_T(alloc);
// allocator_type might not be same as Allocator
const typename traits::allocator_type alloc_T(alloc); // NOLINT(performance-unnecessary-copy-initialization)

for (; n > 0; (void) ++first, --n)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ _CCCL_HOST_DEVICE OutputIterator adjacent_difference(

while (++first != last)
{
InputType next = *first;
InputType next = *first; // NOLINT(performance-unnecessary-copy-initialization)
*(++result) = binary_op(next, curr);
curr = next;
}
Expand Down
2 changes: 1 addition & 1 deletion thrust/thrust/system/detail/sequential/insertion_sort.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ _CCCL_HOST_DEVICE void insertion_sort_by_key(
for (; i1 != last1; ++i1, ++i2)
{
value_type1 tmp1 = *i1;
value_type2 tmp2 = *i2;
value_type2 tmp2 = *i2; // NOLINT(performance-unnecessary-copy-initialization)

if (wrapped_comp(tmp1, *first1))
{
Expand Down
4 changes: 2 additions & 2 deletions thrust/thrust/system/detail/sequential/scan_by_key.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ _CCCL_HOST_DEVICE OutputIterator inclusive_scan_by_key(

for (++first1, ++first2, ++result; first1 != last1; ++first1, (void) ++first2, (void) ++result)
{
KeyType key = *first1;
KeyType key = *first1; // NOLINT(performance-unnecessary-copy-initialization)

if (binary_pred(prev_key, key))
{
Expand Down Expand Up @@ -107,7 +107,7 @@ _CCCL_HOST_DEVICE OutputIterator exclusive_scan_by_key(

for (++first1, ++first2, ++result; first1 != last1; ++first1, (void) ++first2, (void) ++result)
{
KeyType key = *first1;
KeyType key = *first1; // NOLINT(performance-unnecessary-copy-initialization)

// use temp to permit in-place scans
temp_value = *first2;
Expand Down
Loading