SWDEV-277697 - Adding Infra and dependent libs: Catch2 and json parser, for new HIP Testing framework
Change-Id: Iedfa041ec9acc13eeb631ff67e1677e2fe29463d
[ROCm/hip-tests commit: be6809d8d1]
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
add_subdirectory(memory)
|
||||
add_subdirectory(deviceLib)
|
||||
add_subdirectory(kernels)
|
||||
add_subdirectory(rtc)
|
||||
@@ -0,0 +1,11 @@
|
||||
# Common Tests - Test independent of all platforms
|
||||
set(TEST_SRC
|
||||
floatMath.cc
|
||||
vectorTypesDevice.cc
|
||||
)
|
||||
|
||||
# Create shared lib of all tests
|
||||
add_library(DeviceLibs SHARED EXCLUDE_FROM_ALL ${TEST_SRC})
|
||||
|
||||
# Add dependency on build_tests to build it on this custom target
|
||||
add_dependencies(build_tests DeviceLibs)
|
||||
@@ -0,0 +1,41 @@
|
||||
#include <hip_test_common.hh>
|
||||
|
||||
#define LEN 512
|
||||
#define SIZE LEN << 2
|
||||
|
||||
__global__ void floatMath(float* In, float* Out) {
|
||||
int tid = threadIdx.x + blockIdx.x * blockDim.x;
|
||||
Out[tid] = __cosf(In[tid]);
|
||||
Out[tid] = __exp10f(Out[tid]);
|
||||
Out[tid] = __expf(Out[tid]);
|
||||
Out[tid] = __frsqrt_rn(Out[tid]);
|
||||
#if defined OCML_BASIC_ROUNDED_OPERATIONS
|
||||
Out[tid] = __fsqrt_rd(Out[tid]);
|
||||
#endif
|
||||
Out[tid] = __fsqrt_rn(Out[tid]);
|
||||
#if defined OCML_BASIC_ROUNDED_OPERATIONS
|
||||
Out[tid] = __fsqrt_ru(Out[tid]);
|
||||
Out[tid] = __fsqrt_rz(Out[tid]);
|
||||
#endif
|
||||
Out[tid] = __log10f(Out[tid]);
|
||||
Out[tid] = __log2f(Out[tid]);
|
||||
Out[tid] = __logf(Out[tid]);
|
||||
Out[tid] = __powf(2.0f, Out[tid]);
|
||||
__sincosf(Out[tid], &In[tid], &Out[tid]);
|
||||
Out[tid] = __sinf(Out[tid]);
|
||||
Out[tid] = __cosf(Out[tid]);
|
||||
Out[tid] = __tanf(Out[tid]);
|
||||
}
|
||||
|
||||
TEST_CASE("FloatMathTest") {
|
||||
float *Ind, *Outd;
|
||||
auto res = hipMalloc((void**)&Ind, SIZE);
|
||||
REQUIRE(res == hipSuccess);
|
||||
res = hipMalloc((void**)&Outd, SIZE);
|
||||
REQUIRE(res == hipSuccess);
|
||||
hipLaunchKernelGGL(floatMath, dim3(LEN, 1, 1), dim3(1, 1, 1), 0, 0, Ind, Outd);
|
||||
res = hipDeviceSynchronize();
|
||||
REQUIRE(res == hipSuccess);
|
||||
res = hipGetLastError();
|
||||
REQUIRE(res == hipSuccess);
|
||||
}
|
||||
@@ -0,0 +1,246 @@
|
||||
#include <hip_test_common.hh>
|
||||
#include <type_traits>
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
template <bool b, typename T = void> using Enable_if_t = typename std::enable_if<b, T>::type;
|
||||
|
||||
using namespace std;
|
||||
|
||||
template <class T> __device__ typename std::add_rvalue_reference<T>::type _declval() noexcept;
|
||||
|
||||
template <typename V, Enable_if_t<!is_integral<decltype(_declval<V>().x)>{}>* = nullptr>
|
||||
__device__ constexpr bool integer_unary_tests(const V&, const V&) {
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename V, Enable_if_t<is_integral<decltype(_declval<V>().x)>{}>* = nullptr>
|
||||
__device__ bool integer_unary_tests(V& f1, V& f2) {
|
||||
f1 %= f2;
|
||||
if (f1 != V{0}) return false;
|
||||
|
||||
f1 &= f2;
|
||||
if (f1 != V{0}) return false;
|
||||
f1 |= f2;
|
||||
if (f1 != V{1}) return false;
|
||||
f1 ^= f2;
|
||||
if (f1 != V{0}) return false;
|
||||
f1 = V{1};
|
||||
f1 <<= f2;
|
||||
if (f1 != V{2}) return false;
|
||||
f1 >>= f2;
|
||||
if (f1 != V{1}) return false;
|
||||
f2 = ~f1;
|
||||
return f2 == V{~1};
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename V, Enable_if_t<!is_integral<decltype(_declval<V>().x)>{}>* = nullptr>
|
||||
__device__ constexpr bool integer_binary_tests(const V&, const V&, const V&) {
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename V, Enable_if_t<is_integral<decltype(_declval<V>().x)>{}>* = nullptr>
|
||||
__device__ bool integer_binary_tests(V& f1, V& f2, V& f3) {
|
||||
f3 = f1 % f2;
|
||||
if (f3 != V{0}) return false;
|
||||
f1 = f3 & f2;
|
||||
if (f1 != V{0}) return false;
|
||||
f2 = f1 ^ f3;
|
||||
if (f2 != V{0}) return false;
|
||||
f1 = V{1};
|
||||
f2 = V{2};
|
||||
f3 = f1 << f2;
|
||||
if (f3 != V{4}) return false;
|
||||
f2 = f3 >> f1;
|
||||
return f2 == V{2};
|
||||
}
|
||||
|
||||
template <typename V> __device__ bool TestVectorType() {
|
||||
constexpr V v1{1};
|
||||
constexpr V v2{2};
|
||||
constexpr V v3{3};
|
||||
constexpr V v4{4};
|
||||
|
||||
V f1{1};
|
||||
V f2{1};
|
||||
V f3 = f1 + f2;
|
||||
if (f3 != V{2}) return false;
|
||||
f2 = f3 - f1;
|
||||
if (f2 != V{1}) return false;
|
||||
f1 = f2 * f3;
|
||||
if (f1 != V{2}) return false;
|
||||
f2 = f1 / f3;
|
||||
if (f2 != V{1}) return false;
|
||||
if (!integer_binary_tests(f1, f2, f3)) return false;
|
||||
|
||||
f1 = v2;
|
||||
f2 = v1;
|
||||
f1 += f2;
|
||||
if (f1 != v3) return false;
|
||||
f1 -= f2;
|
||||
if (f1 != v2) return false;
|
||||
f1 *= f2;
|
||||
if (f1 != v2) return false;
|
||||
f1 /= f2;
|
||||
if (f1 != v2) return false;
|
||||
if (!integer_unary_tests(f1, f2)) return false;
|
||||
|
||||
f1 = v2;
|
||||
f2 = f1++;
|
||||
if (f1 != v3) return false;
|
||||
if (f2 != v2) return false;
|
||||
f2 = f1--;
|
||||
if (f2 != v3) return false;
|
||||
if (f1 != v2) return false;
|
||||
f2 = ++f1;
|
||||
if (f1 != v3) return false;
|
||||
if (f2 != v3) return false;
|
||||
f2 = --f1;
|
||||
if (f1 != v2) return false;
|
||||
if (f2 != v2) return false;
|
||||
|
||||
f1 = v3;
|
||||
f2 = v4;
|
||||
f3 = v3;
|
||||
if (f1 == f2) return false;
|
||||
if (!(f1 != f2)) return false;
|
||||
|
||||
#if 0 // TODO: investigate on GFX8
|
||||
using T = typename V::value_type;
|
||||
|
||||
const T& x = f1.x;
|
||||
T& y = f2.x;
|
||||
const volatile T& z = f3.x;
|
||||
volatile T& w = f2.x;
|
||||
|
||||
if (x != T{3}) return false;
|
||||
if (y != T{4}) return false;
|
||||
if (z != T{3}) return false;
|
||||
if (w != T{4}) return false;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename... Ts, Enable_if_t<sizeof...(Ts) == 0>* = nullptr>
|
||||
__device__ bool TestVectorTypes() {
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename T, typename... Ts> __device__ bool TestVectorTypes() {
|
||||
if (!TestVectorType<T>()) return false;
|
||||
return TestVectorTypes<Ts...>();
|
||||
}
|
||||
|
||||
__global__ void CheckVectorTypes(bool* ptr) {
|
||||
ptr[0] = TestVectorTypes<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, longlong2, longlong3,
|
||||
longlong4, ulonglong1, ulonglong2, ulonglong3, ulonglong4, float1,
|
||||
float2, float3, float4, double1, double2, double3, double4>();
|
||||
}
|
||||
|
||||
|
||||
template <typename V> __global__ void CheckSharedVectorType(bool* ptr) {
|
||||
constexpr V v1{1};
|
||||
constexpr V v2{2};
|
||||
constexpr V v3{3};
|
||||
constexpr V v4{4};
|
||||
__shared__ V f1, f2, f3;
|
||||
|
||||
*ptr = true;
|
||||
f1 = V{1};
|
||||
f2 = V{1};
|
||||
f3 = f1 + f2;
|
||||
*ptr = *ptr && f3 == V{2};
|
||||
f2 = f3 - f1;
|
||||
*ptr = *ptr && f2 == V{1};
|
||||
f1 = f2 * f3;
|
||||
*ptr = *ptr && f1 == V{2};
|
||||
f2 = f1 / f3;
|
||||
*ptr = *ptr && f2 == V{1};
|
||||
*ptr = *ptr && integer_binary_tests(f1, f2, f3);
|
||||
|
||||
f1 = v2;
|
||||
f2 = v1;
|
||||
f1 += f2;
|
||||
*ptr = *ptr && f1 == v3;
|
||||
f1 -= f2;
|
||||
*ptr = *ptr && f1 == v2;
|
||||
f1 *= f2;
|
||||
*ptr = *ptr && f1 == v2;
|
||||
f1 /= f2;
|
||||
*ptr = *ptr && f1 == v2;
|
||||
*ptr = *ptr && integer_unary_tests(f1, f2);
|
||||
|
||||
f1 = v2;
|
||||
f2 = f1++;
|
||||
*ptr = *ptr && f1 == v3;
|
||||
*ptr = *ptr && f2 == v2;
|
||||
f2 = f1--;
|
||||
*ptr = *ptr && f2 == v3;
|
||||
*ptr = *ptr && f1 == v2;
|
||||
f2 = ++f1;
|
||||
*ptr = *ptr && f1 == v3;
|
||||
*ptr = *ptr && f2 == v3;
|
||||
f2 = --f1;
|
||||
*ptr = *ptr && f1 == v2;
|
||||
*ptr = *ptr && f2 == v2;
|
||||
|
||||
f1 = v3;
|
||||
f2 = v4;
|
||||
f3 = v3;
|
||||
*ptr = *ptr && f1 != f2;
|
||||
}
|
||||
|
||||
template <typename V> bool run_CheckSharedVectorType() {
|
||||
bool* ptr = nullptr;
|
||||
if (hipMalloc(&ptr, sizeof(bool)) != HIP_SUCCESS) return false;
|
||||
unique_ptr<bool, decltype(hipFree)*> correct{ptr, hipFree};
|
||||
hipLaunchKernelGGL((CheckSharedVectorType<V>), dim3(1, 1, 1), dim3(1, 1, 1), 0, 0, correct.get());
|
||||
bool passed = true;
|
||||
if (hipMemcpyDtoH(&passed, correct.get(), sizeof(bool)) != HIP_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
return passed;
|
||||
}
|
||||
|
||||
template <typename... Ts, Enable_if_t<sizeof...(Ts) == 0>* = nullptr>
|
||||
bool run_CheckSharedVectorTypes() {
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename V, typename... Vs> bool run_CheckSharedVectorTypes() {
|
||||
return run_CheckSharedVectorType<V>() && run_CheckSharedVectorTypes<Vs...>();
|
||||
}
|
||||
|
||||
TEST_CASE("VectorTypesTest") {
|
||||
static_assert(sizeof(float1) == 4, "");
|
||||
static_assert(sizeof(float2) >= 8, "");
|
||||
static_assert(sizeof(float3) >= 12, "");
|
||||
static_assert(sizeof(float4) >= 16, "");
|
||||
|
||||
bool* ptr = nullptr;
|
||||
auto res = hipMalloc(&ptr, sizeof(bool));
|
||||
REQUIRE(res == hipSuccess);
|
||||
|
||||
unique_ptr<bool, decltype(hipFree)*> correct{ptr, hipFree};
|
||||
hipLaunchKernelGGL(CheckVectorTypes, dim3(1, 1, 1), dim3(1, 1, 1), 0, 0, correct.get());
|
||||
|
||||
bool passed = true;
|
||||
res = hipMemcpyDtoH(&passed, correct.get(), sizeof(bool));
|
||||
REQUIRE(res == hipSuccess);
|
||||
|
||||
passed = passed &&
|
||||
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,
|
||||
longlong2, longlong3, longlong4, ulonglong1, ulonglong2, ulonglong3, ulonglong4,
|
||||
float1, float2, float3, float4, double1, double2, double3, double4>();
|
||||
REQUIRE(passed == true);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
# Common Tests - Test independent of all platforms
|
||||
set(TEST_SRC
|
||||
add.cc
|
||||
)
|
||||
|
||||
# Create shared lib of all tests
|
||||
add_library(Kernels SHARED EXCLUDE_FROM_ALL ${TEST_SRC})
|
||||
|
||||
# Add dependency on build_tests to build it on this custom target
|
||||
add_dependencies(build_tests Kernels)
|
||||
@@ -0,0 +1,41 @@
|
||||
#include <hip_test_common.hh>
|
||||
#include <iostream>
|
||||
|
||||
template <typename T> __global__ void add(T* a, T* b, T* c, size_t size) {
|
||||
int i = threadIdx.x;
|
||||
c[i] = a[i] + b[i];
|
||||
}
|
||||
|
||||
TEMPLATE_TEST_CASE("Add Kernel", "[kernel][add]", int, long, float, long long, double) {
|
||||
auto addKernel = add<TestType>;
|
||||
auto size = GENERATE(as<size_t>{}, 100, 500, 1000);
|
||||
TestType *d_a, *d_b, *d_c;
|
||||
auto res = hipMalloc(&d_a, sizeof(TestType) * size);
|
||||
REQUIRE(res == hipSuccess);
|
||||
res = hipMalloc(&d_b, sizeof(TestType) * size);
|
||||
REQUIRE(res == hipSuccess);
|
||||
res = hipMalloc(&d_c, sizeof(TestType) * size);
|
||||
REQUIRE(res == hipSuccess);
|
||||
|
||||
std::vector<TestType> a, b, c;
|
||||
for (int i = 0; i < size; i++) {
|
||||
a.push_back(i + 1);
|
||||
b.push_back(i + 1);
|
||||
c.push_back(2 * (i + 1));
|
||||
}
|
||||
|
||||
res = hipMemcpy(d_a, a.data(), sizeof(TestType) * size, hipMemcpyHostToDevice);
|
||||
REQUIRE(res == hipSuccess);
|
||||
res = hipMemcpy(d_b, b.data(), sizeof(TestType) * size, hipMemcpyHostToDevice);
|
||||
REQUIRE(res == hipSuccess);
|
||||
|
||||
hipLaunchKernelGGL(addKernel, 1, size, 0, 0, d_a, d_b, d_c, size);
|
||||
|
||||
res = hipMemcpy(a.data(), d_c, sizeof(TestType) * size, hipMemcpyDeviceToHost);
|
||||
REQUIRE(res == hipSuccess);
|
||||
|
||||
hipFree(d_a);
|
||||
hipFree(d_b);
|
||||
hipFree(d_c);
|
||||
REQUIRE(a == c);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
# Common Tests - Test independent of all platforms
|
||||
set(TEST_SRC
|
||||
memset.cc
|
||||
malloc.cc
|
||||
)
|
||||
|
||||
# Create shared lib of all tests
|
||||
add_library(MemoryTest SHARED EXCLUDE_FROM_ALL ${TEST_SRC})
|
||||
|
||||
# Add dependency on build_tests to build it on this custom target
|
||||
add_dependencies(build_tests MemoryTest)
|
||||
@@ -0,0 +1,17 @@
|
||||
#include <hip_test_common.hh>
|
||||
|
||||
TEST_CASE("HostAllocBasic") {
|
||||
int* d_a;
|
||||
auto res = hipHostMalloc(&d_a, sizeof(int), 0);
|
||||
REQUIRE(res == hipSuccess);
|
||||
res = hipHostFree(d_a);
|
||||
REQUIRE(res == hipSuccess);
|
||||
}
|
||||
|
||||
TEST_CASE("AllocateBasic") {
|
||||
int* d_a;
|
||||
auto res = hipMalloc(&d_a, sizeof(int));
|
||||
REQUIRE(res == hipSuccess);
|
||||
res = hipFree(d_a);
|
||||
REQUIRE(res == hipSuccess);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#include <hip_test_common.hh>
|
||||
|
||||
TEST_CASE("MemsetBasic") {
|
||||
int* d_a;
|
||||
auto res = hipMalloc(&d_a, sizeof(int));
|
||||
REQUIRE(res == hipSuccess);
|
||||
res = hipMemset(d_a, 0, sizeof(int));
|
||||
REQUIRE(res == hipSuccess);
|
||||
hipFree(d_a);
|
||||
}
|
||||
|
||||
TEST_CASE("HostMemsetBasic") {
|
||||
int* d_a;
|
||||
auto res = hipHostMalloc(&d_a, sizeof(int), 0);
|
||||
REQUIRE(res == hipSuccess);
|
||||
res = hipMemset(d_a, 0, sizeof(int));
|
||||
REQUIRE(res == hipSuccess);
|
||||
hipHostFree(d_a);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
# Common Tests - Test independent of all platforms
|
||||
set(TEST_SRC
|
||||
saxpy.cc
|
||||
)
|
||||
|
||||
# Set source File properties
|
||||
set_source_files_properties(saxpy.cc PROPERTIES COMPILE_FLAGS " -std=c++14 ")
|
||||
set_source_files_properties(test.cc PROPERTIES COMPILE_FLAGS " -std=c++17 ")
|
||||
|
||||
# Create shared lib of all tests
|
||||
add_library(RTC SHARED EXCLUDE_FROM_ALL ${TEST_SRC})
|
||||
|
||||
# Add dependency on build_tests to build it on this custom target
|
||||
add_dependencies(build_tests RTC)
|
||||
@@ -0,0 +1,113 @@
|
||||
#include <hip_test_common.hh>
|
||||
|
||||
#include <hip/hiprtc.h>
|
||||
#include <hip/hip_runtime.h>
|
||||
|
||||
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
|
||||
static constexpr auto NUM_THREADS{128};
|
||||
static constexpr auto NUM_BLOCKS{32};
|
||||
|
||||
static constexpr auto saxpy{
|
||||
R"(
|
||||
#include <hip/hip_runtime.h>
|
||||
extern "C"
|
||||
__global__
|
||||
void saxpy(float a, float* x, float* y, float* out, size_t n)
|
||||
{
|
||||
size_t tid = blockIdx.x * blockDim.x + threadIdx.x;
|
||||
if (tid < n) {
|
||||
out[tid] = a * x[tid] + y[tid] ;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
)"};
|
||||
|
||||
TEST_CASE("saxpy", "[hiprtc][saxpy]") {
|
||||
using namespace std;
|
||||
hiprtcProgram prog;
|
||||
hiprtcCreateProgram(&prog, // prog
|
||||
saxpy, // buffer
|
||||
"saxpy.cu", // name
|
||||
0, nullptr, nullptr);
|
||||
hipDeviceProp_t props;
|
||||
int device = 0;
|
||||
hipGetDeviceProperties(&props, device);
|
||||
std::string sarg = std::string("--gpu-architecture=") + props.gcnArchName;
|
||||
const char* options[] = {sarg.c_str()};
|
||||
hiprtcResult compileResult{hiprtcCompileProgram(prog, 1, options)};
|
||||
size_t logSize;
|
||||
hiprtcGetProgramLogSize(prog, &logSize);
|
||||
if (logSize) {
|
||||
string log(logSize, '\0');
|
||||
hiprtcGetProgramLog(prog, &log[0]);
|
||||
|
||||
std::cout << log << '\n';
|
||||
}
|
||||
REQUIRE(compileResult == HIPRTC_SUCCESS);
|
||||
size_t codeSize;
|
||||
hiprtcGetCodeSize(prog, &codeSize);
|
||||
|
||||
vector<char> code(codeSize);
|
||||
hiprtcGetCode(prog, code.data());
|
||||
|
||||
hiprtcDestroyProgram(&prog);
|
||||
|
||||
hipModule_t module;
|
||||
hipFunction_t kernel;
|
||||
hipModuleLoadData(&module, code.data());
|
||||
hipModuleGetFunction(&kernel, module, "saxpy");
|
||||
|
||||
size_t n = NUM_THREADS * NUM_BLOCKS;
|
||||
size_t bufferSize = n * sizeof(float);
|
||||
|
||||
float a = 5.1f;
|
||||
unique_ptr<float[]> hX{new float[n]};
|
||||
unique_ptr<float[]> hY{new float[n]};
|
||||
unique_ptr<float[]> hOut{new float[n]};
|
||||
for (size_t i = 0; i < n; ++i) {
|
||||
hX[i] = static_cast<float>(i);
|
||||
hY[i] = static_cast<float>(i * 2);
|
||||
}
|
||||
|
||||
hipDeviceptr_t dX, dY, dOut;
|
||||
hipMalloc(&dX, bufferSize);
|
||||
hipMalloc(&dY, bufferSize);
|
||||
hipMalloc(&dOut, bufferSize);
|
||||
hipMemcpyHtoD(dX, hX.get(), bufferSize);
|
||||
hipMemcpyHtoD(dY, hY.get(), bufferSize);
|
||||
|
||||
struct {
|
||||
float a_;
|
||||
hipDeviceptr_t b_;
|
||||
hipDeviceptr_t c_;
|
||||
hipDeviceptr_t d_;
|
||||
size_t e_;
|
||||
} args{a, dX, dY, dOut, n};
|
||||
|
||||
auto size = sizeof(args);
|
||||
void* config[] = {HIP_LAUNCH_PARAM_BUFFER_POINTER, &args,
|
||||
HIP_LAUNCH_PARAM_BUFFER_SIZE, &size,
|
||||
HIP_LAUNCH_PARAM_END};
|
||||
|
||||
hipModuleLaunchKernel(kernel, NUM_BLOCKS, 1, 1, NUM_THREADS, 1, 1,
|
||||
0, nullptr, nullptr, config);
|
||||
hipMemcpyDtoH(hOut.get(), dOut, bufferSize);
|
||||
|
||||
for (size_t i = 0; i < n; ++i) {
|
||||
REQUIRE(fabs(a * hX[i] + hY[i] - hOut[i]) > fabs(hOut[i]) * 1e-6);
|
||||
}
|
||||
|
||||
hipFree(dX);
|
||||
hipFree(dY);
|
||||
hipFree(dOut);
|
||||
|
||||
hipModuleUnload(module);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#include <hip_test_common.hh>
|
||||
|
||||
TEST_CASE("cpp17 test") {
|
||||
constexpr auto l = []() { return 2 * 10 * 30; };
|
||||
REQUIRE(l() == 600);
|
||||
}
|
||||
Reference in New Issue
Block a user