@@ -14,12 +14,12 @@
|
||||
*/
|
||||
|
||||
|
||||
__global__ void cpy(hipLaunchParm lp, uint32_t* Out, uint32_t* In) {
|
||||
__global__ void cpy(uint32_t* Out, uint32_t* In) {
|
||||
int tx = threadIdx.x;
|
||||
memcpy(Out + tx, In + tx, sizeof(uint32_t));
|
||||
}
|
||||
|
||||
__global__ void set(hipLaunchParm lp, uint32_t* ptr, uint8_t val, size_t size) {
|
||||
__global__ void set(uint32_t* ptr, uint8_t val, size_t size) {
|
||||
int tx = threadIdx.x;
|
||||
memset(ptr + tx, val, sizeof(uint32_t));
|
||||
}
|
||||
@@ -39,7 +39,7 @@ int main() {
|
||||
hipMalloc((void**)&Bd, SIZE);
|
||||
hipMemcpy(Ad, A, SIZE, hipMemcpyHostToDevice);
|
||||
|
||||
hipLaunchKernel(cpy, dim3(1), dim3(LEN), 0, 0, Bd, Ad);
|
||||
hipLaunchKernelGGL(cpy, dim3(1), dim3(LEN), 0, 0, Bd, Ad);
|
||||
|
||||
hipMemcpy(B, Bd, SIZE, hipMemcpyDeviceToHost);
|
||||
for (int i = LEN - 16; i < LEN; i++) {
|
||||
@@ -47,7 +47,7 @@ int main() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
hipLaunchKernel(set, dim3(1), dim3(LEN), 0, 0, Bd, 0x1, LEN);
|
||||
hipLaunchKernelGGL(set, dim3(1), dim3(LEN), 0, 0, Bd, 0x1, LEN);
|
||||
|
||||
hipMemcpy(B, Bd, SIZE, hipMemcpyDeviceToHost);
|
||||
for (int i = LEN - 16; i < LEN; i++) {
|
||||
|
||||
@@ -64,11 +64,11 @@ __device__ void double_precision_intrinsics() {
|
||||
__fma_rz(1.0, 2.0, 3.0);
|
||||
}
|
||||
|
||||
__global__ void compileDoublePrecisionIntrinsics(hipLaunchParm lp, int ignored) {
|
||||
__global__ void compileDoublePrecisionIntrinsics(int ignored) {
|
||||
double_precision_intrinsics();
|
||||
}
|
||||
|
||||
int main() {
|
||||
hipLaunchKernel(compileDoublePrecisionIntrinsics, dim3(1, 1, 1), dim3(1, 1, 1), 0, 0, 1);
|
||||
hipLaunchKernelGGL(compileDoublePrecisionIntrinsics, dim3(1, 1, 1), dim3(1, 1, 1), 0, 0, 1);
|
||||
passed();
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ THE SOFTWARE.
|
||||
#define SIZE LEN << 2
|
||||
|
||||
|
||||
__global__ void floatMath(hipLaunchParm lp, float* In, float* Out) {
|
||||
__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]);
|
||||
@@ -57,6 +57,6 @@ int main() {
|
||||
float *Ind, *Outd;
|
||||
hipMalloc((void**)&Ind, SIZE);
|
||||
hipMalloc((void**)&Outd, SIZE);
|
||||
hipLaunchKernel(floatMath, dim3(LEN, 1, 1), dim3(1, 1, 1), 0, 0, Ind, Outd);
|
||||
hipLaunchKernelGGL(floatMath, dim3(LEN, 1, 1), dim3(1, 1, 1), 0, 0, Ind, Outd);
|
||||
passed();
|
||||
}
|
||||
|
||||
@@ -66,9 +66,9 @@ __device__ void integer_intrinsics() {
|
||||
assert(1);
|
||||
}
|
||||
|
||||
__global__ void compileIntegerIntrinsics(hipLaunchParm lp, int ignored) { integer_intrinsics(); }
|
||||
__global__ void compileIntegerIntrinsics(int ignored) { integer_intrinsics(); }
|
||||
|
||||
int main() {
|
||||
hipLaunchKernel(compileIntegerIntrinsics, dim3(1, 1, 1), dim3(1, 1, 1), 0, 0, 1);
|
||||
hipLaunchKernelGGL(compileIntegerIntrinsics, dim3(1, 1, 1), dim3(1, 1, 1), 0, 0, 1);
|
||||
passed();
|
||||
}
|
||||
|
||||
@@ -31,12 +31,12 @@ THE SOFTWARE.
|
||||
|
||||
#if __HIP_ARCH_GFX803__ || __HIP_ARCH_GFX900__ || __HIP_ARCH_GFX906__
|
||||
|
||||
__global__ void kernel_abs_int64(hipLaunchParm lp, long long *input, long long *output) {
|
||||
__global__ void kernel_abs_int64(long long *input, long long *output) {
|
||||
int tx = threadIdx.x;
|
||||
output[tx] = abs(input[tx]);
|
||||
}
|
||||
|
||||
__global__ void kernel_lgamma_double(hipLaunchParm lp, double *input, double *output) {
|
||||
__global__ void kernel_lgamma_double(double *input, double *output) {
|
||||
int tx = threadIdx.x;
|
||||
output[tx] = lgamma(input[tx]);
|
||||
}
|
||||
@@ -79,7 +79,7 @@ void check_lgamma_double() {
|
||||
hipMemcpy(inputGPU, inputCPU, memsize, hipMemcpyHostToDevice);
|
||||
|
||||
// launch kernel
|
||||
hipLaunchKernel(kernel_lgamma_double, dim3(1), dim3(NUM_INPUTS), 0, 0, inputGPU, outputGPU);
|
||||
hipLaunchKernelGGL(kernel_lgamma_double, dim3(1), dim3(NUM_INPUTS), 0, 0, inputGPU, outputGPU);
|
||||
|
||||
// copy outputs from device
|
||||
hipMemcpy(outputCPU, outputGPU, memsize, hipMemcpyDeviceToHost);
|
||||
@@ -127,7 +127,7 @@ void check_abs_int64() {
|
||||
hipMemcpy(inputGPU, inputCPU, memsize, hipMemcpyHostToDevice);
|
||||
|
||||
// launch kernel
|
||||
hipLaunchKernel(kernel_abs_int64, dim3(1), dim3(NUM_INPUTS), 0, 0, inputGPU, outputGPU);
|
||||
hipLaunchKernelGGL(kernel_abs_int64, dim3(1), dim3(NUM_INPUTS), 0, 0, inputGPU, outputGPU);
|
||||
|
||||
// copy outputs from device
|
||||
hipMemcpy(outputCPU, outputGPU, memsize, hipMemcpyDeviceToHost);
|
||||
|
||||
@@ -80,12 +80,12 @@ __device__ void single_precision_intrinsics() {
|
||||
}
|
||||
|
||||
|
||||
__global__ void compileSinglePrecisionIntrinsics(hipLaunchParm lp, int ignored) {
|
||||
__global__ void compileSinglePrecisionIntrinsics(int ignored) {
|
||||
single_precision_intrinsics();
|
||||
}
|
||||
|
||||
|
||||
int main() {
|
||||
hipLaunchKernel(compileSinglePrecisionIntrinsics, dim3(1, 1, 1), dim3(1, 1, 1), 0, 0, 1);
|
||||
hipLaunchKernelGGL(compileSinglePrecisionIntrinsics, dim3(1, 1, 1), dim3(1, 1, 1), 0, 0, 1);
|
||||
passed();
|
||||
}
|
||||
|
||||
@@ -129,11 +129,11 @@ __device__ void single_precision_math_functions() {
|
||||
ynf(1, 1.0f);
|
||||
}
|
||||
|
||||
__global__ void compileSinglePrecisionMathOnDevice(hipLaunchParm lp, int ignored) {
|
||||
__global__ void compileSinglePrecisionMathOnDevice(int ignored) {
|
||||
single_precision_math_functions();
|
||||
}
|
||||
|
||||
int main() {
|
||||
hipLaunchKernel(compileSinglePrecisionMathOnDevice, dim3(1, 1, 1), dim3(1, 1, 1), 0, 0, 1);
|
||||
hipLaunchKernelGGL(compileSinglePrecisionMathOnDevice, dim3(1, 1, 1), dim3(1, 1, 1), 0, 0, 1);
|
||||
passed();
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ __device__ __host__ std::complex<FloatT> calc(std::complex<FloatT> A,
|
||||
}
|
||||
|
||||
template<typename FloatT>
|
||||
__global__ void kernel(hipLaunchParm lp, std::complex<FloatT>* A,
|
||||
__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;
|
||||
@@ -114,7 +114,7 @@ void test() {
|
||||
// Run kernel for a calculation kind and verify by comparing with host
|
||||
// calculation result. Returns false if fails.
|
||||
auto test_fun = [&](enum CalcKind CK) {
|
||||
hipLaunchKernel(kernel<FloatT>, dim3(1), dim3(LEN), 0, 0, Ad, Bd, Cd, CK);
|
||||
hipLaunchKernelGGL(kernel<FloatT>, dim3(1), dim3(LEN), 0, 0, Ad, Bd, Cd, CK);
|
||||
hipMemcpy(C, Cd, sizeof(ComplexT)*LEN, hipMemcpyDeviceToHost);
|
||||
for (int i = 0; i < LEN; i++) {
|
||||
ComplexT Expected = calc(A[i], B[i], CK);
|
||||
|
||||
@@ -31,74 +31,74 @@ THE SOFTWARE.
|
||||
#define N 512
|
||||
#define SIZE N * sizeof(double)
|
||||
|
||||
__global__ void test_sincos(hipLaunchParm lp, double* a, double* b, double* c) {
|
||||
__global__ void test_sincos(double* a, double* b, double* c) {
|
||||
int tid = threadIdx.x;
|
||||
sincos(a[tid], b + tid, c + tid);
|
||||
}
|
||||
|
||||
__global__ void test_sincospi(hipLaunchParm lp, double* a, double* b, double* c) {
|
||||
__global__ void test_sincospi(double* a, double* b, double* c) {
|
||||
int tid = threadIdx.x;
|
||||
sincospi(a[tid], b + tid, c + tid);
|
||||
}
|
||||
|
||||
__global__ void test_llrint(hipLaunchParm lp, double* a, long long int* b) {
|
||||
__global__ void test_llrint(double* a, long long int* b) {
|
||||
int tid = threadIdx.x;
|
||||
b[tid] = llrint(a[tid]);
|
||||
}
|
||||
|
||||
__global__ void test_lrint(hipLaunchParm lp, double* a, long int* b) {
|
||||
__global__ void test_lrint(double* a, long int* b) {
|
||||
int tid = threadIdx.x;
|
||||
b[tid] = lrint(a[tid]);
|
||||
}
|
||||
|
||||
__global__ void test_rint(hipLaunchParm lp, double* a, double* b) {
|
||||
__global__ void test_rint(double* a, double* b) {
|
||||
int tid = threadIdx.x;
|
||||
b[tid] = rint(a[tid]);
|
||||
}
|
||||
|
||||
__global__ void test_llround(hipLaunchParm lp, double* a, long long int* b) {
|
||||
__global__ void test_llround(double* a, long long int* b) {
|
||||
int tid = threadIdx.x;
|
||||
b[tid] = llround(a[tid]);
|
||||
}
|
||||
|
||||
__global__ void test_lround(hipLaunchParm lp, double* a, long int* b) {
|
||||
__global__ void test_lround(double* a, long int* b) {
|
||||
int tid = threadIdx.x;
|
||||
b[tid] = lround(a[tid]);
|
||||
}
|
||||
|
||||
__global__ void test_rhypot(hipLaunchParm lp, double* a, double* b, double* c) {
|
||||
__global__ void test_rhypot(double* a, double* b, double* c) {
|
||||
int tid = threadIdx.x;
|
||||
c[tid] = rhypot(a[tid], b[tid]);
|
||||
}
|
||||
|
||||
__global__ void test_norm3d(hipLaunchParm lp, double* a, double* b, double* c, double* d) {
|
||||
__global__ void test_norm3d(double* a, double* b, double* c, double* d) {
|
||||
int tid = threadIdx.x;
|
||||
d[tid] = norm3d(a[tid], b[tid], c[tid]);
|
||||
}
|
||||
|
||||
__global__ void test_norm4d(hipLaunchParm lp, double* a, double* b, double* c, double* d,
|
||||
__global__ void test_norm4d(double* a, double* b, double* c, double* d,
|
||||
double* e) {
|
||||
int tid = threadIdx.x;
|
||||
e[tid] = norm4d(a[tid], b[tid], c[tid], d[tid]);
|
||||
}
|
||||
|
||||
__global__ void test_rnorm3d(hipLaunchParm lp, double* a, double* b, double* c, double* d) {
|
||||
__global__ void test_rnorm3d(double* a, double* b, double* c, double* d) {
|
||||
int tid = threadIdx.x;
|
||||
d[tid] = rnorm3d(a[tid], b[tid], c[tid]);
|
||||
}
|
||||
|
||||
__global__ void test_rnorm4d(hipLaunchParm lp, double* a, double* b, double* c, double* d,
|
||||
__global__ void test_rnorm4d(double* a, double* b, double* c, double* d,
|
||||
double* e) {
|
||||
int tid = threadIdx.x;
|
||||
e[tid] = rnorm4d(a[tid], b[tid], c[tid], d[tid]);
|
||||
}
|
||||
|
||||
__global__ void test_rnorm(hipLaunchParm lp, double* a, double* b) {
|
||||
__global__ void test_rnorm(double* a, double* b) {
|
||||
int tid = threadIdx.x;
|
||||
b[tid] = rnorm(N, a);
|
||||
}
|
||||
|
||||
__global__ void test_erfinv(hipLaunchParm lp, double* a, double* b) {
|
||||
__global__ void test_erfinv(double* a, double* b) {
|
||||
int tid = threadIdx.x;
|
||||
b[tid] = erf(erfinv(a[tid]));
|
||||
}
|
||||
@@ -115,7 +115,7 @@ bool run_sincos() {
|
||||
hipMalloc((void**)&Bd, SIZE);
|
||||
hipMalloc((void**)&Cd, SIZE);
|
||||
hipMemcpy(Ad, A, SIZE, hipMemcpyHostToDevice);
|
||||
hipLaunchKernel(test_sincos, dim3(1), dim3(N), 0, 0, Ad, Bd, Cd);
|
||||
hipLaunchKernelGGL(test_sincos, dim3(1), dim3(N), 0, 0, Ad, Bd, Cd);
|
||||
hipMemcpy(B, Bd, SIZE, hipMemcpyDeviceToHost);
|
||||
hipMemcpy(C, Cd, SIZE, hipMemcpyDeviceToHost);
|
||||
int passed = 0;
|
||||
@@ -157,7 +157,7 @@ bool run_sincospi() {
|
||||
hipMalloc((void**)&Bd, SIZE);
|
||||
hipMalloc((void**)&Cd, SIZE);
|
||||
hipMemcpy(Ad, A, SIZE, hipMemcpyHostToDevice);
|
||||
hipLaunchKernel(test_sincospi, dim3(1), dim3(N), 0, 0, Ad, Bd, Cd);
|
||||
hipLaunchKernelGGL(test_sincospi, dim3(1), dim3(N), 0, 0, Ad, Bd, Cd);
|
||||
hipMemcpy(B, Bd, SIZE, hipMemcpyDeviceToHost);
|
||||
hipMemcpy(C, Cd, SIZE, hipMemcpyDeviceToHost);
|
||||
int passed = 0;
|
||||
@@ -199,7 +199,7 @@ bool run_llrint() {
|
||||
hipMalloc((void**)&Ad, SIZE);
|
||||
hipMalloc((void**)&Bd, N * sizeof(long long int));
|
||||
hipMemcpy(Ad, A, SIZE, hipMemcpyHostToDevice);
|
||||
hipLaunchKernel(test_llrint, dim3(1), dim3(N), 0, 0, Ad, Bd);
|
||||
hipLaunchKernelGGL(test_llrint, dim3(1), dim3(N), 0, 0, Ad, Bd);
|
||||
hipMemcpy(B, Bd, N * sizeof(long long int), hipMemcpyDeviceToHost);
|
||||
int passed = 0;
|
||||
for (int i = 0; i < 512; i++) {
|
||||
@@ -233,7 +233,7 @@ bool run_lrint() {
|
||||
hipMalloc((void**)&Ad, SIZE);
|
||||
hipMalloc((void**)&Bd, N * sizeof(long int));
|
||||
hipMemcpy(Ad, A, SIZE, hipMemcpyHostToDevice);
|
||||
hipLaunchKernel(test_lrint, dim3(1), dim3(N), 0, 0, Ad, Bd);
|
||||
hipLaunchKernelGGL(test_lrint, dim3(1), dim3(N), 0, 0, Ad, Bd);
|
||||
hipMemcpy(B, Bd, N * sizeof(long int), hipMemcpyDeviceToHost);
|
||||
int passed = 0;
|
||||
for (int i = 0; i < 512; i++) {
|
||||
@@ -266,7 +266,7 @@ bool run_rint() {
|
||||
hipMalloc((void**)&Ad, SIZE);
|
||||
hipMalloc((void**)&Bd, SIZE);
|
||||
hipMemcpy(Ad, A, SIZE, hipMemcpyHostToDevice);
|
||||
hipLaunchKernel(test_rint, dim3(1), dim3(N), 0, 0, Ad, Bd);
|
||||
hipLaunchKernelGGL(test_rint, dim3(1), dim3(N), 0, 0, Ad, Bd);
|
||||
hipMemcpy(B, Bd, SIZE, hipMemcpyDeviceToHost);
|
||||
int passed = 0;
|
||||
for (int i = 0; i < 512; i++) {
|
||||
@@ -300,7 +300,7 @@ bool run_llround() {
|
||||
hipMalloc((void**)&Ad, SIZE);
|
||||
hipMalloc((void**)&Bd, N * sizeof(long long int));
|
||||
hipMemcpy(Ad, A, SIZE, hipMemcpyHostToDevice);
|
||||
hipLaunchKernel(test_llround, dim3(1), dim3(N), 0, 0, Ad, Bd);
|
||||
hipLaunchKernelGGL(test_llround, dim3(1), dim3(N), 0, 0, Ad, Bd);
|
||||
hipMemcpy(B, Bd, N * sizeof(long long int), hipMemcpyDeviceToHost);
|
||||
int passed = 0;
|
||||
for (int i = 0; i < 512; i++) {
|
||||
@@ -333,7 +333,7 @@ bool run_lround() {
|
||||
hipMalloc((void**)&Ad, SIZE);
|
||||
hipMalloc((void**)&Bd, N * sizeof(long int));
|
||||
hipMemcpy(Ad, A, SIZE, hipMemcpyHostToDevice);
|
||||
hipLaunchKernel(test_lround, dim3(1), dim3(N), 0, 0, Ad, Bd);
|
||||
hipLaunchKernelGGL(test_lround, dim3(1), dim3(N), 0, 0, Ad, Bd);
|
||||
hipMemcpy(B, Bd, N * sizeof(long int), hipMemcpyDeviceToHost);
|
||||
int passed = 0;
|
||||
for (int i = 0; i < 512; i++) {
|
||||
@@ -376,7 +376,7 @@ bool run_norm3d() {
|
||||
hipMemcpy(Ad, A, SIZE, hipMemcpyHostToDevice);
|
||||
hipMemcpy(Bd, B, SIZE, hipMemcpyHostToDevice);
|
||||
hipMemcpy(Cd, C, SIZE, hipMemcpyHostToDevice);
|
||||
hipLaunchKernel(test_norm3d, dim3(1), dim3(N), 0, 0, Ad, Bd, Cd, Dd);
|
||||
hipLaunchKernelGGL(test_norm3d, dim3(1), dim3(N), 0, 0, Ad, Bd, Cd, Dd);
|
||||
hipMemcpy(D, Dd, SIZE, hipMemcpyDeviceToHost);
|
||||
int passed = 0;
|
||||
for (int i = 0; i < 512; i++) {
|
||||
@@ -425,7 +425,7 @@ bool run_norm4d() {
|
||||
hipMemcpy(Bd, B, SIZE, hipMemcpyHostToDevice);
|
||||
hipMemcpy(Cd, C, SIZE, hipMemcpyHostToDevice);
|
||||
hipMemcpy(Dd, D, SIZE, hipMemcpyHostToDevice);
|
||||
hipLaunchKernel(test_norm4d, dim3(1), dim3(N), 0, 0, Ad, Bd, Cd, Dd, Ed);
|
||||
hipLaunchKernelGGL(test_norm4d, dim3(1), dim3(N), 0, 0, Ad, Bd, Cd, Dd, Ed);
|
||||
hipMemcpy(E, Ed, SIZE, hipMemcpyDeviceToHost);
|
||||
int passed = 0;
|
||||
for (int i = 0; i < 512; i++) {
|
||||
@@ -469,7 +469,7 @@ bool run_rhypot() {
|
||||
hipMalloc((void**)&Cd, SIZE);
|
||||
hipMemcpy(Ad, A, SIZE, hipMemcpyHostToDevice);
|
||||
hipMemcpy(Bd, B, SIZE, hipMemcpyHostToDevice);
|
||||
hipLaunchKernel(test_rhypot, dim3(1), dim3(N), 0, 0, Ad, Bd, Cd);
|
||||
hipLaunchKernelGGL(test_rhypot, dim3(1), dim3(N), 0, 0, Ad, Bd, Cd);
|
||||
hipMemcpy(C, Cd, SIZE, hipMemcpyDeviceToHost);
|
||||
int passed = 0;
|
||||
for (int i = 0; i < 512; i++) {
|
||||
@@ -512,7 +512,7 @@ bool run_rnorm3d() {
|
||||
hipMemcpy(Ad, A, SIZE, hipMemcpyHostToDevice);
|
||||
hipMemcpy(Bd, B, SIZE, hipMemcpyHostToDevice);
|
||||
hipMemcpy(Cd, C, SIZE, hipMemcpyHostToDevice);
|
||||
hipLaunchKernel(test_rnorm3d, dim3(1), dim3(N), 0, 0, Ad, Bd, Cd, Dd);
|
||||
hipLaunchKernelGGL(test_rnorm3d, dim3(1), dim3(N), 0, 0, Ad, Bd, Cd, Dd);
|
||||
hipMemcpy(D, Dd, SIZE, hipMemcpyDeviceToHost);
|
||||
int passed = 0;
|
||||
for (int i = 0; i < 512; i++) {
|
||||
@@ -561,7 +561,7 @@ bool run_rnorm4d() {
|
||||
hipMemcpy(Bd, B, SIZE, hipMemcpyHostToDevice);
|
||||
hipMemcpy(Cd, C, SIZE, hipMemcpyHostToDevice);
|
||||
hipMemcpy(Dd, D, SIZE, hipMemcpyHostToDevice);
|
||||
hipLaunchKernel(test_rnorm4d, dim3(1), dim3(N), 0, 0, Ad, Bd, Cd, Dd, Ed);
|
||||
hipLaunchKernelGGL(test_rnorm4d, dim3(1), dim3(N), 0, 0, Ad, Bd, Cd, Dd, Ed);
|
||||
hipMemcpy(E, Ed, SIZE, hipMemcpyDeviceToHost);
|
||||
int passed = 0;
|
||||
for (int i = 0; i < 512; i++) {
|
||||
@@ -602,7 +602,7 @@ bool run_rnorm() {
|
||||
hipMalloc((void**)&Ad, SIZE);
|
||||
hipMalloc((void**)&Bd, SIZE);
|
||||
hipMemcpy(Ad, A, SIZE, hipMemcpyHostToDevice);
|
||||
hipLaunchKernel(test_rnorm, dim3(1), dim3(N), 0, 0, Ad, Bd);
|
||||
hipLaunchKernelGGL(test_rnorm, dim3(1), dim3(N), 0, 0, Ad, Bd);
|
||||
hipMemcpy(B, Bd, SIZE, hipMemcpyDeviceToHost);
|
||||
int passed = 0;
|
||||
for (int i = 0; i < 512; i++) {
|
||||
@@ -634,7 +634,7 @@ bool run_erfinv() {
|
||||
hipMalloc((void**)&Ad, SIZE);
|
||||
hipMalloc((void**)&Bd, SIZE);
|
||||
hipMemcpy(Ad, A, SIZE, hipMemcpyHostToDevice);
|
||||
hipLaunchKernel(test_erfinv, dim3(1), dim3(N), 0, 0, Ad, Bd);
|
||||
hipLaunchKernelGGL(test_erfinv, dim3(1), dim3(N), 0, 0, Ad, Bd);
|
||||
hipMemcpy(B, Bd, SIZE, hipMemcpyDeviceToHost);
|
||||
int passed = 0;
|
||||
for (int i = 0; i < 512; i++) {
|
||||
|
||||
@@ -34,7 +34,7 @@ THE SOFTWARE.
|
||||
__device__ int globalIn[NUM];
|
||||
__device__ int globalOut[NUM];
|
||||
|
||||
__global__ void Assign(hipLaunchParm lp, int* Out) {
|
||||
__global__ void Assign(int* Out) {
|
||||
int tid = threadIdx.x + blockIdx.x * blockDim.x;
|
||||
Out[tid] = globalIn[tid];
|
||||
globalOut[tid] = globalIn[tid];
|
||||
@@ -63,7 +63,7 @@ int main() {
|
||||
hipStreamCreate(&stream);
|
||||
hipMemcpyToSymbolAsync(HIP_SYMBOL(globalIn), Am, SIZE, 0, hipMemcpyHostToDevice, stream);
|
||||
hipStreamSynchronize(stream);
|
||||
hipLaunchKernel(Assign, dim3(1, 1, 1), dim3(NUM, 1, 1), 0, 0, Ad);
|
||||
hipLaunchKernelGGL(Assign, dim3(1, 1, 1), dim3(NUM, 1, 1), 0, 0, Ad);
|
||||
hipMemcpy(B, Ad, SIZE, hipMemcpyDeviceToHost);
|
||||
hipMemcpyFromSymbolAsync(Cm, HIP_SYMBOL(globalOut), SIZE, 0, hipMemcpyDeviceToHost, stream);
|
||||
hipStreamSynchronize(stream);
|
||||
@@ -78,7 +78,7 @@ int main() {
|
||||
}
|
||||
|
||||
hipMemcpyToSymbol(HIP_SYMBOL(globalIn), A, SIZE, 0, hipMemcpyHostToDevice);
|
||||
hipLaunchKernel(Assign, dim3(1, 1, 1), dim3(NUM, 1, 1), 0, 0, Ad);
|
||||
hipLaunchKernelGGL(Assign, dim3(1, 1, 1), dim3(NUM, 1, 1), 0, 0, Ad);
|
||||
hipMemcpy(B, Ad, SIZE, hipMemcpyDeviceToHost);
|
||||
hipMemcpyFromSymbol(C, HIP_SYMBOL(globalOut), SIZE, 0, hipMemcpyDeviceToHost);
|
||||
for (int i = 0; i < NUM; i++) {
|
||||
@@ -93,7 +93,7 @@ int main() {
|
||||
|
||||
hipMemcpyToSymbolAsync(HIP_SYMBOL(globalIn), A, SIZE, 0, hipMemcpyHostToDevice, stream);
|
||||
hipStreamSynchronize(stream);
|
||||
hipLaunchKernel(Assign, dim3(1, 1, 1), dim3(NUM, 1, 1), 0, 0, Ad);
|
||||
hipLaunchKernelGGL(Assign, dim3(1, 1, 1), dim3(NUM, 1, 1), 0, 0, Ad);
|
||||
hipMemcpy(B, Ad, SIZE, hipMemcpyDeviceToHost);
|
||||
hipMemcpyFromSymbolAsync(C, HIP_SYMBOL(globalOut), SIZE, 0, hipMemcpyDeviceToHost, stream);
|
||||
hipStreamSynchronize(stream);
|
||||
|
||||
@@ -31,7 +31,7 @@ THE SOFTWARE.
|
||||
#define NUM 1024
|
||||
#define SIZE NUM * sizeof(float)
|
||||
|
||||
__global__ void vAdd(hipLaunchParm lp, float* In1, float* In2, float* In3, float* In4, float* Out) {
|
||||
__global__ void vAdd(float* In1, float* In2, float* In3, float* In4, float* Out) {
|
||||
int tid = threadIdx.x + blockIdx.x * blockDim.x;
|
||||
In4[tid] = In1[tid] + In2[tid];
|
||||
__threadfence();
|
||||
@@ -66,7 +66,7 @@ int main() {
|
||||
hipMemcpy(In3d, In3, SIZE, hipMemcpyHostToDevice);
|
||||
hipMemcpy(In4d, In4, SIZE, hipMemcpyHostToDevice);
|
||||
|
||||
hipLaunchKernel(vAdd, dim3(32, 1, 1), dim3(32, 1, 1), 0, 0, In1d, In2d, In3d, In4d, Outd);
|
||||
hipLaunchKernelGGL(vAdd, dim3(32, 1, 1), dim3(32, 1, 1), 0, 0, In1d, In2d, In3d, In4d, Outd);
|
||||
hipMemcpy(Out, Outd, SIZE, hipMemcpyDeviceToHost);
|
||||
assert(Out[10] == 2 * In1[10] + 2 * In2[10] + In3[10]);
|
||||
passed();
|
||||
|
||||
@@ -33,7 +33,7 @@ THE SOFTWARE.
|
||||
#include <hip/device_functions.h>
|
||||
#define HIP_ASSERT(x) (assert((x) == hipSuccess))
|
||||
|
||||
__global__ void warpvote(hipLaunchParm lp, int* device_any, int* device_all,
|
||||
__global__ void warpvote(int* device_any, int* device_all,
|
||||
int Num_Warps_per_Block, int pshift) {
|
||||
int tid = threadIdx.x + blockIdx.x * blockDim.x;
|
||||
device_any[threadIdx.x >> pshift] = __any(tid - 77);
|
||||
@@ -73,7 +73,7 @@ int main(int argc, char* argv[]) {
|
||||
HIP_ASSERT(hipMemcpy(device_any, host_any, sizeof(int), hipMemcpyHostToDevice));
|
||||
HIP_ASSERT(hipMemcpy(device_all, host_all, sizeof(int), hipMemcpyHostToDevice));
|
||||
|
||||
hipLaunchKernel(warpvote, dim3(Num_Blocks_per_Grid), dim3(Num_Threads_per_Block), 0, 0,
|
||||
hipLaunchKernelGGL(warpvote, dim3(Num_Blocks_per_Grid), dim3(Num_Threads_per_Block), 0, 0,
|
||||
device_any, device_all, Num_Warps_per_Block, pshift);
|
||||
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ THE SOFTWARE.
|
||||
|
||||
#define HIP_ASSERT(x) (assert((x) == hipSuccess))
|
||||
|
||||
__global__ void gpu_ballot(hipLaunchParm lp, unsigned int* device_ballot, int Num_Warps_per_Block,
|
||||
__global__ void gpu_ballot(unsigned int* device_ballot, int Num_Warps_per_Block,
|
||||
int pshift) {
|
||||
int tid = threadIdx.x + blockIdx.x * blockDim.x;
|
||||
const unsigned int warp_num = threadIdx.x >> pshift;
|
||||
@@ -69,7 +69,7 @@ int main(int argc, char* argv[]) {
|
||||
HIP_ASSERT(hipMemcpy(device_ballot, host_ballot, Num_Warps_per_Grid * sizeof(unsigned int),
|
||||
hipMemcpyHostToDevice));
|
||||
|
||||
hipLaunchKernel(gpu_ballot, dim3(Num_Blocks_per_Grid), dim3(Num_Threads_per_Block), 0, 0,
|
||||
hipLaunchKernelGGL(gpu_ballot, dim3(Num_Blocks_per_Grid), dim3(Num_Threads_per_Block), 0, 0,
|
||||
device_ballot, Num_Warps_per_Block, pshift);
|
||||
|
||||
|
||||
|
||||
@@ -53,8 +53,7 @@ T bit_extract(T src0, unsigned int src1, unsigned int src2) {
|
||||
}
|
||||
}
|
||||
|
||||
__global__ void HIP_kernel(hipLaunchParm lp,
|
||||
unsigned int* out32, unsigned int* in32_0,
|
||||
__global__ void HIP_kernel(unsigned int* out32, unsigned int* in32_0,
|
||||
unsigned int* in32_1, unsigned int* in32_2,
|
||||
unsigned long long int* out64, unsigned long long int* in64_0,
|
||||
unsigned int* in64_1, unsigned int* in64_2) {
|
||||
@@ -150,7 +149,7 @@ int main() {
|
||||
HIP_ASSERT(hipMemcpy(deviceSrc264, hostSrc264, NUM * sizeof(unsigned int), hipMemcpyHostToDevice));
|
||||
|
||||
|
||||
hipLaunchKernel(HIP_kernel, dim3(num_blocks), dim3(num_threads_per_block),
|
||||
hipLaunchKernelGGL(HIP_kernel, dim3(num_blocks), dim3(num_threads_per_block),
|
||||
0, 0,
|
||||
deviceOut32, deviceSrc032, deviceSrc132, deviceSrc232,
|
||||
deviceOut64, deviceSrc064, deviceSrc164, deviceSrc264);
|
||||
|
||||
@@ -50,7 +50,7 @@ T bit_insert(T src0, T src1, unsigned int src2, unsigned int src3) {
|
||||
return ((src0 & ~(mask << offset)) | ((src1 & mask) << offset));
|
||||
}
|
||||
|
||||
__global__ void HIP_kernel(hipLaunchParm lp, unsigned int* out32,
|
||||
__global__ void HIP_kernel(unsigned int* out32,
|
||||
unsigned int* in32_0, unsigned int* in32_1,
|
||||
unsigned int* in32_2, unsigned int* in32_3,
|
||||
unsigned long long int* out64, unsigned long long int* in64_0,
|
||||
@@ -161,7 +161,7 @@ int main() {
|
||||
HIP_ASSERT(hipMemcpy(deviceSrc364, hostSrc364, NUM * sizeof(unsigned int), hipMemcpyHostToDevice));
|
||||
|
||||
|
||||
hipLaunchKernel(HIP_kernel, dim3(num_blocks), dim3(num_threads_per_block),
|
||||
hipLaunchKernelGGL(HIP_kernel, dim3(num_blocks), dim3(num_threads_per_block),
|
||||
0, 0,
|
||||
deviceOut32, deviceSrc032, deviceSrc132, deviceSrc232, deviceSrc332,
|
||||
deviceOut64, deviceSrc064, deviceSrc164, deviceSrc264, deviceSrc364);
|
||||
|
||||
@@ -64,7 +64,7 @@ T bitreverse(T num) {
|
||||
return reverse_num;
|
||||
}
|
||||
|
||||
__global__ void HIP_kernel(hipLaunchParm lp, unsigned int* a, unsigned int* b,
|
||||
__global__ void HIP_kernel(unsigned int* a, unsigned int* b,
|
||||
unsigned long long int* c, unsigned long long int* d, int width,
|
||||
int height) {
|
||||
int x = blockDim.x * blockIdx.x + threadIdx.x;
|
||||
@@ -124,7 +124,7 @@ int main() {
|
||||
hipMemcpy(deviceD, hostD, NUM * sizeof(unsigned long long int), hipMemcpyHostToDevice));
|
||||
|
||||
|
||||
hipLaunchKernel(HIP_kernel, dim3(WIDTH / THREADS_PER_BLOCK_X, HEIGHT / THREADS_PER_BLOCK_Y),
|
||||
hipLaunchKernelGGL(HIP_kernel, dim3(WIDTH / THREADS_PER_BLOCK_X, HEIGHT / THREADS_PER_BLOCK_Y),
|
||||
dim3(THREADS_PER_BLOCK_X, THREADS_PER_BLOCK_Y), 0, 0, deviceA, deviceB, deviceC,
|
||||
deviceD, WIDTH, HEIGHT);
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ __device__ void test_ambiguity() {
|
||||
__clzll(ui);
|
||||
}
|
||||
|
||||
__global__ void HIP_kernel(hipLaunchParm lp, unsigned int* a, unsigned int* b, unsigned int* c,
|
||||
__global__ void HIP_kernel(unsigned int* a, unsigned int* b, unsigned int* c,
|
||||
unsigned long long int* d, int width, int height) {
|
||||
int x = blockDim.x * blockIdx.x + threadIdx.x;
|
||||
int y = blockDim.y * blockIdx.y + threadIdx.y;
|
||||
@@ -138,7 +138,7 @@ int main() {
|
||||
HIP_ASSERT(
|
||||
hipMemcpy(deviceD, hostD, NUM * sizeof(unsigned long long int), hipMemcpyHostToDevice));
|
||||
|
||||
hipLaunchKernel(HIP_kernel, dim3(WIDTH / THREADS_PER_BLOCK_X, HEIGHT / THREADS_PER_BLOCK_Y),
|
||||
hipLaunchKernelGGL(HIP_kernel, dim3(WIDTH / THREADS_PER_BLOCK_X, HEIGHT / THREADS_PER_BLOCK_Y),
|
||||
dim3(THREADS_PER_BLOCK_X, THREADS_PER_BLOCK_Y), 0, 0, deviceA, deviceB, deviceC,
|
||||
deviceD, WIDTH, HEIGHT);
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ int lastbit(T a) {
|
||||
}
|
||||
|
||||
|
||||
__global__ void HIP_kernel(hipLaunchParm lp, unsigned int* a, unsigned int* b, unsigned int* c,
|
||||
__global__ void HIP_kernel(unsigned int* a, unsigned int* b, unsigned int* c,
|
||||
unsigned long long int* d, int width, int height) {
|
||||
int x = blockDim.x * blockIdx.x + threadIdx.x;
|
||||
int y = blockDim.y * blockIdx.y + threadIdx.y;
|
||||
@@ -117,7 +117,7 @@ int main() {
|
||||
HIP_ASSERT(
|
||||
hipMemcpy(deviceD, hostD, NUM * sizeof(unsigned long long int), hipMemcpyHostToDevice));
|
||||
|
||||
hipLaunchKernel(HIP_kernel, dim3(WIDTH / THREADS_PER_BLOCK_X, HEIGHT / THREADS_PER_BLOCK_Y),
|
||||
hipLaunchKernelGGL(HIP_kernel, dim3(WIDTH / THREADS_PER_BLOCK_X, HEIGHT / THREADS_PER_BLOCK_Y),
|
||||
dim3(THREADS_PER_BLOCK_X, THREADS_PER_BLOCK_Y), 0, 0, deviceA, deviceB, deviceC,
|
||||
deviceD, WIDTH, HEIGHT);
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ THE SOFTWARE.
|
||||
|
||||
#define HIP_ASSERT(x) (assert((x) == hipSuccess))
|
||||
|
||||
__global__ void HIP_kernel(hipLaunchParm lp, unsigned int* mbcnt_lo, unsigned int* mbcnt_hi, unsigned int* lane_id) {
|
||||
__global__ void HIP_kernel(unsigned int* mbcnt_lo, unsigned int* mbcnt_hi, unsigned int* lane_id) {
|
||||
int x = blockDim.x * blockIdx.x + threadIdx.x;
|
||||
mbcnt_lo[x] = __mbcnt_lo(0xFFFFFFFF, 0);
|
||||
mbcnt_hi[x] = __mbcnt_hi(0xFFFFFFFF, 0);
|
||||
@@ -70,7 +70,7 @@ int main() {
|
||||
HIP_ASSERT(hipMalloc((void**)&device_mbcnt_hi, buffer_size));
|
||||
HIP_ASSERT(hipMalloc((void**)&device_lane_id, buffer_size));
|
||||
|
||||
hipLaunchKernel(HIP_kernel, dim3(num_blocks),
|
||||
hipLaunchKernelGGL(HIP_kernel, dim3(num_blocks),
|
||||
dim3(num_threads_per_block), 0, 0, device_mbcnt_lo, device_mbcnt_hi, device_lane_id);
|
||||
|
||||
unsigned int* host_mbcnt_lo = (unsigned int*) malloc(buffer_size);
|
||||
|
||||
@@ -58,7 +58,7 @@ unsigned int popcountCPU(T value) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
__global__ void HIP_kernel(hipLaunchParm lp, unsigned int* a, unsigned int* b, unsigned int* c,
|
||||
__global__ void HIP_kernel(unsigned int* a, unsigned int* b, unsigned int* c,
|
||||
unsigned long long int* d, int width, int height) {
|
||||
int x = blockDim.x * blockIdx.x + threadIdx.x;
|
||||
int y = blockDim.y * blockIdx.y + threadIdx.y;
|
||||
@@ -117,7 +117,7 @@ int main() {
|
||||
hipMemcpy(deviceD, hostD, NUM * sizeof(unsigned long long int), hipMemcpyHostToDevice));
|
||||
|
||||
|
||||
hipLaunchKernel(HIP_kernel, dim3(WIDTH / THREADS_PER_BLOCK_X, HEIGHT / THREADS_PER_BLOCK_Y),
|
||||
hipLaunchKernelGGL(HIP_kernel, dim3(WIDTH / THREADS_PER_BLOCK_X, HEIGHT / THREADS_PER_BLOCK_Y),
|
||||
dim3(THREADS_PER_BLOCK_X, THREADS_PER_BLOCK_Y), 0, 0, deviceA, deviceB, deviceC,
|
||||
deviceD, WIDTH, HEIGHT);
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ THE SOFTWARE.
|
||||
using namespace std;
|
||||
|
||||
template <typename T>
|
||||
__global__ void vectoradd_float(hipLaunchParm lp, T* a, const T* bm, int width, int height)
|
||||
__global__ void vectoradd_float(T* a, const T* bm, int width, int height)
|
||||
|
||||
{
|
||||
int x = blockDim.x * blockIdx.x + threadIdx.x;
|
||||
@@ -120,7 +120,7 @@ bool dataTypesRun() {
|
||||
HIP_ASSERT(hipMemcpy(deviceB, hostB, NUM * sizeof(T), hipMemcpyHostToDevice));
|
||||
|
||||
|
||||
hipLaunchKernel(vectoradd_float,
|
||||
hipLaunchKernelGGL(vectoradd_float,
|
||||
dim3(WIDTH / THREADS_PER_BLOCK_X, HEIGHT / THREADS_PER_BLOCK_Y),
|
||||
dim3(THREADS_PER_BLOCK_X, THREADS_PER_BLOCK_Y), 0, 0, deviceA,
|
||||
static_cast<const T*>(deviceB), WIDTH, HEIGHT);
|
||||
@@ -178,7 +178,7 @@ bool dataTypesRun2() {
|
||||
HIP_ASSERT(hipMalloc((void**)&deviceB, NUM * sizeof(T)));
|
||||
|
||||
HIP_ASSERT(hipMemcpy(deviceB, hostB, NUM * sizeof(T), hipMemcpyHostToDevice));
|
||||
hipLaunchKernel(vectoradd_float,
|
||||
hipLaunchKernelGGL(vectoradd_float,
|
||||
dim3(WIDTH / THREADS_PER_BLOCK_X, HEIGHT / THREADS_PER_BLOCK_Y),
|
||||
dim3(THREADS_PER_BLOCK_X, THREADS_PER_BLOCK_Y), 0, 0, deviceA,
|
||||
static_cast<const T*>(deviceB), WIDTH, HEIGHT);
|
||||
@@ -236,7 +236,7 @@ bool dataTypesRun4() {
|
||||
HIP_ASSERT(hipMemcpy(deviceB, hostB, NUM * sizeof(T), hipMemcpyHostToDevice));
|
||||
|
||||
|
||||
hipLaunchKernel(vectoradd_float,
|
||||
hipLaunchKernelGGL(vectoradd_float,
|
||||
dim3(WIDTH / THREADS_PER_BLOCK_X, HEIGHT / THREADS_PER_BLOCK_Y),
|
||||
dim3(THREADS_PER_BLOCK_X, THREADS_PER_BLOCK_Y), 0, 0, deviceA,
|
||||
static_cast<const T*>(deviceB), WIDTH, HEIGHT);
|
||||
|
||||
@@ -40,7 +40,7 @@ THE SOFTWARE.
|
||||
|
||||
#define TEST_DEBUG (0)
|
||||
|
||||
__global__ void kernel_trig(hipLaunchParm lp, float* In, float* sin_d, float* cos_d, float* tan_d,
|
||||
__global__ void kernel_trig(float* In, float* sin_d, float* cos_d, float* tan_d,
|
||||
float* sin_pd, float* cos_pd) {
|
||||
int tid = threadIdx.x + blockIdx.x * blockDim.x;
|
||||
sin_d[tid] = sinf(In[tid]);
|
||||
@@ -75,7 +75,7 @@ int main() {
|
||||
HIP_ASSERT(hipMalloc((void**)&cos_pd, SIZE));
|
||||
|
||||
hipMemcpy(In_d, In, SIZE, hipMemcpyHostToDevice);
|
||||
hipLaunchKernel(kernel_trig, dim3(LEN, 1, 1), dim3(1, 1, 1), 0, 0,
|
||||
hipLaunchKernelGGL(kernel_trig, dim3(LEN, 1, 1), dim3(1, 1, 1), 0, 0,
|
||||
In_d, sin_d, cos_d, tan_d,
|
||||
sin_pd, cos_pd);
|
||||
hipMemcpy(sin_h, sin_d, SIZE, hipMemcpyDeviceToHost);
|
||||
|
||||
Reference in New Issue
Block a user