Adjust clang format to the new versions, revert broken macro layout (#714)

This commit is contained in:
Danylo Lytovchenko
2025-08-22 17:23:22 +02:00
committed by GitHub
orang tua ed877433f3
melakukan 2ff2316227
189 mengubah file dengan 1906 tambahan dan 2418 penghapusan
@@ -90,7 +90,8 @@ TEST_CASE("Unit_hipClassKernel_Empty") {
__global__ void sizeClassBKernel(bool* result_ecd) {
int tid = threadIdx.x + blockIdx.x * blockDim.x;
result_ecd[tid] = (sizeof(testSizeB) == 12) && (sizeof(testSizeC) == 16) &&
(sizeof(testSizeP1) == 6) && (sizeof(testSizeP2) == 13) && (sizeof(testSizeP3) == 8);
(sizeof(testSizeP1) == 6) && (sizeof(testSizeP2) == 13) &&
(sizeof(testSizeP3) == 8);
}
TEST_CASE("Unit_hipClassKernel_BSize") {
@@ -107,7 +108,7 @@ TEST_CASE("Unit_hipClassKernel_BSize") {
__global__ void sizeClassKernel(bool* result_ecd) {
int tid = threadIdx.x + blockIdx.x * blockDim.x;
result_ecd[tid] = (sizeof(testSizeA) == 16) && (sizeof(testSizeDerived) == 24) &&
(sizeof(testSizeDerived2) == 20);
(sizeof(testSizeDerived2) == 20);
}
TEST_CASE("Unit_hipClassKernel_Size") {
@@ -124,10 +125,10 @@ TEST_CASE("Unit_hipClassKernel_Size") {
__global__ void sizeVirtualClassKernel(bool* result_ecd, refStructSizes structSizes) {
int tid = threadIdx.x + blockIdx.x * blockDim.x;
result_ecd[tid] = (structSizes.sizeOftestSizeDV == sizeof(testSizeDV)) &&
(structSizes.sizeOftestSizeDerivedDV == sizeof(testSizeDerivedDV)) &&
(structSizes.sizeOftestSizeVirtDer = sizeof(testSizeVirtDer)) &&
(structSizes.sizeOftestSizeVirtDerPack = sizeof(testSizeVirtDerPack)) &&
(structSizes.sizeOftestSizeDerMulti = sizeof(testSizeDerMulti));
(structSizes.sizeOftestSizeDerivedDV == sizeof(testSizeDerivedDV)) &&
(structSizes.sizeOftestSizeVirtDer = sizeof(testSizeVirtDer)) &&
(structSizes.sizeOftestSizeVirtDerPack = sizeof(testSizeVirtDerPack)) &&
(structSizes.sizeOftestSizeDerMulti = sizeof(testSizeDerMulti));
}
TEST_CASE("Unit_hipClassKernel_Virtual") {
@@ -388,9 +388,9 @@ TEST_CASE("Unit_Coalesced_Group_Getters_Via_Non_Member_Functions_Positive_Basic"
}
}
template <typename T>
__global__ void coalesced_group_shfl_up(T* const out, const unsigned int delta,
const uint64_t active_mask) {
template <typename T> __global__ void coalesced_group_shfl_up(T* const out,
const unsigned int delta,
const uint64_t active_mask) {
#if (__GFX8__ || __GFX9__)
constexpr unsigned int ksize = 64;
#else
@@ -468,9 +468,9 @@ TEMPLATE_TEST_CASE("Unit_Coalesced_Group_Shfl_Up_Positive_Basic", "", int, unsig
CoalescedGroupShflUpTestImpl<TestType>();
}
template <typename T>
__global__ void coalesced_group_shfl_down(T* const out, const unsigned int delta,
const uint64_t active_mask) {
template <typename T> __global__ void coalesced_group_shfl_down(T* const out,
const unsigned int delta,
const uint64_t active_mask) {
#if (__GFX8__ || __GFX9__)
constexpr unsigned int ksize = 64;
#else
@@ -558,9 +558,8 @@ TEMPLATE_TEST_CASE("Unit_Coalesced_Group_Shfl_Down_Positive_Basic", "", int, uns
CoalescedGroupShflDownTest<TestType>();
}
template <typename T>
__global__ void coalesced_group_shfl(T* const out, uint8_t* target_lanes,
const uint64_t active_mask) {
template <typename T> __global__ void coalesced_group_shfl(T* const out, uint8_t* target_lanes,
const uint64_t active_mask) {
#if (__GFX8__ || __GFX9__)
constexpr unsigned int ksize = 64;
#else
@@ -240,9 +240,9 @@ static void verify_recorded_values(unsigned int* recorded_values, uint32_t loops
}
}
template <typename F>
static void test_cg_multi_grid_group_type(F kernel_func, int num_devices, int block_size,
bool specific_api_test) {
template <typename F> static void test_cg_multi_grid_group_type(F kernel_func, int num_devices,
int block_size,
bool specific_api_test) {
// Create a stream each device
hipStream_t stream[MaxGPUs];
for (int i = 0; i < num_devices; i++) {
@@ -173,9 +173,9 @@ __global__ void kernel_cg_group_partition_dynamic(unsigned int tile_size, int* r
return;
}
template <typename F>
static void common_group_partition(F kernel_func, unsigned int tile_size, void** params,
size_t num_params, bool use_global_mem) {
template <typename F> static void common_group_partition(F kernel_func, unsigned int tile_size,
void** params, size_t num_params,
bool use_global_mem) {
int block_size = 1;
int threads_per_blk = 64;
@@ -200,8 +200,8 @@ bool isSetScratchLimitSupported() {
std::cout << "Device Id = " << deviceId << " props.major = " << props.major
<< " props.minor = " << props.minor << std::endl;
return ((props.major == 9 && props.minor >= 4) || (props.major == 12 && props.minor >= 5))
? true
: false;
? true
: false;
#else
std::cout << "Only Supported for Linux" << std::endl;
return false;
@@ -244,8 +244,8 @@ TEST_CASE("Unit_hipDeviceGetAttribute_NegTst") {
}
}
template <size_t n>
using AttributeToStringMap = std::array<std::pair<hipDeviceAttribute_t, const char*>, n>;
template <size_t n> using AttributeToStringMap =
std::array<std::pair<hipDeviceAttribute_t, const char*>, n>;
namespace {
@@ -478,11 +478,11 @@ template <typename Type> __global__ void bf16_cvt_to_integral(Type* in, float* o
TEMPLATE_TEST_CASE("Unit_bf16_conversion_to_integral_type", , unsigned short, short, int,
unsigned int) {
constexpr TestType start = std::is_unsigned<TestType>::value
? std::numeric_limits<unsigned short>::min()
: std::numeric_limits<short>::min();
? std::numeric_limits<unsigned short>::min()
: std::numeric_limits<short>::min();
constexpr TestType end = std::is_unsigned<TestType>::value
? std::numeric_limits<unsigned short>::max()
: std::numeric_limits<short>::max();
? std::numeric_limits<unsigned short>::max()
: std::numeric_limits<short>::max();
const size_t size = (start < 0) ? end - start : end + start;
TestType* d_input;
@@ -30,9 +30,9 @@ __device__ static void* dev_ptr[num_threads][GRIDSIZE];
* This kernel allocates and deallocates in every thread
* of every block.
*/
template <typename T>
static __global__ void kerTestDynamicAllocInAllThread(T* outputBuf, int test_type, T value,
size_t perThreadSize) {
template <typename T> static __global__ void kerTestDynamicAllocInAllThread(T* outputBuf,
int test_type, T value,
size_t perThreadSize) {
int myId = threadIdx.x + blockDim.x * blockIdx.x;
// Allocate
size_t size = 0;
@@ -623,8 +623,8 @@ template <typename T> __FP8_DEVICE__ void e4m3_fnuz_fp8_cvt(T val, float* cvt1,
__hip_fp8_e4m3_fnuz tmp1;
tmp1.__x = std::is_same<T, float>::value
? __hip_cvt_float_to_fp8(val, __HIP_SATFINITE, __HIP_E4M3_FNUZ)
: __hip_cvt_double_to_fp8(val, __HIP_SATFINITE, __HIP_E4M3_FNUZ);
? __hip_cvt_float_to_fp8(val, __HIP_SATFINITE, __HIP_E4M3_FNUZ)
: __hip_cvt_double_to_fp8(val, __HIP_SATFINITE, __HIP_E4M3_FNUZ);
;
*cvt2 = tmp1;
#else
@@ -641,8 +641,8 @@ template <typename T> __FP8_DEVICE__ void e5m2_fnuz_fp8_cvt(T val, float* cvt1,
__hip_fp8_e5m2_fnuz tmp1;
tmp1.__x = std::is_same<T, float>::value
? __hip_cvt_float_to_fp8(val, __HIP_SATFINITE, __HIP_E5M2_FNUZ)
: __hip_cvt_double_to_fp8(val, __HIP_SATFINITE, __HIP_E5M2_FNUZ);
? __hip_cvt_float_to_fp8(val, __HIP_SATFINITE, __HIP_E5M2_FNUZ)
: __hip_cvt_double_to_fp8(val, __HIP_SATFINITE, __HIP_E5M2_FNUZ);
;
*cvt2 = tmp1;
#else
@@ -170,8 +170,8 @@ TEMPLATE_TEST_CASE("Unit_fp8_ocp_correctness", "", float, double) {
__hip_fp8_e4m3 tmp;
tmp.__x = std::is_same<TestType, float>::value
? __hip_cvt_float_to_fp8(orig, __HIP_SATFINITE, __HIP_E4M3)
: __hip_cvt_double_to_fp8(orig, __HIP_SATFINITE, __HIP_E4M3);
? __hip_cvt_float_to_fp8(orig, __HIP_SATFINITE, __HIP_E4M3)
: __hip_cvt_double_to_fp8(orig, __HIP_SATFINITE, __HIP_E4M3);
;
float cvt2 = tmp;
@@ -440,8 +440,8 @@ TEMPLATE_TEST_CASE("Unit_fp8_ocp_correctness", "", float, double) {
__hip_fp8_e5m2 tmp;
tmp.__x = std::is_same<TestType, float>::value
? __hip_cvt_float_to_fp8(orig, __HIP_SATFINITE, __HIP_E5M2)
: __hip_cvt_double_to_fp8(orig, __HIP_SATFINITE, __HIP_E5M2);
? __hip_cvt_float_to_fp8(orig, __HIP_SATFINITE, __HIP_E5M2)
: __hip_cvt_double_to_fp8(orig, __HIP_SATFINITE, __HIP_E5M2);
;
float cvt2 = tmp;
@@ -780,8 +780,8 @@ TEMPLATE_TEST_CASE("Unit_fp8_fnuz_correctness", "", float, double) {
__hip_fp8_e4m3_fnuz tmp;
tmp.__x = std::is_same<TestType, float>::value
? __hip_cvt_float_to_fp8(orig, __HIP_SATFINITE, __HIP_E4M3_FNUZ)
: __hip_cvt_double_to_fp8(orig, __HIP_SATFINITE, __HIP_E4M3_FNUZ);
? __hip_cvt_float_to_fp8(orig, __HIP_SATFINITE, __HIP_E4M3_FNUZ)
: __hip_cvt_double_to_fp8(orig, __HIP_SATFINITE, __HIP_E4M3_FNUZ);
;
float cvt2 = tmp;
@@ -1058,8 +1058,8 @@ TEMPLATE_TEST_CASE("Unit_fp8_fnuz_correctness", "", float, double) {
__hip_fp8_e5m2_fnuz tmp;
tmp.__x = std::is_same<TestType, float>::value
? __hip_cvt_float_to_fp8(orig, __HIP_SATFINITE, __HIP_E5M2_FNUZ)
: __hip_cvt_double_to_fp8(orig, __HIP_SATFINITE, __HIP_E5M2_FNUZ);
? __hip_cvt_float_to_fp8(orig, __HIP_SATFINITE, __HIP_E5M2_FNUZ)
: __hip_cvt_double_to_fp8(orig, __HIP_SATFINITE, __HIP_E5M2_FNUZ);
;
float cvt2 = tmp;
@@ -629,8 +629,8 @@ template <typename T> __FP8_DEVICE__ void e4m3_ocp_fp8_cvt(T val, float* cvt1, f
__hip_fp8_e4m3 tmp1;
tmp1.__x = std::is_same<T, float>::value
? __hip_cvt_float_to_fp8(val, __HIP_SATFINITE, __HIP_E4M3)
: __hip_cvt_double_to_fp8(val, __HIP_SATFINITE, __HIP_E4M3);
? __hip_cvt_float_to_fp8(val, __HIP_SATFINITE, __HIP_E4M3)
: __hip_cvt_double_to_fp8(val, __HIP_SATFINITE, __HIP_E4M3);
;
*cvt2 = tmp1;
#else
@@ -647,8 +647,8 @@ template <typename T> __FP8_DEVICE__ void e5m2_ocp_fp8_cvt(T val, float* cvt1, f
__hip_fp8_e5m2 tmp1;
tmp1.__x = std::is_same<T, float>::value
? __hip_cvt_float_to_fp8(val, __HIP_SATFINITE, __HIP_E5M2)
: __hip_cvt_double_to_fp8(val, __HIP_SATFINITE, __HIP_E5M2);
? __hip_cvt_float_to_fp8(val, __HIP_SATFINITE, __HIP_E5M2)
: __hip_cvt_double_to_fp8(val, __HIP_SATFINITE, __HIP_E5M2);
;
*cvt2 = tmp1;
#else
@@ -398,27 +398,27 @@ static bool test_allcomplexMathFunc_host() {
TEST_CASE("Unit_TestMathFuncComplex") {
bool TestPassed = false;
TestPassed = test_makehipComplex_dev<hipFloatComplex, float>() &&
test_makehipComplex_dev<float2, float>() &&
test_makehipComplex_dev<hipDoubleComplex, double>() &&
test_makehipComplex_dev<double2, double>() &&
test_complexMathFunc1_dev<hipFloatComplex, float>(COMPLEX_ADD) &&
test_complexMathFunc1_dev<hipDoubleComplex, double>(COMPLEX_ADD) &&
test_complexMathFunc1_dev<hipFloatComplex, float>(COMPLEX_SUB) &&
test_complexMathFunc1_dev<hipDoubleComplex, double>(COMPLEX_SUB) &&
test_complexMathFunc1_dev<hipFloatComplex, float>(COMPLEX_MUL) &&
test_complexMathFunc1_dev<hipDoubleComplex, double>(COMPLEX_MUL) &&
test_complexMathFunc1_dev<hipFloatComplex, float>(COMPLEX_DIV) &&
test_complexMathFunc1_dev<hipDoubleComplex, double>(COMPLEX_DIV) &&
test_complexMathFunc1_dev<hipFloatComplex, float>(COMPLEX_CONJ) &&
test_complexMathFunc1_dev<hipDoubleComplex, double>(COMPLEX_CONJ) &&
test_complexMathFunc2_dev<hipFloatComplex, float>(COMPLEX_REAL) &&
test_complexMathFunc2_dev<hipDoubleComplex, double>(COMPLEX_REAL) &&
test_complexMathFunc2_dev<hipFloatComplex, float>(COMPLEX_IMAG) &&
test_complexMathFunc2_dev<hipDoubleComplex, double>(COMPLEX_IMAG) &&
test_complexMathFunc2_dev<hipFloatComplex, float>(COMPLEX_SQABS) &&
test_complexMathFunc2_dev<hipDoubleComplex, double>(COMPLEX_SQABS) &&
test_complexMathFunc2_dev<hipFloatComplex, float>(COMPLEX_ABS) &&
test_complexMathFunc2_dev<hipDoubleComplex, double>(COMPLEX_ABS) &&
test_allcomplexMathFunc_host();
test_makehipComplex_dev<float2, float>() &&
test_makehipComplex_dev<hipDoubleComplex, double>() &&
test_makehipComplex_dev<double2, double>() &&
test_complexMathFunc1_dev<hipFloatComplex, float>(COMPLEX_ADD) &&
test_complexMathFunc1_dev<hipDoubleComplex, double>(COMPLEX_ADD) &&
test_complexMathFunc1_dev<hipFloatComplex, float>(COMPLEX_SUB) &&
test_complexMathFunc1_dev<hipDoubleComplex, double>(COMPLEX_SUB) &&
test_complexMathFunc1_dev<hipFloatComplex, float>(COMPLEX_MUL) &&
test_complexMathFunc1_dev<hipDoubleComplex, double>(COMPLEX_MUL) &&
test_complexMathFunc1_dev<hipFloatComplex, float>(COMPLEX_DIV) &&
test_complexMathFunc1_dev<hipDoubleComplex, double>(COMPLEX_DIV) &&
test_complexMathFunc1_dev<hipFloatComplex, float>(COMPLEX_CONJ) &&
test_complexMathFunc1_dev<hipDoubleComplex, double>(COMPLEX_CONJ) &&
test_complexMathFunc2_dev<hipFloatComplex, float>(COMPLEX_REAL) &&
test_complexMathFunc2_dev<hipDoubleComplex, double>(COMPLEX_REAL) &&
test_complexMathFunc2_dev<hipFloatComplex, float>(COMPLEX_IMAG) &&
test_complexMathFunc2_dev<hipDoubleComplex, double>(COMPLEX_IMAG) &&
test_complexMathFunc2_dev<hipFloatComplex, float>(COMPLEX_SQABS) &&
test_complexMathFunc2_dev<hipDoubleComplex, double>(COMPLEX_SQABS) &&
test_complexMathFunc2_dev<hipFloatComplex, float>(COMPLEX_ABS) &&
test_complexMathFunc2_dev<hipDoubleComplex, double>(COMPLEX_ABS) &&
test_allcomplexMathFunc_host();
REQUIRE(TestPassed == true);
}
@@ -58,9 +58,9 @@ std::string getName(enum CalcKind CK) {
case CK_##func: \
return std::complex<FloatT>(func(A));
template <typename FloatT>
__device__ __host__ std::complex<FloatT> calc(std::complex<FloatT> A, std::complex<FloatT> B,
enum CalcKind CK) {
template <typename FloatT> __device__ __host__ std::complex<FloatT> calc(std::complex<FloatT> A,
std::complex<FloatT> B,
enum CalcKind CK) {
switch (CK) {
case CK_add:
return A + B;
@@ -79,9 +79,8 @@ __device__ __host__ std::complex<FloatT> calc(std::complex<FloatT> A, std::compl
return A; // To prevent compile warning
}
template <typename FloatT>
__global__ void kernel(std::complex<FloatT>* A, std::complex<FloatT>* B, std::complex<FloatT>* C,
enum CalcKind CK) {
template <typename FloatT> __global__ void kernel(std::complex<FloatT>* A, std::complex<FloatT>* B,
std::complex<FloatT>* C, enum CalcKind CK) {
int tx = threadIdx.x + blockIdx.x * blockDim.x;
C[tx] = calc<FloatT>(A[tx], B[tx], CK);
}
@@ -725,7 +725,7 @@ bool run_erfinvf() {
TEST_CASE("Unit_hipDeviceTrigFunc_Float") {
bool result = false;
result = run_sincosf() && run_sincospif() && run_fdividef() && run_llrintf() && run_norm3df() &&
run_norm4df() && run_normf() && run_rnorm3df() && run_rnorm4df() && run_rnormf() &&
run_lroundf() && run_llroundf() && run_rintf() && run_rhypotf() && run_erfinvf();
run_norm4df() && run_normf() && run_rnorm3df() && run_rnorm4df() && run_rnormf() &&
run_lroundf() && run_llroundf() && run_rintf() && run_rhypotf() && run_erfinvf();
REQUIRE(result == true);
}
@@ -615,7 +615,7 @@ bool run_erfinv() {
TEST_CASE("Unit_hipTrigDeviceFunc_Double") {
bool result = false;
result = run_sincos() && run_sincospi() && run_llrint() && run_norm3d() && run_norm4d() &&
run_rnorm3d() && run_rnorm4d() && run_rnorm() && run_lround() && run_llround() &&
run_rint() && run_rhypot() && run_erfinv();
run_rnorm3d() && run_rnorm4d() && run_rnorm() && run_lround() && run_llround() &&
run_rint() && run_rhypot() && run_erfinv();
REQUIRE(result == true);
}
@@ -324,12 +324,12 @@ __device__ bool check_rnorm4d(double* A) {
__device__ bool check_rnormf(float* A) {
return (rnorm3df(A[0], A[1], A[2]) - rnormf(3, A) < 0.0001) &&
(rnorm4df(A[0], A[1], A[2], A[3]) - rnormf(4, A) < 0.0001);
(rnorm4df(A[0], A[1], A[2], A[3]) - rnormf(4, A) < 0.0001);
}
__device__ bool check_rnorm(double* A) {
return (rnorm3d(A[0], A[1], A[2]) - rnorm(3, A) < 0.0001) &&
(rnorm4d(A[0], A[1], A[2], A[3]) - rnorm(4, A) < 0.0001);
(rnorm4d(A[0], A[1], A[2], A[3]) - rnorm(4, A) < 0.0001);
}
__device__ bool check_sincospif() {
@@ -355,13 +355,13 @@ __device__ bool check_sincospi() {
}
__global__ void testFunctions(bool* result, float* Af, double* A) {
result[0] &= check_erfcinvf() && check_erfcxf() && check_erfcinvf() && check_erfcinv() &&
check_erfcx() && check_erfcinv() && check_fdividef() && check_fdivide() && check_modff() &&
check_modf() && check_nextafterf() && check_norm3df(Af) && check_norm3d(A) &&
check_norm4df(Af) && check_norm4d(A) && check_normcdff() && check_normcdf() &&
check_normcdfinvf() && check_normcdfinv() && check_rcbrtf() && check_rcbrt() &&
check_rhypotf() && check_rhypot() && check_rnorm3df(Af) && check_rnorm3d(A) &&
check_rnorm4df(Af) && check_rnorm4d(A) && check_rnormf(Af) && check_rnorm(A) &&
check_sincospif() && check_sincospi() && check_nextafter();
check_erfcx() && check_erfcinv() && check_fdividef() && check_fdivide() &&
check_modff() && check_modf() && check_nextafterf() && check_norm3df(Af) &&
check_norm3d(A) && check_norm4df(Af) && check_norm4d(A) && check_normcdff() &&
check_normcdf() && check_normcdfinvf() && check_normcdfinv() && check_rcbrtf() &&
check_rcbrt() && check_rhypotf() && check_rhypot() && check_rnorm3df(Af) &&
check_rnorm3d(A) && check_rnorm4df(Af) && check_rnorm4d(A) && check_rnormf(Af) &&
check_rnorm(A) && check_sincospif() && check_sincospi() && check_nextafter();
}
TEST_CASE("Unit_TestDevice_DoublePrecisionMathFunc") {
@@ -259,7 +259,7 @@ TEST_CASE("Unit_hipVectorTypes_test_on_device") {
REQUIRE(res == hipSuccess);
passed = passed &&
run_CheckSharedVectorTypes<
run_CheckSharedVectorTypes<
char1, char2, char3, char4, uchar1, uchar2, uchar3, uchar4, short1, short2, short3,
short4, ushort1, ushort2, ushort3, ushort4, int1, int2, int3, int4, uint1, uint2,
uint3, uint4, long1, long2, long3, long4, ulong1, ulong2, ulong3, ulong4, longlong1,
@@ -66,7 +66,7 @@ __global__ void vectoradd_char4(char4* a, const char4* bm, const char4* cm, int
int i = y * width + x;
if (i < (width * height)) {
a[i] = make_char4(bm[i].x, bm[i].y, bm[i].z, bm[i].w) +
make_char4(cm[i].x, cm[i].y, cm[i].z, cm[i].w);
make_char4(cm[i].x, cm[i].y, cm[i].z, cm[i].w);
}
}
@@ -315,7 +315,7 @@ TEST_CASE("Unit_Test_makechar_functionality") {
bool errors;
errors = dataTypesRunChar1<char1>() && dataTypesRunChar2<char2>() && dataTypesRunChar3<char3>() &&
dataTypesRunChar4<char4>();
dataTypesRunChar4<char4>();
REQUIRE(errors == true);
}
@@ -30,8 +30,7 @@ constexpr int NUM = WIDTH * HEIGHT;
constexpr int THREADS_PER_BLOCK_X = 8;
constexpr int THREADS_PER_BLOCK_Y = 8;
template <typename T>
__global__ void vectoradd_float(T* a, const T* bm, int width, int height)
template <typename T> __global__ void vectoradd_float(T* a, const T* bm, int width, int height)
{
int x = blockDim.x * blockIdx.x + threadIdx.x;
@@ -227,25 +226,26 @@ TEST_CASE("Unit_ldg") {
int errors;
errors = dataTypesRun<char, char>() | dataTypesRun<short, short>() | dataTypesRun<int, int>() |
dataTypesRun<long, long>() | dataTypesRun<long long, long long>() |
dataTypesRun<signed char, signed char>() | dataTypesRun<unsigned char, unsigned char>() |
dataTypesRun<unsigned short, unsigned short>() | dataTypesRun<unsigned int, unsigned int>() |
dataTypesRun<unsigned long, unsigned long>() |
dataTypesRun<unsigned long long, unsigned long long>() | dataTypesRun<float, float>() |
dataTypesRun<double, double>();
dataTypesRun<long, long>() | dataTypesRun<long long, long long>() |
dataTypesRun<signed char, signed char>() | dataTypesRun<unsigned char, unsigned char>() |
dataTypesRun<unsigned short, unsigned short>() |
dataTypesRun<unsigned int, unsigned int>() |
dataTypesRun<unsigned long, unsigned long>() |
dataTypesRun<unsigned long long, unsigned long long>() | dataTypesRun<float, float>() |
dataTypesRun<double, double>();
REQUIRE(errors == 0);
errors = dataTypesRun2<int2, int>() | dataTypesRun2<short2, short>() |
dataTypesRun2<ushort2, unsigned short>() | dataTypesRun2<char2, signed char>() |
dataTypesRun2<uchar2, unsigned char>() | dataTypesRun2<uint2, unsigned int>() |
dataTypesRun2<float2, float>() | dataTypesRun2<double2, double>();
dataTypesRun2<ushort2, unsigned short>() | dataTypesRun2<char2, signed char>() |
dataTypesRun2<uchar2, unsigned char>() | dataTypesRun2<uint2, unsigned int>() |
dataTypesRun2<float2, float>() | dataTypesRun2<double2, double>();
REQUIRE(errors == 0);
errors = dataTypesRun4<int4, int>() | dataTypesRun4<char4, signed char>() |
dataTypesRun4<uchar4, unsigned char>() | dataTypesRun4<short4, short>() |
dataTypesRun4<uint4, unsigned int>() | dataTypesRun4<float4, float>();
dataTypesRun4<uchar4, unsigned char>() | dataTypesRun4<short4, short>() |
dataTypesRun4<uint4, unsigned int>() | dataTypesRun4<float4, float>();
REQUIRE(errors == 0);
}
@@ -33,10 +33,10 @@ constexpr std::array<hipAccessProperty, 3> kAccessProperties{
static bool CompareAccessPolicyWindow(const hipKernelNodeAttrValue& lhs,
const hipKernelNodeAttrValue& rhs) {
return lhs.accessPolicyWindow.base_ptr == rhs.accessPolicyWindow.base_ptr &&
lhs.accessPolicyWindow.num_bytes == rhs.accessPolicyWindow.num_bytes &&
lhs.accessPolicyWindow.hitRatio == rhs.accessPolicyWindow.hitRatio &&
lhs.accessPolicyWindow.hitProp == rhs.accessPolicyWindow.hitProp &&
lhs.accessPolicyWindow.missProp == rhs.accessPolicyWindow.missProp;
lhs.accessPolicyWindow.num_bytes == rhs.accessPolicyWindow.num_bytes &&
lhs.accessPolicyWindow.hitRatio == rhs.accessPolicyWindow.hitRatio &&
lhs.accessPolicyWindow.hitProp == rhs.accessPolicyWindow.hitProp &&
lhs.accessPolicyWindow.missProp == rhs.accessPolicyWindow.missProp;
}
TEST_CASE("Unit_hipGraphKernelNodeSetAttribute_Positive_AccessPolicyWindow") {
@@ -37,9 +37,9 @@ HIP_GRAPH_MEMCPY_FROM_SYMBOL_NODE_DEFINE_ALTERNATE_GLOBALS(int)
HIP_GRAPH_MEMCPY_FROM_SYMBOL_NODE_DEFINE_ALTERNATE_GLOBALS(float)
HIP_GRAPH_MEMCPY_FROM_SYMBOL_NODE_DEFINE_ALTERNATE_GLOBALS(double)
template <typename T>
void GraphMemcpyToSymbolSetParamsShell(const void* symbol, const void* alt_symbol, size_t offset,
const std::vector<T> set_values) {
template <typename T> void GraphMemcpyToSymbolSetParamsShell(const void* symbol,
const void* alt_symbol, size_t offset,
const std::vector<T> set_values) {
const auto f = [alt_symbol, is_arr = set_values.size() > 1](const void* symbol, void* src,
size_t count, size_t offset,
hipMemcpyKind direction) {
@@ -861,14 +861,12 @@ TEST_CASE("Unit_hipStreamBeginCaptureToGraph_Negative") {
HIP_CHECK(hipStreamCreate(&stream));
HIP_CHECK(hipGraphCreate(&graph, 0));
SECTION("Null graph") {
REQUIRE(hipErrorInvalidValue ==
hipStreamBeginCaptureToGraph(stream, nullptr, nullptr, nullptr, 0,
hipStreamCaptureModeGlobal));
REQUIRE(hipErrorInvalidValue == hipStreamBeginCaptureToGraph(stream, nullptr, nullptr, nullptr,
0, hipStreamCaptureModeGlobal));
}
SECTION("Null dependencies") {
REQUIRE(hipErrorInvalidValue ==
hipStreamBeginCaptureToGraph(stream, graph, nullptr, nullptr, 1,
hipStreamCaptureModeGlobal));
REQUIRE(hipErrorInvalidValue == hipStreamBeginCaptureToGraph(stream, graph, nullptr, nullptr, 1,
hipStreamCaptureModeGlobal));
}
SECTION("Invalid mode") {
REQUIRE(hipErrorInvalidValue ==
@@ -39,9 +39,9 @@ __device__ void sum(T* sdata, unsigned groupElements, unsigned tid) {
__syncthreads();
}
template <typename T>
__global__ void testExternSharedKernel(const T* A_d, const T* B_d, T* C_d, size_t numElements,
size_t groupElements) {
template <typename T> __global__ void testExternSharedKernel(const T* A_d, const T* B_d, T* C_d,
size_t numElements,
size_t groupElements) {
// declare dynamic shared memory
extern __shared__ double sdata0[];
T* sdata = reinterpret_cast<T*>(sdata0);
@@ -651,9 +651,8 @@ TEST_CASE("Unit_Device___mul64hi_Sanity_Positive") {
INFO("x1: " << x1);
INFO("x2: " << x2);
REQUIRE(
y.ptr()[0] ==
static_cast<long long>((static_cast<__int128_t>(x1) * static_cast<__int128_t>(x2)) >> 64));
REQUIRE(y.ptr()[0] == static_cast<long long>(
(static_cast<__int128_t>(x1) * static_cast<__int128_t>(x2)) >> 64));
}
__global__ void __umul64hi_kernel(unsigned long long* y, unsigned long long x1,
@@ -685,9 +684,8 @@ TEST_CASE("Unit_Device___umul64hi_Sanity_Positive") {
INFO("x1: " << x1);
INFO("x2: " << x2);
REQUIRE(y.ptr()[0] ==
static_cast<unsigned long long>(
(static_cast<__uint128_t>(x1) * static_cast<__uint128_t>(x2)) >> 64));
REQUIRE(y.ptr()[0] == static_cast<unsigned long long>(
(static_cast<__uint128_t>(x1) * static_cast<__uint128_t>(x2)) >> 64));
}
__global__ void __sad_kernel(unsigned int* y, int x1, int x2, unsigned int x3) {
@@ -749,10 +747,9 @@ TEST_CASE("Unit_Device___usad_Sanity_Positive") {
INFO("x1: " << x1);
INFO("x2: " << x2);
REQUIRE(y.ptr()[0] ==
(static_cast<unsigned int>(
std::abs(static_cast<long long>(x1) - static_cast<long long>(x2))) +
x3));
REQUIRE(y.ptr()[0] == (static_cast<unsigned int>(
std::abs(static_cast<long long>(x1) - static_cast<long long>(x2))) +
x3));
}
__global__ void __byte_perm(unsigned int* y, unsigned int x1, unsigned int x2, unsigned int s) {
@@ -85,9 +85,9 @@ LONG_CONVERSION_FUNCTION_TEST_DEF(llround, std::llround, long long)
TEST_CASE("Unit_Device_llround_llroundf_Negative_RTC") { NegativeTestRTCWrapper<4>(kLlround); }
template <typename T>
__global__ void remquo_kernel(std::pair<T, int>* const ys, const size_t num_xs, T* const x1s,
T* const x2s) {
template <typename T> __global__ void remquo_kernel(std::pair<T, int>* const ys,
const size_t num_xs, T* const x1s,
T* const x2s) {
const auto tid = cg::this_grid().thread_rank();
const auto stride = cg::this_grid().size();
@@ -69,9 +69,8 @@ template <typename T> class DrvMemcpy3DAsync {
};
/* Intializes class variables */
template <typename T>
DrvMemcpy3DAsync<T>::DrvMemcpy3DAsync(int l_width, int l_height, int l_depth,
hipArray_Format l_format) {
template <typename T> DrvMemcpy3DAsync<T>::DrvMemcpy3DAsync(int l_width, int l_height, int l_depth,
hipArray_Format l_format) {
width = l_width;
height = l_height;
depth = l_depth;
@@ -6041,7 +6041,7 @@ TEST_CASE("Unit_hipGetProcAddress_MemoryApisPeerToPeer") {
HIP_CHECK(hipDeviceCanAccessPeer(&canAccessPeer, deviceId, peerDeviceId));
if (!canAccessPeer) {
std::string msg = "Skipped as peer access cannot be enabled between devices " +
std::to_string(deviceId) + " " + std::to_string(peerDeviceId);
std::to_string(deviceId) + " " + std::to_string(peerDeviceId);
HipTest::HIP_SKIP_TEST(msg.c_str());
return;
}
@@ -23,12 +23,12 @@ THE SOFTWARE.
#include <hip_test_common.hh>
namespace hipHostUnregisterTests {
constexpr unsigned int allFlags = hipHostRegisterDefault & // 0
hipHostRegisterPortable & // 1
hipHostRegisterMapped & // 2
hipHostRegisterIoMemory // 4
constexpr unsigned int allFlags = hipHostRegisterDefault & // 0
hipHostRegisterPortable & // 1
hipHostRegisterMapped & // 2
hipHostRegisterIoMemory // 4
#if HT_NVIDIA
& cudaHostRegisterReadOnly; // 8
& cudaHostRegisterReadOnly; // 8
#else
;
#endif
@@ -27,9 +27,8 @@
* - Sets attributes of a memory pool
*/
template <typename T>
static void MemPoolSetGetAttribute(const hipMemPool_t mempool, const hipMemPoolAttr attr,
T& set_value) {
template <typename T> static void MemPoolSetGetAttribute(const hipMemPool_t mempool,
const hipMemPoolAttr attr, T& set_value) {
T get_value = 100;
HIP_CHECK(hipMemPoolSetAttribute(mempool, attr, &set_value));
HIP_CHECK(hipMemPoolGetAttribute(mempool, attr, &get_value));
@@ -77,9 +77,8 @@ template <typename T> void Memcpy3DAsync<T>::SetDefaultData() {
/*
* Constructor initalized width,depth and height
*/
template <typename T>
Memcpy3DAsync<T>::Memcpy3DAsync(int l_width, int l_height, int l_depth,
hipChannelFormatKind l_format) {
template <typename T> Memcpy3DAsync<T>::Memcpy3DAsync(int l_width, int l_height, int l_depth,
hipChannelFormatKind l_format) {
width = l_width;
height = l_height;
depth = l_depth;
@@ -76,9 +76,8 @@ template <typename T> void Memcpy3D<T>::SetDefaultData() {
/*
* Constructor initalized width,depth and height
*/
template <typename T>
Memcpy3D<T>::Memcpy3D(size_t l_width, size_t l_height, size_t l_depth,
hipChannelFormatKind l_format) {
template <typename T> Memcpy3D<T>::Memcpy3D(size_t l_width, size_t l_height, size_t l_depth,
hipChannelFormatKind l_format) {
width = l_width;
height = l_height;
depth = l_depth;
@@ -68,8 +68,8 @@ enum class ops {
};
struct joinable_thread : std::thread {
template <class... Xs>
explicit joinable_thread(Xs&&... xs) : std::thread(std::forward<Xs>(xs)...) {} // NOLINT
template <class... Xs> explicit joinable_thread(Xs&&... xs)
: std::thread(std::forward<Xs>(xs)...) {} // NOLINT
joinable_thread& operator=(joinable_thread&& other) = default;
joinable_thread(joinable_thread&& other) = default;
@@ -65,8 +65,8 @@ template <typename T> class DeviceMemory {
int _offset;
};
template <typename T>
DeviceMemory<T>::DeviceMemory(size_t numElements) : _maxNumElements(numElements), _offset(0) {
template <typename T> DeviceMemory<T>::DeviceMemory(size_t numElements)
: _maxNumElements(numElements), _offset(0) {
T** np = nullptr;
HipTest::initArrays(&_A_d, &_B_d, &_C_d, np, np, np, numElements, 0);
size_t sizeElements = numElements * sizeof(T);
@@ -110,8 +110,7 @@ template <typename T> class HostMemory {
T* _C_h;
};
template <typename T>
HostMemory<T>::HostMemory(size_t numElements, bool usePinnedHost)
template <typename T> HostMemory<T>::HostMemory(size_t numElements, bool usePinnedHost)
: _usePinnedHost(usePinnedHost), _maxNumElements(numElements), _offset(0) {
T** np = nullptr;
HipTest::initArrays(np, np, np, &_A_h, &_B_h, &_C_h, numElements, usePinnedHost);
@@ -199,9 +198,9 @@ void memcpytest2_get_host_memory(size_t* free, size_t* total) {
// (runtime figures out direction). if false, use
// explicit memcpy direction.
//
template <typename T>
void memcpytest2(DeviceMemory<T>* dmem, HostMemory<T>* hmem, size_t numElements, bool useHostToHost,
bool useDeviceToDevice, bool useMemkindDefault) {
template <typename T> void memcpytest2(DeviceMemory<T>* dmem, HostMemory<T>* hmem,
size_t numElements, bool useHostToHost,
bool useDeviceToDevice, bool useMemkindDefault) {
size_t sizeElements = numElements * sizeof(T);
hmem->reset(numElements);
@@ -82,9 +82,8 @@ static bool testhipMemset(T* A_h, T* A_d, T memsetval, enum MemsetType type, siz
}
template <typename T>
static bool testhipMemsetAsync(T* A_h, T* A_d, T memsetval, enum MemsetType type,
size_t numElements) {
template <typename T> static bool testhipMemsetAsync(T* A_h, T* A_d, T memsetval,
enum MemsetType type, size_t numElements) {
size_t Nbytes = numElements * sizeof(T);
bool testResult = true;
constexpr auto MAX_OFFSET = 3; // To memset on unaligned ptr.
@@ -34,9 +34,8 @@ constexpr int testValue2 = 98;
using namespace mem_utils;
// Helper function to run tests for hipMemset allocation types
template <typename T>
void runAsyncTests(hipStream_t stream, allocType type, memType memType, MultiDData data1,
MultiDData data2) {
template <typename T> void runAsyncTests(hipStream_t stream, allocType type, memType memType,
MultiDData data1, MultiDData data2) {
std::pair<T*, T*> aPtr{};
MultiDData totalRange;
totalRange.width = data1.width + data2.width;
@@ -61,9 +60,8 @@ void runAsyncTests(hipStream_t stream, allocType type, memType memType, MultiDDa
}
}
template <typename T>
static void doMemsetTest(allocType mallocType, memType memset_type, MultiDData data1,
MultiDData data2) {
template <typename T> static void doMemsetTest(allocType mallocType, memType memset_type,
MultiDData data1, MultiDData data2) {
enum StreamType { NULLSTR, CREATEDSTR };
auto streamType = GENERATE(NULLSTR, CREATEDSTR);
hipStream_t stream{nullptr};
@@ -182,9 +182,8 @@ DEFINE_1D_BASIC_TEST_CASE("ZeroSize_hipMemsetD8", hipMemsetTypeD8, int8_t, 0x1,
// Helper function that sets a full region of memory with an initial value, sets a smaller subregion
// with another value and check that the memset API do not write outside of the subregion of data.
template <typename T>
void partialMemsetTest(T valA, T valB, size_t count, size_t offset, MemsetType memsetType,
bool async) {
template <typename T> void partialMemsetTest(T valA, T valB, size_t count, size_t offset,
MemsetType memsetType, bool async) {
T* devPtr;
size_t subSize{count - offset};
HIP_CHECK(hipMalloc(&devPtr, count * sizeof(T)));
@@ -250,9 +249,8 @@ void check_device_data_2D(T* devPtr, T value, size_t pitch, size_t width, size_t
// Helper function for allocating memory, setting data with the specified 2D memset API and then
// checking result of operation.
template <typename T>
void checkMemset2D(T value, size_t width, size_t height, bool async = false, size_t pitch = 0,
T* devPtr = nullptr) {
template <typename T> void checkMemset2D(T value, size_t width, size_t height, bool async = false,
size_t pitch = 0, T* devPtr = nullptr) {
hipStream_t stream{nullptr};
HIP_CHECK(hipStreamCreate(&stream));
constexpr size_t elementSize = sizeof(T);
@@ -342,9 +340,9 @@ TEST_CASE("Unit_hipMemsetFunctional_ZeroSize_2D") {
// Helper function that sets a full region of memory with an initial value, sets a smaller subregion
// with another value and check that the memset API do not write outside of the subregion of data.
template <typename T>
void partialMemsetTest2D(T valA, T valB, size_t width, size_t height, size_t widthOffset,
size_t heightOffset, bool async) {
template <typename T> void partialMemsetTest2D(T valA, T valB, size_t width, size_t height,
size_t widthOffset, size_t heightOffset,
bool async) {
T* devPtr{nullptr};
size_t pitch{0};
size_t subWidth{width - widthOffset};
@@ -218,7 +218,7 @@ TEST_CASE("Unit_hipMemset3D_Negative_OutOfBounds") {
HIP_CHECK(hipMalloc3D(&pitchedDevPtr, validExtent));
hipPitchedPtr outOfBoundsPtr{pitchedDevPtr};
outOfBoundsPtr.ptr = reinterpret_cast<char*>(pitchedDevPtr.ptr) +
pitchedDevPtr.pitch * validExtent.height * validExtent.depth + 1;
pitchedDevPtr.pitch * validExtent.height * validExtent.depth + 1;
SECTION("Extent Equal to 0") {
hipExtent zeroExtent{0, 0, 0};
@@ -51,9 +51,9 @@ struct MultiDData {
};
// set of helper functions to tidy the nested switch statements
template <typename T>
static std::pair<T*, T*> deviceMallocHelper(memSetType memType, size_t dataW, size_t dataH,
size_t dataD, size_t& dataPitch) {
template <typename T> static std::pair<T*, T*> deviceMallocHelper(memSetType memType, size_t dataW,
size_t dataH, size_t dataD,
size_t& dataPitch) {
size_t elementSize = sizeof(T);
size_t sizeInBytes = elementSize * dataW * dataH * dataD;
T* aPtr{};
@@ -88,9 +88,8 @@ static std::pair<T*, T*> deviceMallocHelper(memSetType memType, size_t dataW, si
return std::make_pair(aPtr, nullptr);
}
template <typename T>
static std::pair<T*, T*> hostMallocHelper(size_t dataW, size_t dataH, size_t dataD,
size_t& dataPitch) {
template <typename T> static std::pair<T*, T*> hostMallocHelper(size_t dataW, size_t dataH,
size_t dataD, size_t& dataPitch) {
size_t elementSize = sizeof(T);
size_t sizeInBytes = elementSize * dataW * dataH * dataD;
T* aPtr;
@@ -101,9 +100,9 @@ static std::pair<T*, T*> hostMallocHelper(size_t dataW, size_t dataH, size_t dat
return std::make_pair(aPtr, nullptr);
}
template <typename T>
static std::pair<T*, T*> hostRegisteredHelper(size_t dataW, size_t dataH, size_t dataD,
size_t& dataPitch) {
template <typename T> static std::pair<T*, T*> hostRegisteredHelper(size_t dataW, size_t dataH,
size_t dataD,
size_t& dataPitch) {
size_t elementSize = sizeof(T);
size_t sizeInBytes = elementSize * dataW * dataH * dataD;
T* aPtr = new T[dataW * dataH * dataD];
@@ -114,9 +113,9 @@ static std::pair<T*, T*> hostRegisteredHelper(size_t dataW, size_t dataH, size_t
return std::make_pair(aPtr, nullptr);
}
template <typename T>
static std::pair<T*, T*> devRegisteredHelper(size_t dataW, size_t dataH, size_t dataD,
size_t& dataPitch) {
template <typename T> static std::pair<T*, T*> devRegisteredHelper(size_t dataW, size_t dataH,
size_t dataD,
size_t& dataPitch) {
size_t elementSize = sizeof(T);
size_t sizeInBytes = elementSize * dataW * dataH * dataD;
T* aPtr = new T[dataW * dataH * dataD];
@@ -164,9 +163,9 @@ static std::pair<T*, T*> initMemory(allocType type, memSetType memType, MultiDDa
}
// set of helper functions to tidy the nested switch statements
template <typename T>
static void deviceMallocCopy(memSetType memType, T* aPtr, T* hostMem, size_t dataW, size_t dataH,
size_t dataD, size_t& dataPitch) {
template <typename T> static void deviceMallocCopy(memSetType memType, T* aPtr, T* hostMem,
size_t dataW, size_t dataH, size_t dataD,
size_t& dataPitch) {
size_t elementSize = sizeof(T);
size_t sizeInBytes = elementSize * dataW * dataH * dataD;
switch (memType) {
@@ -200,9 +199,8 @@ static void deviceMallocCopy(memSetType memType, T* aPtr, T* hostMem, size_t dat
}
}
template <typename T>
static void hostCopy(memSetType memType, T* aPtr, T* hostMem, size_t dataW, size_t dataH,
size_t dataD, size_t& dataPitch) {
template <typename T> static void hostCopy(memSetType memType, T* aPtr, T* hostMem, size_t dataW,
size_t dataH, size_t dataD, size_t& dataPitch) {
size_t elementSize = sizeof(T);
size_t sizeInBytes = elementSize * dataW * dataH * dataD;
hipMemcpy3DParms params{};
@@ -236,9 +234,9 @@ static void hostCopy(memSetType memType, T* aPtr, T* hostMem, size_t dataW, size
}
}
template <typename T>
static void devRegisteredCopy(memSetType memType, T* aPtr, T* hostMem, size_t dataW, size_t dataH,
size_t dataD, size_t& dataPitch) {
template <typename T> static void devRegisteredCopy(memSetType memType, T* aPtr, T* hostMem,
size_t dataW, size_t dataH, size_t dataD,
size_t& dataPitch) {
size_t elementSize = sizeof(T);
switch (memType) {
@@ -309,9 +307,9 @@ void verifyData(T* aPtr, size_t value, MultiDData& data, allocType type, memSetT
}
// macro to allow reuse of functions for testing versions of hipMemset
template <typename T>
void memsetCheck(T* aPtr, size_t value, memSetType memsetType, MultiDData& data, bool async = false,
hipStream_t stream = nullptr) {
template <typename T> void memsetCheck(T* aPtr, size_t value, memSetType memsetType,
MultiDData& data, bool async = false,
hipStream_t stream = nullptr) {
size_t dataW = data.width;
size_t dataH = data.height == 0 ? 1 : data.height;
size_t dataD = data.depth == 0 ? 1 : data.depth;
@@ -160,9 +160,9 @@ TEST_CASE("Unit_hipExtModuleLaunchKernel_NonUniformWorkGroup") {
HIP_LAUNCH_PARAM_END};
// Memcpy from A to Ad
HIP_CHECK(hipMemcpy(Ad, A, sizeBytes, hipMemcpyDefault));
REQUIRE(hipErrorInvalidValue ==
hipExtModuleLaunchKernel(Function, arraylength, 1, 1, localWorkSize, 1, 1, 0, 0, NULL,
reinterpret_cast<void**>(&config), 0));
REQUIRE(hipErrorInvalidValue == hipExtModuleLaunchKernel(Function, arraylength, 1, 1,
localWorkSize, 1, 1, 0, 0, NULL,
reinterpret_cast<void**>(&config), 0));
HIP_CHECK(hipDeviceSynchronize());
HIP_CHECK(hipFree(Ad));
HIP_CHECK(hipFree(Bd));
@@ -32,5 +32,5 @@ __device__ int getSquareOfGlobalFloat() {
extern "C" __global__ void testWeightedCopy(int* a, int* b) {
int tx = threadIdx.x;
b[tx] = deviceGlobalInt1 * a[tx] + deviceGlobalInt2 + static_cast<int>(deviceGlobalShort) +
static_cast<int>(deviceGlobalChar) + getSquareOfGlobalFloat();
static_cast<int>(deviceGlobalChar) + getSquareOfGlobalFloat();
}
@@ -110,10 +110,9 @@ bool testhipModuleLoadUnloadFunc(const std::vector<char>& buffer, char* globTest
// Check the results
for (size_t idx = 0; idx < N; idx++) {
if (B_h[idx] !=
(deviceGlobalInt1H * A_h[idx] + deviceGlobalInt2H + static_cast<int>(deviceGlobalShortH) +
+static_cast<int>(deviceGlobalCharH) +
static_cast<int>(deviceGlobalFloatH * deviceGlobalFloatH))) {
if (B_h[idx] != (deviceGlobalInt1H * A_h[idx] + deviceGlobalInt2H +
static_cast<int>(deviceGlobalShortH) + +static_cast<int>(deviceGlobalCharH) +
static_cast<int>(deviceGlobalFloatH * deviceGlobalFloatH))) {
// exit the current process with failure
return false;
}
@@ -35,19 +35,15 @@ enum TestType { SameStream = 0, DifferentStreams };
// allocated buffer
template <typename Func, typename T> void threadCall(Func f, hipStream_t stream) {
// Should match hipMemsetAsync or hipMemsetD*Async arguments
static_assert(
(std::is_same<Func,
hipError_t (*)(void*, int, size_t, hipStream_t)>::value || // hipMemsetAsync
std::is_same<Func,
hipError_t (*)(hipDeviceptr_t, int, size_t,
hipStream_t)>::value || // hipMemsetD32Async
std::is_same<Func,
hipError_t (*)(hipDeviceptr_t, unsigned short, size_t,
hipStream_t)>::value || // hipMemsetD16Async
std::is_same<Func,
hipError_t (*)(hipDeviceptr_t, unsigned char, size_t,
hipStream_t)>::value) && // hipMemsetD8Async
"Func f should be hipMemsetAsync or hipMemsetD*Async");
static_assert((std::is_same<Func, hipError_t (*)(void*, int, size_t,
hipStream_t)>::value || // hipMemsetAsync
std::is_same<Func, hipError_t (*)(hipDeviceptr_t, int, size_t,
hipStream_t)>::value || // hipMemsetD32Async
std::is_same<Func, hipError_t (*)(hipDeviceptr_t, unsigned short, size_t,
hipStream_t)>::value || // hipMemsetD16Async
std::is_same<Func, hipError_t (*)(hipDeviceptr_t, unsigned char, size_t,
hipStream_t)>::value) && // hipMemsetD8Async
"Func f should be hipMemsetAsync or hipMemsetD*Async");
constexpr bool cast_2_void =
std::is_same<Func, hipError_t (*)(void*, int, size_t, hipStream_t)>::value;
@@ -104,25 +100,21 @@ template <typename Func, typename T> void launchThreads(Func f, TestType type) {
static_assert(!std::is_pointer<T>::value && "Argument cant be a pointer");
// Should match hipMemsetAsync or hipMemsetD*Async arguments
static_assert(
(std::is_same<Func,
hipError_t (*)(void*, int, size_t, hipStream_t)>::value || // hipMemsetAsync
std::is_same<Func,
hipError_t (*)(hipDeviceptr_t, int, size_t,
hipStream_t)>::value || // hipMemsetD32Async
std::is_same<Func,
hipError_t (*)(hipDeviceptr_t, unsigned short, size_t,
hipStream_t)>::value || // hipMemsetD16Async
std::is_same<Func,
hipError_t (*)(hipDeviceptr_t, unsigned char, size_t,
hipStream_t)>::value) && // hipMemsetD8Async
"Func f should be hipMemsetAsync or hipMemsetD*Async");
static_assert((std::is_same<Func, hipError_t (*)(void*, int, size_t,
hipStream_t)>::value || // hipMemsetAsync
std::is_same<Func, hipError_t (*)(hipDeviceptr_t, int, size_t,
hipStream_t)>::value || // hipMemsetD32Async
std::is_same<Func, hipError_t (*)(hipDeviceptr_t, unsigned short, size_t,
hipStream_t)>::value || // hipMemsetD16Async
std::is_same<Func, hipError_t (*)(hipDeviceptr_t, unsigned char, size_t,
hipStream_t)>::value) && // hipMemsetD8Async
"Func f should be hipMemsetAsync or hipMemsetD*Async");
const size_t num_threads = (std::thread::hardware_concurrency() > 8)
? (((std::thread::hardware_concurrency() / 4) >= 127)
? 127
: (std::thread::hardware_concurrency() / 4))
: 2; // thread count between 2 - 127
? (((std::thread::hardware_concurrency() / 4) >= 127)
? 127
: (std::thread::hardware_concurrency() / 4))
: 2; // thread count between 2 - 127
const size_t num_streams = (type == SameStream) ? 1 : num_threads;
std::vector<hipStream_t> streams(num_streams, nullptr);
@@ -63,7 +63,7 @@ TEST_CASE("Unit_hiprtc_test_hip_bfloat16") {
std::string sarg = std::string("--gpu-architecture=") + props.gcnArchName;
#else
std::string sarg = std::string("--gpu-architecture=compute_") + std::to_string(props.major) +
std::to_string(props.minor);
std::to_string(props.minor);
#endif
vector<const char*> opts;
opts.push_back(sarg.c_str());
@@ -163,7 +163,7 @@ void runAndCompileTest(const std::tuple<Types...> types) {
// call the operator only if the lane is mentioned in the mask
T& result = output[warpSize * i + tid];
result = )" +
intrinsicName + R"((masks[i], input[tid]);
intrinsicName + R"((masks[i], input[tid]);
}
}
})";
@@ -55,7 +55,7 @@ TEST_CASE("Unit_hiprtc_warpsize") {
std::string sarg = std::string("--gpu-architecture=") + props.gcnArchName;
#else
std::string sarg = std::string("--gpu-architecture=compute_") + std::to_string(props.major) +
std::to_string(props.minor);
std::to_string(props.minor);
#endif
vector<const char*> opts;
opts.push_back(sarg.c_str());
@@ -41,8 +41,7 @@ template <typename UIntT, typename... Args> auto writeFunc(Args... args) {
// Random predefined 32 and 64 bit values
using value32_t = std::integral_constant<uint32_t, 0x70F0F0FF>;
using value64_t = std::integral_constant<uint64_t, 0x7FFF0000FFFF0000>;
template <typename UIntT>
using testValue =
template <typename UIntT> using testValue =
typename std::conditional<std::is_same<UIntT, uint32_t>::value, value32_t, value64_t>::type;
constexpr uint32_t DATA_INIT = 0x1234;
@@ -387,18 +386,14 @@ DEFINE_STREAM_WAIT_VAL_TEST_CASES_INT32("Mask_And",
hipStreamWaitValueAnd, 0xFF, 0xF4A, 0xF35, 0X02))
// Not Using Mask
DEFINE_STREAM_WAIT_VAL_TEST_CASES_INT32("NoMask_Eq",
TEST_WAIT32(hipStreamWaitValueEq, 0x7FFFFFFF, 0x7FFF0000,
0x7FFFFFFF))
DEFINE_STREAM_WAIT_VAL_TEST_CASES_INT32("NoMask_Gte",
TEST_WAIT32(hipStreamWaitValueGte, 0x7FFF0001, 0x7FFF0000,
0x7FFF0010))
DEFINE_STREAM_WAIT_VAL_TEST_CASES_INT32("NoMask_And",
TEST_WAIT32(hipStreamWaitValueAnd, 0x70F0F0F0, 0x0F0F0F0F,
0X1F0F0F0F))
DEFINE_STREAM_WAIT_VAL_TEST_CASES_INT32("NoMask_Nor",
TEST_WAIT32(hipStreamWaitValueNor, 0x7AAAAAAA, 0x85555555,
0x9AAAAAAA))
DEFINE_STREAM_WAIT_VAL_TEST_CASES_INT32("NoMask_Eq", TEST_WAIT32(hipStreamWaitValueEq, 0x7FFFFFFF,
0x7FFF0000, 0x7FFFFFFF))
DEFINE_STREAM_WAIT_VAL_TEST_CASES_INT32("NoMask_Gte", TEST_WAIT32(hipStreamWaitValueGte, 0x7FFF0001,
0x7FFF0000, 0x7FFF0010))
DEFINE_STREAM_WAIT_VAL_TEST_CASES_INT32("NoMask_And", TEST_WAIT32(hipStreamWaitValueAnd, 0x70F0F0F0,
0x0F0F0F0F, 0X1F0F0F0F))
DEFINE_STREAM_WAIT_VAL_TEST_CASES_INT32("NoMask_Nor", TEST_WAIT32(hipStreamWaitValueNor, 0x7AAAAAAA,
0x85555555, 0x9AAAAAAA))
#undef DEFINE_STREAM_WAIT_VAL_TEST_CASES_INT32
@@ -53,9 +53,8 @@ __global__ void surf1DKernelW(hipSurfaceObject_t surfaceObject, T* inputData, in
#endif
}
template <typename T>
__global__ void surf1DKernelRW(hipSurfaceObject_t surfaceObject, hipSurfaceObject_t outputSurfObj,
int width) {
template <typename T> __global__ void surf1DKernelRW(hipSurfaceObject_t surfaceObject,
hipSurfaceObject_t outputSurfObj, int width) {
#if !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
if (x < width) {
@@ -53,9 +53,9 @@ __global__ void surf1DLayeredKernelW(hipSurfaceObject_t surfaceObject, T* inputD
#endif
}
template <typename T>
__global__ void surf1DLayeredKernelRW(hipSurfaceObject_t surfaceObject,
hipSurfaceObject_t outputSurfObj, int width) {
template <typename T> __global__ void surf1DLayeredKernelRW(hipSurfaceObject_t surfaceObject,
hipSurfaceObject_t outputSurfObj,
int width) {
#if !defined(__HIP_NO_IMAGE_SUPPORT) || !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
if (x < width) {
@@ -35,9 +35,8 @@ THE SOFTWARE.
#define LOG_DATA 0
template <typename T>
__global__ void surf2DKernelR(hipSurfaceObject_t surfaceObject, T* outputData, int width,
int height) {
template <typename T> __global__ void surf2DKernelR(hipSurfaceObject_t surfaceObject, T* outputData,
int width, int height) {
#if !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -47,9 +46,8 @@ __global__ void surf2DKernelR(hipSurfaceObject_t surfaceObject, T* outputData, i
#endif
}
template <typename T>
__global__ void surf2DKernelW(hipSurfaceObject_t surfaceObject, T* inputData, int width,
int height) {
template <typename T> __global__ void surf2DKernelW(hipSurfaceObject_t surfaceObject, T* inputData,
int width, int height) {
#if !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -59,9 +57,9 @@ __global__ void surf2DKernelW(hipSurfaceObject_t surfaceObject, T* inputData, in
#endif
}
template <typename T>
__global__ void surf2DKernelRW(hipSurfaceObject_t surfaceObject, hipSurfaceObject_t outputSurfObj,
int width, int height) {
template <typename T> __global__ void surf2DKernelRW(hipSurfaceObject_t surfaceObject,
hipSurfaceObject_t outputSurfObj, int width,
int height) {
#if !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -35,9 +35,8 @@ THE SOFTWARE.
#define LOG_DATA 0
template <typename T>
__global__ void surf2DLayeredKernelR(hipSurfaceObject_t surfaceObject, T* outputData, int width,
int height) {
template <typename T> __global__ void surf2DLayeredKernelR(hipSurfaceObject_t surfaceObject,
T* outputData, int width, int height) {
#if !defined(__HIP_NO_IMAGE_SUPPORT) || !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -47,9 +46,8 @@ __global__ void surf2DLayeredKernelR(hipSurfaceObject_t surfaceObject, T* output
#endif
}
template <typename T>
__global__ void surf2DLayeredKernelW(hipSurfaceObject_t surfaceObject, T* inputData, int width,
int height) {
template <typename T> __global__ void surf2DLayeredKernelW(hipSurfaceObject_t surfaceObject,
T* inputData, int width, int height) {
#if !defined(__HIP_NO_IMAGE_SUPPORT) || !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -59,9 +57,9 @@ __global__ void surf2DLayeredKernelW(hipSurfaceObject_t surfaceObject, T* inputD
#endif
}
template <typename T>
__global__ void surf2DLayeredKernelRW(hipSurfaceObject_t surfaceObject,
hipSurfaceObject_t outputSurfObj, int width, int height) {
template <typename T> __global__ void surf2DLayeredKernelRW(hipSurfaceObject_t surfaceObject,
hipSurfaceObject_t outputSurfObj,
int width, int height) {
#if !defined(__HIP_NO_IMAGE_SUPPORT) || !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -33,9 +33,8 @@ THE SOFTWARE.
#pragma clang diagnostic ignored "-Wunused-variable"
#pragma clang diagnostic ignored "-Wunused-parameter"
template <typename T>
__global__ void surf3DKernelR(hipSurfaceObject_t surfaceObject, T* outputData, int width,
int height, int depth) {
template <typename T> __global__ void surf3DKernelR(hipSurfaceObject_t surfaceObject, T* outputData,
int width, int height, int depth) {
#if !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -46,9 +45,8 @@ __global__ void surf3DKernelR(hipSurfaceObject_t surfaceObject, T* outputData, i
#endif
}
template <typename T>
__global__ void surf3DKernelW(hipSurfaceObject_t surfaceObject, T* inputData, int width, int height,
int depth) {
template <typename T> __global__ void surf3DKernelW(hipSurfaceObject_t surfaceObject, T* inputData,
int width, int height, int depth) {
#if !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -59,9 +57,9 @@ __global__ void surf3DKernelW(hipSurfaceObject_t surfaceObject, T* inputData, in
#endif
}
template <typename T>
__global__ void surf3DKernelRW(hipSurfaceObject_t surfaceObject, hipSurfaceObject_t outputSurfObj,
int width, int height, int depth) {
template <typename T> __global__ void surf3DKernelRW(hipSurfaceObject_t surfaceObject,
hipSurfaceObject_t outputSurfObj, int width,
int height, int depth) {
#if !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -35,9 +35,8 @@ THE SOFTWARE.
#define LOG_DATA 0
template <typename T>
__global__ void surfCubemapKernelR(hipSurfaceObject_t surfaceObject, T* outputData, int width,
int height) {
template <typename T> __global__ void surfCubemapKernelR(hipSurfaceObject_t surfaceObject,
T* outputData, int width, int height) {
#if !defined(__HIP_NO_IMAGE_SUPPORT) || !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -47,9 +46,8 @@ __global__ void surfCubemapKernelR(hipSurfaceObject_t surfaceObject, T* outputDa
#endif
}
template <typename T>
__global__ void surfCubemapKernelW(hipSurfaceObject_t surfaceObject, T* inputData, int width,
int height) {
template <typename T> __global__ void surfCubemapKernelW(hipSurfaceObject_t surfaceObject,
T* inputData, int width, int height) {
#if !defined(__HIP_NO_IMAGE_SUPPORT) || !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -59,9 +57,9 @@ __global__ void surfCubemapKernelW(hipSurfaceObject_t surfaceObject, T* inputDat
#endif
}
template <typename T>
__global__ void surfCubemapKernelRW(hipSurfaceObject_t surfaceObject,
hipSurfaceObject_t outputSurfObj, int width, int height) {
template <typename T> __global__ void surfCubemapKernelRW(hipSurfaceObject_t surfaceObject,
hipSurfaceObject_t outputSurfObj,
int width, int height) {
#if !defined(__HIP_NO_IMAGE_SUPPORT) || !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -35,9 +35,9 @@ THE SOFTWARE.
#define LOG_DATA 0
template <typename T>
__global__ void surfCubemapLayeredKernelR(hipSurfaceObject_t surfaceObject, T* outputData,
int width, int height) {
template <typename T> __global__ void surfCubemapLayeredKernelR(hipSurfaceObject_t surfaceObject,
T* outputData, int width,
int height) {
#if !defined(__HIP_NO_IMAGE_SUPPORT) || !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -47,9 +47,9 @@ __global__ void surfCubemapLayeredKernelR(hipSurfaceObject_t surfaceObject, T* o
#endif
}
template <typename T>
__global__ void surfCubemapLayeredKernelW(hipSurfaceObject_t surfaceObject, T* inputData, int width,
int height) {
template <typename T> __global__ void surfCubemapLayeredKernelW(hipSurfaceObject_t surfaceObject,
T* inputData, int width,
int height) {
#if !defined(__HIP_NO_IMAGE_SUPPORT) || !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -59,10 +59,9 @@ __global__ void surfCubemapLayeredKernelW(hipSurfaceObject_t surfaceObject, T* i
#endif
}
template <typename T>
__global__ void surfCubemapLayeredKernelRW(hipSurfaceObject_t surfaceObject,
hipSurfaceObject_t outputSurfObj, int width,
int height) {
template <typename T> __global__ void surfCubemapLayeredKernelRW(hipSurfaceObject_t surfaceObject,
hipSurfaceObject_t outputSurfObj,
int width, int height) {
#if !defined(__HIP_NO_IMAGE_SUPPORT) || !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -60,7 +60,7 @@ TEMPLATE_TEST_CASE("Unit_hipTexObjPitch_texture2D", "", char, unsigned char, sho
CHECK_IMAGE_SUPPORT
#if HT_NVIDIA
(void)
hipGetLastError(); // Prevent negative tests affecting this
hipGetLastError(); // Prevent negative tests affecting this
#endif
#if __HIP_NO_IMAGE_SUPPORT
HipTest::HIP_SKIP_TEST("__HIP_NO_IMAGE_SUPPORT is set");
@@ -59,9 +59,8 @@ static __global__ void populateMipmapNextLevelArray(hipSurfaceObject_t surfOut,
#endif
}
template <typename T>
__global__ void getMipmap(hipTextureObject_t texMipmap, unsigned int width, float offsetX,
float lod, T* data = nullptr) {
template <typename T> __global__ void getMipmap(hipTextureObject_t texMipmap, unsigned int width,
float offsetX, float lod, T* data = nullptr) {
#if !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
float px = 1.0 / float(width);
@@ -69,10 +69,10 @@ static __global__ void populateMipmapNextLevelArray(hipSurfaceObject_t surfOut,
#endif
}
template <typename T>
static __global__ void getMipmap(hipTextureObject_t texMipmap, unsigned int width,
unsigned int height, float offsetX, float offsetY, float lod,
T* data = nullptr) {
template <typename T> static __global__ void getMipmap(hipTextureObject_t texMipmap,
unsigned int width, unsigned int height,
float offsetX, float offsetY, float lod,
T* data = nullptr) {
#if !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -28,9 +28,9 @@ THE SOFTWARE.
* @ingroup TextureTest
*/
template <bool normalizedCoords>
__global__ void tex1DKernel(float* outputData, hipTextureObject_t textureObject, int width,
float offsetX) {
template <bool normalizedCoords> __global__ void tex1DKernel(float* outputData,
hipTextureObject_t textureObject,
int width, float offsetX) {
#if !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
outputData[x] =
@@ -22,9 +22,9 @@ THE SOFTWARE.
#include <hip_test_checkers.hh>
#include <hip_texture_helper.hh>
template <bool normalizedCoords>
__global__ void tex1DRGBAKernel(float4* outputData, hipTextureObject_t textureObject, int width,
float offsetX) {
template <bool normalizedCoords> __global__ void tex1DRGBAKernel(float4* outputData,
hipTextureObject_t textureObject,
int width, float offsetX) {
#if !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
outputData[x] =
@@ -140,9 +140,8 @@ TEST_CASE("Unit_hipMemGetAllocationGranularity_NegativeTests") {
hipMemGetAllocationGranularity(nullptr, &prop, hipMemAllocationGranularityMinimum));
}
SECTION("Prop is nullptr") {
REQUIRE(
hipErrorInvalidValue ==
hipMemGetAllocationGranularity(&granularity, nullptr, hipMemAllocationGranularityMinimum));
REQUIRE(hipErrorInvalidValue == hipMemGetAllocationGranularity(
&granularity, nullptr, hipMemAllocationGranularityMinimum));
}
SECTION("flag is invalid") {
@@ -156,27 +155,23 @@ TEST_CASE("Unit_hipMemGetAllocationGranularity_NegativeTests") {
int numDevices = 0;
HIP_CHECK(hipGetDeviceCount(&numDevices));
prop.location.id = numDevices; // set to non existing device
REQUIRE(
hipErrorInvalidValue ==
hipMemGetAllocationGranularity(&granularity, &prop, hipMemAllocationGranularityMinimum));
REQUIRE(hipErrorInvalidValue == hipMemGetAllocationGranularity(
&granularity, &prop, hipMemAllocationGranularityMinimum));
}
SECTION("device id < lowest device id") {
prop.location.id = -1; // set to non existing device
REQUIRE(
hipErrorInvalidValue ==
hipMemGetAllocationGranularity(&granularity, &prop, hipMemAllocationGranularityMinimum));
REQUIRE(hipErrorInvalidValue == hipMemGetAllocationGranularity(
&granularity, &prop, hipMemAllocationGranularityMinimum));
}
SECTION("allocation type as invalid") {
prop.type = hipMemAllocationTypeInvalid;
REQUIRE(
hipErrorInvalidValue ==
hipMemGetAllocationGranularity(&granularity, &prop, hipMemAllocationGranularityMinimum));
REQUIRE(hipErrorInvalidValue == hipMemGetAllocationGranularity(
&granularity, &prop, hipMemAllocationGranularityMinimum));
}
SECTION("location type as invalid") {
prop.location.type = hipMemLocationTypeInvalid;
REQUIRE(
hipErrorInvalidValue ==
hipMemGetAllocationGranularity(&granularity, &prop, hipMemAllocationGranularityMinimum));
REQUIRE(hipErrorInvalidValue == hipMemGetAllocationGranularity(
&granularity, &prop, hipMemAllocationGranularityMinimum));
}
#endif
}
@@ -81,7 +81,7 @@ TEST_CASE("Unit_hipExternalMemoryGetMappedMipmappedArray_Vulkan_Positive_Read_Wr
HIP_CHECK(hipGetMipmappedArrayLevel(&level_arr, mipmapped_arr, 1));
size_t level_arr_size = mipmapped_arr_desc.extent.width * mipmapped_arr_desc.extent.height *
mipmapped_arr_desc.extent.depth;
mipmapped_arr_desc.extent.depth;
REQUIRE(WriteAndValidateData<type>(level_arr, level_arr_size) == true);
@@ -70,13 +70,12 @@ template <typename T> static void runTestShflXor_2() {
const int size = 64;
T Input[size];
T Output[size];
int Values[size] = {
4, 5, -6, 7, 0, -1, 2, 3, 8, -9, 10, 11, 12, 13, -14, 15, // disabled around mid
// mod-24
20, -21, 22, 23, 16, 17, -18, 19, 28, 29, 30, 31, 24, 25, 26, -27, -32,
33, 34, 35, -36, 37, 38, -39, // disabled around mid mod-24
-44, -45, 46, 47, 40, 41, 42, 43, 52, 53, -54, 55, 48, 49, 50, -51, 56,
57, -58, 59, 60, 61, 62, -63}; // disabled around mid mod-24
int Values[size] = {4, 5, -6, 7, 0, -1, 2, 3, 8, -9, 10, 11, 12, 13, -14, 15, // disabled around
// mid mod-24
20, -21, 22, 23, 16, 17, -18, 19, 28, 29, 30, 31, 24, 25, 26, -27, -32, 33,
34, 35, -36, 37, 38, -39, // disabled around mid mod-24
-44, -45, 46, 47, 40, 41, 42, 43, 52, 53, -54, 55, 48, 49, 50, -51, 56, 57,
-58, 59, 60, 61, 62, -63}; // disabled around mid mod-24
T Expected[size];
initializeInput(Input, size);
@@ -69,7 +69,7 @@ class WarpAll : public WarpVoteTest<WarpAll, uint64_t> {
const auto rank_in_block = this->grid_.thread_rank_in_block(i).value();
const auto rank_in_warp = rank_in_block % this->warp_size_;
const auto warp_idx = this->warps_in_block_ * (i / this->grid_.threads_in_block_count_) +
rank_in_block / this->warp_size_;
rank_in_block / this->warp_size_;
const auto block_rank = warp_idx / this->warps_in_block_;
const std::bitset<sizeof(uint64_t) * 8> active_mask(this->active_masks_[warp_idx]);
@@ -60,7 +60,7 @@ class WarpAny : public WarpVoteTest<WarpAny, uint64_t> {
const auto rank_in_block = this->grid_.thread_rank_in_block(i).value();
const auto rank_in_warp = rank_in_block % this->warp_size_;
const auto warp_idx = this->warps_in_block_ * (i / this->grid_.threads_in_block_count_) +
rank_in_block / this->warp_size_;
rank_in_block / this->warp_size_;
const auto block_rank = warp_idx / this->warps_in_block_;
const std::bitset<sizeof(uint64_t) * 8> active_mask(this->active_masks_[warp_idx]);
@@ -59,7 +59,7 @@ class WarpBallot : public WarpVoteTest<WarpBallot, uint64_t> {
const auto rank_in_block = this->grid_.thread_rank_in_block(i).value();
const auto rank_in_warp = rank_in_block % this->warp_size_;
const auto warp_idx = this->warps_in_block_ * (i / this->grid_.threads_in_block_count_) +
rank_in_block / this->warp_size_;
rank_in_block / this->warp_size_;
const auto block_rank = warp_idx / this->warps_in_block_;
const std::bitset<sizeof(uint64_t) * 8> active_mask(this->active_masks_[warp_idx]);
@@ -31,9 +31,9 @@ THE SOFTWARE.
namespace cg = cooperative_groups;
template <typename T>
__global__ void shfl(T* const out, const T* const in, const uint64_t* const active_masks,
const uint8_t* const src_lanes, const int width) {
template <typename T> __global__ void shfl(T* const out, const T* const in,
const uint64_t* const active_masks,
const uint8_t* const src_lanes, const int width) {
if (deactivate_thread(active_masks)) {
return;
}
@@ -68,7 +68,7 @@ template <typename T> class WarpShfl : public WarpShflTest<WarpShfl<T>, T> {
const int src_offset = src_lane - rank_in_partition;
const auto mask_idx = this->warps_in_block_ * (i / this->grid_.threads_in_block_count_) +
rank_in_block / this->warp_size_;
rank_in_block / this->warp_size_;
const std::bitset<sizeof(uint64_t) * 8> active_mask(this->active_masks_[mask_idx]);
if (!active_mask.test(rank_in_warp) || (!active_mask.test((rank_in_warp + src_offset))) ||
@@ -31,9 +31,9 @@ THE SOFTWARE.
namespace cg = cooperative_groups;
template <typename T>
__global__ void shfl_down(T* const out, const T* const in, const uint64_t* const active_masks,
const unsigned int* const deltas, const int width) {
template <typename T> __global__ void shfl_down(T* const out, const T* const in,
const uint64_t* const active_masks,
const unsigned int* const deltas, const int width) {
if (deactivate_thread(active_masks)) {
return;
}
@@ -65,7 +65,7 @@ template <typename T> class WarpShflDown : public WarpShflTest<WarpShflDown<T>,
const auto rank_in_warp = rank_in_block % this->warp_size_;
const auto rank_in_partition = rank_in_block % width_;
const auto mask_idx = this->warps_in_block_ * (i / this->grid_.threads_in_block_count_) +
rank_in_block / this->warp_size_;
rank_in_block / this->warp_size_;
const unsigned int delta = deltas_[rank_in_partition] % width_;
const std::bitset<sizeof(uint64_t) * 8> active_mask(this->active_masks_[mask_idx]);
@@ -31,9 +31,9 @@ THE SOFTWARE.
namespace cg = cooperative_groups;
template <typename T>
__global__ void shfl_up(T* const out, const T* const in, const uint64_t* const active_masks,
const unsigned int* const deltas, const int width) {
template <typename T> __global__ void shfl_up(T* const out, const T* const in,
const uint64_t* const active_masks,
const unsigned int* const deltas, const int width) {
if (deactivate_thread(active_masks)) {
return;
}
@@ -65,7 +65,7 @@ template <typename T> class WarpShflUp : public WarpShflTest<WarpShflUp<T>, T> {
const auto rank_in_warp = rank_in_block % this->warp_size_;
const auto rank_in_partition = rank_in_block % width_;
const auto mask_idx = this->warps_in_block_ * (i / this->grid_.threads_in_block_count_) +
rank_in_block / this->warp_size_;
rank_in_block / this->warp_size_;
const unsigned int delta = deltas_[rank_in_partition] % width_;
const std::bitset<sizeof(uint64_t) * 8> active_mask(this->active_masks_[mask_idx]);
@@ -31,9 +31,9 @@ THE SOFTWARE.
namespace cg = cooperative_groups;
template <typename T>
__global__ void shfl_xor(T* const out, const T* const in, const uint64_t* const active_masks,
const int lane_mask, const int width) {
template <typename T> __global__ void shfl_xor(T* const out, const T* const in,
const uint64_t* const active_masks,
const int lane_mask, const int width) {
if (deactivate_thread(active_masks)) {
return;
}
@@ -61,7 +61,7 @@ template <typename T> class WarpShflXOR : public WarpShflTest<WarpShflXOR<T>, T>
const int warp_target = rank_in_warp ^ this->lane_mask_;
const int target_offset = warp_target - rank_in_warp;
const auto mask_idx = this->warps_in_block_ * (i / this->grid_.threads_in_block_count_) +
rank_in_block / this->warp_size_;
rank_in_block / this->warp_size_;
const std::bitset<sizeof(uint64_t) * 8> active_mask(this->active_masks_[mask_idx]);
const auto target_partition = warp_target / width_;