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

Add missing inline specifiers #1813

Merged
merged 1 commit into from
Jun 6, 2024
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 cub/test/catch2_test_device_histogram.cu
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#include "c2h/vector.cuh"
#include "catch2_test_helper.h"
#include "catch2_test_launch_helper.h"
#include "test_util.h"

// %PARAM% TEST_LAUNCH lid 0:1:2

Expand Down
2 changes: 2 additions & 0 deletions cub/test/catch2_test_printing.cu
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <sstream>

#include "catch2_test_helper.h"
#include "test_util.h"

Expand Down
8 changes: 3 additions & 5 deletions cub/test/mersenne.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@

#pragma once

#include <stdio.h>

namespace mersenne
{

Expand All @@ -59,7 +57,7 @@ static unsigned int mt[N]; /* the array for the state vector */
static int mti = N + 1; /* mti==N+1 means mt[N] is not initialized */

/* initializes mt[N] with a seed */
void init_genrand(unsigned int s)
inline void init_genrand(unsigned int s)
{
mt[0] = s & 0xffffffff;
for (mti = 1; mti < static_cast<int>(N); mti++)
Expand All @@ -80,7 +78,7 @@ void init_genrand(unsigned int s)
/* init_key is the array for initializing keys */
/* key_length is its length */
/* slight change for C++, 2004/2/26 */
void init_by_array(unsigned int init_key[], int key_length)
inline void init_by_array(unsigned int init_key[], int key_length)
{
int i, j, k;
init_genrand(19650218);
Expand Down Expand Up @@ -119,7 +117,7 @@ void init_by_array(unsigned int init_key[], int key_length)
}

/* generates a random number on [0,0xffffffff]-interval */
unsigned int genrand_int32()
inline unsigned int genrand_int32()
{
unsigned int y;
static unsigned int mag01[2] = {0x0, MATRIX_A};
Expand Down
41 changes: 19 additions & 22 deletions cub/test/test_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ struct CommandLineArgs
};

// Gets the amount of global memory of the current device.
std::size_t TotalGlobalMem()
inline std::size_t TotalGlobalMem()
{
int device = 0;
CubDebugExit(cudaGetDevice(&device));
Expand All @@ -367,77 +367,75 @@ std::size_t TotalGlobalMem()
* Random bits generator
******************************************************************************/

int g_num_rand_samples = 0;

template <typename T>
bool IsNaN(T /* val */)
{
return false;
}

template <>
__noinline__ bool IsNaN<float>(float val)
inline bool IsNaN<float>(float val)
{
return std::isnan(val);
}

template <>
__noinline__ bool IsNaN<float1>(float1 val)
inline bool IsNaN<float1>(float1 val)
{
return (IsNaN(val.x));
}

template <>
__noinline__ bool IsNaN<float2>(float2 val)
inline bool IsNaN<float2>(float2 val)
{
return (IsNaN(val.y) || IsNaN(val.x));
}

template <>
__noinline__ bool IsNaN<float3>(float3 val)
inline bool IsNaN<float3>(float3 val)
{
return (IsNaN(val.z) || IsNaN(val.y) || IsNaN(val.x));
}

template <>
__noinline__ bool IsNaN<float4>(float4 val)
inline bool IsNaN<float4>(float4 val)
{
return (IsNaN(val.y) || IsNaN(val.x) || IsNaN(val.w) || IsNaN(val.z));
}

template <>
__noinline__ bool IsNaN<double>(double val)
inline bool IsNaN<double>(double val)
{
return std::isnan(val);
}

template <>
__noinline__ bool IsNaN<double1>(double1 val)
inline bool IsNaN<double1>(double1 val)
{
return (IsNaN(val.x));
}

template <>
__noinline__ bool IsNaN<double2>(double2 val)
inline bool IsNaN<double2>(double2 val)
{
return (IsNaN(val.y) || IsNaN(val.x));
}

template <>
__noinline__ bool IsNaN<double3>(double3 val)
inline bool IsNaN<double3>(double3 val)
{
return (IsNaN(val.z) || IsNaN(val.y) || IsNaN(val.x));
}

template <>
__noinline__ bool IsNaN<double4>(double4 val)
inline bool IsNaN<double4>(double4 val)
{
return (IsNaN(val.y) || IsNaN(val.x) || IsNaN(val.w) || IsNaN(val.z));
}

#ifdef TEST_HALF_T
template <>
__noinline__ bool IsNaN<half_t>(half_t val)
inline bool IsNaN<half_t>(half_t val)
{
const auto bits = SafeBitCast<unsigned short>(val);

Expand All @@ -448,7 +446,7 @@ __noinline__ bool IsNaN<half_t>(half_t val)

#ifdef TEST_BF_T
template <>
__noinline__ bool IsNaN<bfloat16_t>(bfloat16_t val)
inline bool IsNaN<bfloat16_t>(bfloat16_t val)
{
const auto bits = SafeBitCast<unsigned short>(val);

Expand Down Expand Up @@ -514,7 +512,6 @@ void RandomBits(K& key, int entropy_reduction = 0, int begin_bit = 0, int end_bi
{
// Grab some of the higher bits from rand (better entropy, supposedly)
word &= mersenne::genrand_int32();
g_num_rand_samples++;
}

word_buff[j] = word;
Expand Down Expand Up @@ -720,7 +717,7 @@ std::ostream& operator<<(std::ostream& os, const CUB_NS_QUALIFIER::KeyValuePair<
}

#if CUB_IS_INT128_ENABLED
static std::ostream& operator<<(std::ostream& os, __uint128_t val)
inline std::ostream& operator<<(std::ostream& os, __uint128_t val)
{
constexpr int max_digits = 40;
char buffer[max_digits] = {};
Expand All @@ -742,7 +739,7 @@ static std::ostream& operator<<(std::ostream& os, __uint128_t val)
return os;
}

static std::ostream& operator<<(std::ostream& os, __int128_t val)
inline std::ostream& operator<<(std::ostream& os, __int128_t val)
{
if (val < 0)
{
Expand Down Expand Up @@ -952,7 +949,7 @@ struct TestFoo
/**
* TestFoo ostream operator
*/
std::ostream& operator<<(std::ostream& os, const TestFoo& val)
inline std::ostream& operator<<(std::ostream& os, const TestFoo& val)
{
os << '(' << val.x << ',' << val.y << ',' << val.z << ',' << CoutCast(val.w) << ')';
return os;
Expand Down Expand Up @@ -1088,7 +1085,7 @@ struct TestBar
/**
* TestBar ostream operator
*/
std::ostream& operator<<(std::ostream& os, const TestBar& val)
inline std::ostream& operator<<(std::ostream& os, const TestBar& val)
{
os << '(' << val.x << ',' << val.y << ')';
return os;
Expand Down Expand Up @@ -1220,7 +1217,7 @@ int CompareResults(double* computed, double* reference, OffsetT len, bool verbos
* Verify the contents of a device array match those
* of a host array
*/
int CompareDeviceResults(
inline int CompareDeviceResults(
CUB_NS_QUALIFIER::NullType* /* h_reference */,
CUB_NS_QUALIFIER::NullType* /* d_data */,
std::size_t /* num_items */,
Expand Down Expand Up @@ -1343,7 +1340,7 @@ int CompareDeviceDeviceResults(
/**
* Print the contents of a host array
*/
void DisplayResults(CUB_NS_QUALIFIER::NullType* /* h_data */, std::size_t /* num_items */) {}
inline void DisplayResults(CUB_NS_QUALIFIER::NullType* /* h_data */, std::size_t /* num_items */) {}

/**
* Print the contents of a host array
Expand Down
4 changes: 2 additions & 2 deletions thrust/thrust/system/detail/error_category.inl
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,13 @@ public:

} // namespace detail

const error_category& generic_category()
inline const error_category& generic_category()
{
static const detail::generic_error_category result;
return result;
}

const error_category& system_category()
inline const error_category& system_category()
{
static const detail::system_error_category result;
return result;
Expand Down
Loading