2016-04-16 21:12:09 +08:00
|
|
|
/*
|
|
|
|
|
Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved.
|
|
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
|
THE SOFTWARE.
|
|
|
|
|
*/
|
2016-09-27 17:24:33 +05:30
|
|
|
|
|
|
|
|
/* HIT_START
|
|
|
|
|
* BUILD: %t %s ../test_common.cpp NVCC_OPTIONS --gpu-architecture=sm_35
|
|
|
|
|
* RUN: %t
|
|
|
|
|
* HIT_END
|
|
|
|
|
*/
|
|
|
|
|
|
2016-04-16 21:12:09 +08:00
|
|
|
#include <assert.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include<iostream>
|
2016-10-04 22:20:50 +05:30
|
|
|
#include "hip/hip_runtime.h"
|
2017-01-11 15:06:25 -06:00
|
|
|
#include "hip/hip_vector_types.h"
|
2016-04-20 14:21:22 -05:00
|
|
|
#include "test_common.h"
|
2016-06-06 13:20:45 +05:30
|
|
|
|
|
|
|
|
#if (__hcc_workweek__ >= 16164) || defined (__HIP_PLATFORM_NVCC__)
|
|
|
|
|
|
2016-04-16 21:12:09 +08:00
|
|
|
#define HIP_ASSERT(x) (assert((x)==hipSuccess))
|
|
|
|
|
|
|
|
|
|
|
2016-04-20 12:25:40 -05:00
|
|
|
#define WIDTH 8
|
|
|
|
|
#define HEIGHT 8
|
2016-04-16 21:12:09 +08:00
|
|
|
|
|
|
|
|
#define NUM (WIDTH*HEIGHT)
|
|
|
|
|
|
2016-04-20 12:25:40 -05:00
|
|
|
#define THREADS_PER_BLOCK_X 8
|
|
|
|
|
#define THREADS_PER_BLOCK_Y 8
|
2016-04-16 21:12:09 +08:00
|
|
|
#define THREADS_PER_BLOCK_Z 1
|
|
|
|
|
|
2016-06-06 13:20:45 +05:30
|
|
|
using namespace std;
|
|
|
|
|
|
2016-04-20 12:25:40 -05:00
|
|
|
template<typename T>
|
2016-06-06 13:20:45 +05:30
|
|
|
__global__ void
|
2016-04-16 21:12:09 +08:00
|
|
|
vectoradd_float(hipLaunchParm lp,
|
2016-06-06 13:20:45 +05:30
|
|
|
T* a, const T* bm, int width, int height)
|
2016-04-16 21:12:09 +08:00
|
|
|
|
|
|
|
|
{
|
2017-11-29 21:49:10 +00:00
|
|
|
int x = blockDim.x * blockIdx.x + threadIdx.x;
|
|
|
|
|
int y = blockDim.y * blockIdx.y + threadIdx.y;
|
2016-04-16 21:12:09 +08:00
|
|
|
|
|
|
|
|
int i = y * width + x;
|
|
|
|
|
if ( i < (width * height)) {
|
2016-06-06 13:20:45 +05:30
|
|
|
a[i] = __ldg(&bm[i]) ;
|
2016-04-16 21:12:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-06 13:20:45 +05:30
|
|
|
int2 make_vector2(int a){
|
|
|
|
|
return make_int2(a,a);
|
|
|
|
|
}
|
2016-04-16 21:12:09 +08:00
|
|
|
|
2016-06-06 13:20:45 +05:30
|
|
|
char2 make_vector2(signed char a){
|
|
|
|
|
return make_char2(a, a);
|
|
|
|
|
}
|
2016-04-16 21:12:09 +08:00
|
|
|
|
2016-06-06 13:20:45 +05:30
|
|
|
char4 make_vector4(signed char a){
|
|
|
|
|
return make_char4(a, a, a ,a);
|
2016-04-16 21:12:09 +08:00
|
|
|
}
|
|
|
|
|
|
2016-06-06 13:20:45 +05:30
|
|
|
short2 make_vector2(short a){
|
|
|
|
|
return make_short2(a,a);
|
|
|
|
|
}
|
2016-04-16 21:12:09 +08:00
|
|
|
|
2016-06-06 13:20:45 +05:30
|
|
|
ushort2 make_vector2(unsigned short a){
|
|
|
|
|
return make_ushort2(a,a);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
short4 make_vector4(short a){
|
|
|
|
|
return make_short4(a,a,a,a);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int4 make_vector4(int a){
|
|
|
|
|
return make_int4(a,a,a,a);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint2 make_vector2 (unsigned int a){
|
|
|
|
|
return make_uint2 (a,a);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint4 make_vector4 (unsigned int a){
|
|
|
|
|
return make_uint4 (a,a,a,a);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float2 make_vector2 (float a){
|
|
|
|
|
return make_float2 (a,a);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float4 make_vector4 (float a){
|
|
|
|
|
return make_float4 (a,a,a,a);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uchar2 make_vector2 (unsigned char a){
|
|
|
|
|
return make_uchar2 (a,a);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uchar4 make_vector4 (unsigned char a){
|
|
|
|
|
return make_uchar4 (a,a,a,a);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
double2 make_vector2 (double a){
|
|
|
|
|
return make_double2 (a,a);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<typename T, typename U>
|
2016-04-20 12:25:40 -05:00
|
|
|
bool dataTypesRun(){
|
|
|
|
|
T* hostA;
|
|
|
|
|
T* hostB;
|
2016-06-06 13:20:45 +05:30
|
|
|
|
2016-04-16 21:12:09 +08:00
|
|
|
|
2016-04-20 12:25:40 -05:00
|
|
|
T* deviceA;
|
|
|
|
|
T* deviceB;
|
2016-06-06 13:20:45 +05:30
|
|
|
|
2016-04-16 21:12:09 +08:00
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
int errors;
|
|
|
|
|
|
2016-04-20 12:25:40 -05:00
|
|
|
hostA = (T*)malloc(NUM * sizeof(T));
|
|
|
|
|
hostB = (T*)malloc(NUM * sizeof(T));
|
2016-06-06 13:20:45 +05:30
|
|
|
|
2016-04-16 21:12:09 +08:00
|
|
|
// initialize the input data
|
|
|
|
|
for (i = 0; i < NUM; i++) {
|
2016-06-06 13:20:45 +05:30
|
|
|
hostB[i] = (U)i;
|
2016-04-16 21:12:09 +08:00
|
|
|
}
|
2016-06-06 13:20:45 +05:30
|
|
|
|
2016-04-20 12:25:40 -05:00
|
|
|
HIP_ASSERT(hipMalloc((void**)&deviceA, NUM * sizeof(T)));
|
|
|
|
|
HIP_ASSERT(hipMalloc((void**)&deviceB, NUM * sizeof(T)));
|
2016-06-06 13:20:45 +05:30
|
|
|
|
2016-04-20 12:25:40 -05:00
|
|
|
HIP_ASSERT(hipMemcpy(deviceB, hostB, NUM*sizeof(T), hipMemcpyHostToDevice));
|
2016-04-16 21:12:09 +08:00
|
|
|
|
|
|
|
|
|
This switches HIP from its currently convoluted macro + pfe based dispatch mechanism to a more natural one partially based on the existing module API. The basic idea is that HCC will always correctly emit __global__ functions: as empty-bodied stubs, on host, and as kernels, on device. It then becomes trivial to obtain the mangled name on host, at dispatch, from the function's address, and then to use the mangled name to retrieve the kernel. This should address all problems stemming from serialisation, dubious mismatches due to the manufactured functor, macro-isms et al. It also immediately enables support for generalised globals as a consequence of that being available in the module API. Finally, it will make debug much easier, since the actual names of the __global__ functions will automatically be used in traces etc. One detail is that due to how dispatch works now (hipLaunchKernel and hipLaunchKernelGGL are themselves variadic function templates which deduce the function type of the callee), in certain cases it may be necesssary to insert explicit casts to ensure that the variadic argument list selects a viable overload - this can be observed in some unit tests. Eventually we may be able to remove this limitation, but for now it does not appear terribly onerous. The code is not extremely HIPpie, nor is it fully optimised, but rather is intended as a starting point for the HIP team to make its own.
2017-11-01 15:09:59 +00:00
|
|
|
hipLaunchKernel(
|
|
|
|
|
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);
|
2016-04-16 21:12:09 +08:00
|
|
|
|
|
|
|
|
|
2016-04-20 12:25:40 -05:00
|
|
|
HIP_ASSERT(hipMemcpy(hostA, deviceA, NUM*sizeof(T), hipMemcpyDeviceToHost));
|
2016-04-16 21:12:09 +08:00
|
|
|
|
2016-04-20 12:25:40 -05:00
|
|
|
bool ret = false;
|
2016-04-16 21:12:09 +08:00
|
|
|
// verify the results
|
|
|
|
|
errors = 0;
|
|
|
|
|
for (i = 0; i < NUM; i++) {
|
2016-06-06 13:20:45 +05:30
|
|
|
if (hostA[i] != (hostB[i])) {
|
2016-04-16 21:12:09 +08:00
|
|
|
errors++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (errors!=0) {
|
2016-06-06 13:20:45 +05:30
|
|
|
std::cout << "FAILED\n"<<std::endl;
|
2016-04-20 12:25:40 -05:00
|
|
|
ret = false;
|
2016-04-16 21:12:09 +08:00
|
|
|
} else {
|
2016-04-20 12:25:40 -05:00
|
|
|
ret = true;
|
2016-04-16 21:12:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HIP_ASSERT(hipFree(deviceA));
|
|
|
|
|
HIP_ASSERT(hipFree(deviceB));
|
|
|
|
|
|
|
|
|
|
free(hostA);
|
|
|
|
|
free(hostB);
|
|
|
|
|
|
2016-04-20 12:25:40 -05:00
|
|
|
return ret;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-06 13:20:45 +05:30
|
|
|
template<typename T, typename U>
|
|
|
|
|
bool dataTypesRun2(){
|
|
|
|
|
T* hostA;
|
|
|
|
|
T* hostB;
|
2016-04-22 09:25:09 -05:00
|
|
|
|
|
|
|
|
|
2016-06-06 13:20:45 +05:30
|
|
|
T* deviceA;
|
|
|
|
|
T* deviceB;
|
2016-04-22 09:25:09 -05:00
|
|
|
|
|
|
|
|
|
2016-06-06 13:20:45 +05:30
|
|
|
int i;
|
|
|
|
|
int errors;
|
2016-04-22 09:25:09 -05:00
|
|
|
|
2016-06-06 13:20:45 +05:30
|
|
|
hostA = (T*)malloc(NUM * sizeof(T));
|
|
|
|
|
hostB = (T*)malloc(NUM * sizeof(T));
|
2016-04-22 09:25:09 -05:00
|
|
|
|
2016-06-06 13:20:45 +05:30
|
|
|
// initialize the input data
|
|
|
|
|
for (i = 0; i < NUM; i++) {
|
|
|
|
|
hostB[i] = make_vector2((U)i);
|
2016-04-22 09:25:09 -05:00
|
|
|
|
2016-06-06 13:20:45 +05:30
|
|
|
}
|
2016-04-22 09:25:09 -05:00
|
|
|
|
2016-06-06 13:20:45 +05:30
|
|
|
HIP_ASSERT(hipMalloc((void**)&deviceA, NUM * sizeof(T)));
|
|
|
|
|
HIP_ASSERT(hipMalloc((void**)&deviceB, NUM * sizeof(T)));
|
2016-04-22 09:25:09 -05:00
|
|
|
|
2016-06-06 13:20:45 +05:30
|
|
|
HIP_ASSERT(hipMemcpy(deviceB, hostB, NUM*sizeof(T), hipMemcpyHostToDevice));
|
This switches HIP from its currently convoluted macro + pfe based dispatch mechanism to a more natural one partially based on the existing module API. The basic idea is that HCC will always correctly emit __global__ functions: as empty-bodied stubs, on host, and as kernels, on device. It then becomes trivial to obtain the mangled name on host, at dispatch, from the function's address, and then to use the mangled name to retrieve the kernel. This should address all problems stemming from serialisation, dubious mismatches due to the manufactured functor, macro-isms et al. It also immediately enables support for generalised globals as a consequence of that being available in the module API. Finally, it will make debug much easier, since the actual names of the __global__ functions will automatically be used in traces etc. One detail is that due to how dispatch works now (hipLaunchKernel and hipLaunchKernelGGL are themselves variadic function templates which deduce the function type of the callee), in certain cases it may be necesssary to insert explicit casts to ensure that the variadic argument list selects a viable overload - this can be observed in some unit tests. Eventually we may be able to remove this limitation, but for now it does not appear terribly onerous. The code is not extremely HIPpie, nor is it fully optimised, but rather is intended as a starting point for the HIP team to make its own.
2017-11-01 15:09:59 +00:00
|
|
|
hipLaunchKernel(
|
|
|
|
|
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);
|
2016-04-22 09:25:09 -05:00
|
|
|
|
|
|
|
|
|
2016-06-06 13:20:45 +05:30
|
|
|
HIP_ASSERT(hipMemcpy(hostA, deviceA, NUM*sizeof(T), hipMemcpyDeviceToHost));
|
|
|
|
|
|
|
|
|
|
bool ret = false;
|
|
|
|
|
// verify the results
|
|
|
|
|
errors = 0;
|
|
|
|
|
for (i = 0; i < NUM; i++) {
|
2016-06-17 14:56:53 -05:00
|
|
|
if (hostA[i].x != (hostB[i].x) && hostA[i].y != (hostB[i].y)) {
|
2016-06-06 13:20:45 +05:30
|
|
|
errors++;
|
2016-04-22 09:25:09 -05:00
|
|
|
}
|
2016-06-06 13:20:45 +05:30
|
|
|
}
|
|
|
|
|
if (errors!=0) {
|
|
|
|
|
std::cout << "FAILED\n"<<std::endl;
|
|
|
|
|
ret = false;
|
|
|
|
|
} else {
|
2016-06-17 14:56:53 -05:00
|
|
|
ret = true;
|
2016-06-06 13:20:45 +05:30
|
|
|
}
|
2016-04-22 09:25:09 -05:00
|
|
|
|
2016-06-06 13:20:45 +05:30
|
|
|
HIP_ASSERT(hipFree(deviceA));
|
|
|
|
|
HIP_ASSERT(hipFree(deviceB));
|
2016-04-22 09:25:09 -05:00
|
|
|
|
2016-06-06 13:20:45 +05:30
|
|
|
free(hostA);
|
|
|
|
|
free(hostB);
|
2016-04-22 09:25:09 -05:00
|
|
|
|
2016-06-06 13:20:45 +05:30
|
|
|
return ret;
|
2016-04-22 09:25:09 -05:00
|
|
|
|
2016-06-06 13:20:45 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<typename T, typename U>
|
|
|
|
|
bool dataTypesRun4(){
|
|
|
|
|
T* hostA;
|
|
|
|
|
T* hostB;
|
|
|
|
|
|
|
|
|
|
T* deviceA;
|
|
|
|
|
T* deviceB;
|
|
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
int errors;
|
|
|
|
|
|
|
|
|
|
hostA = (T*)malloc(NUM * sizeof(T));
|
|
|
|
|
hostB = (T*)malloc(NUM * sizeof(T));
|
|
|
|
|
|
|
|
|
|
// initialize the input data
|
|
|
|
|
for (i = 0; i < NUM; i++) {
|
|
|
|
|
hostB[i] = make_vector4((U)i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HIP_ASSERT(hipMalloc((void**)&deviceA, NUM * sizeof(T)));
|
|
|
|
|
HIP_ASSERT(hipMalloc((void**)&deviceB, NUM * sizeof(T)));
|
|
|
|
|
|
|
|
|
|
HIP_ASSERT(hipMemcpy(deviceB, hostB, NUM*sizeof(T), hipMemcpyHostToDevice));
|
|
|
|
|
|
|
|
|
|
|
This switches HIP from its currently convoluted macro + pfe based dispatch mechanism to a more natural one partially based on the existing module API. The basic idea is that HCC will always correctly emit __global__ functions: as empty-bodied stubs, on host, and as kernels, on device. It then becomes trivial to obtain the mangled name on host, at dispatch, from the function's address, and then to use the mangled name to retrieve the kernel. This should address all problems stemming from serialisation, dubious mismatches due to the manufactured functor, macro-isms et al. It also immediately enables support for generalised globals as a consequence of that being available in the module API. Finally, it will make debug much easier, since the actual names of the __global__ functions will automatically be used in traces etc. One detail is that due to how dispatch works now (hipLaunchKernel and hipLaunchKernelGGL are themselves variadic function templates which deduce the function type of the callee), in certain cases it may be necesssary to insert explicit casts to ensure that the variadic argument list selects a viable overload - this can be observed in some unit tests. Eventually we may be able to remove this limitation, but for now it does not appear terribly onerous. The code is not extremely HIPpie, nor is it fully optimised, but rather is intended as a starting point for the HIP team to make its own.
2017-11-01 15:09:59 +00:00
|
|
|
hipLaunchKernel(
|
|
|
|
|
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);
|
2016-06-06 13:20:45 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
HIP_ASSERT(hipMemcpy(hostA, deviceA, NUM*sizeof(T), hipMemcpyDeviceToHost));
|
|
|
|
|
|
|
|
|
|
bool ret = false;
|
|
|
|
|
// verify the results
|
|
|
|
|
errors = 0;
|
|
|
|
|
for (i = 0; i < NUM; i++) {
|
|
|
|
|
if (hostA[i].x != (hostB[i].x ) && hostA[i].y != (hostB[i].y ) && hostA[i].z != (hostB[i].z ) && hostA[i].w != (hostB[i].w )) {
|
|
|
|
|
errors++;
|
2016-04-22 09:25:09 -05:00
|
|
|
}
|
2016-06-06 13:20:45 +05:30
|
|
|
}
|
|
|
|
|
if (errors!=0) {
|
|
|
|
|
std::cout << "FAILED\n"<<std::endl;
|
|
|
|
|
ret = false;
|
|
|
|
|
} else {
|
|
|
|
|
ret = true;
|
|
|
|
|
}
|
2016-04-22 09:25:09 -05:00
|
|
|
|
2016-06-06 13:20:45 +05:30
|
|
|
HIP_ASSERT(hipFree(deviceA));
|
|
|
|
|
HIP_ASSERT(hipFree(deviceB));
|
|
|
|
|
|
|
|
|
|
free(hostA);
|
|
|
|
|
free(hostB);
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
|
|
|
|
|
hipDeviceProp_t devProp;
|
|
|
|
|
hipGetDeviceProperties(&devProp, 0);
|
|
|
|
|
cout << " System minor " << devProp.minor << endl;
|
|
|
|
|
cout << " System major " << devProp.major << endl;
|
|
|
|
|
cout << " agent prop name " << devProp.name << endl;
|
2016-06-17 14:56:53 -05:00
|
|
|
|
2016-06-06 13:20:45 +05:30
|
|
|
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>();
|
2016-04-22 09:25:09 -05:00
|
|
|
|
|
|
|
|
if(errors == 1){
|
|
|
|
|
errors = 0;
|
2016-06-06 13:20:45 +05:30
|
|
|
std::cout<<"ldg working for single element data types\n"<<std::endl;
|
2016-04-22 09:25:09 -05:00
|
|
|
}else{
|
2016-06-06 13:20:45 +05:30
|
|
|
std::cout<<"Failed single element data types"<<std::endl;
|
2016-04-22 09:25:09 -05:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-17 14:56:53 -05:00
|
|
|
#if 1
|
2016-06-06 13:20:45 +05:30
|
|
|
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>();
|
2016-04-22 09:25:09 -05:00
|
|
|
|
|
|
|
|
if(errors == 1){
|
|
|
|
|
errors = 0;
|
2016-06-06 13:20:45 +05:30
|
|
|
std::cout<<"ldg working for two element data types\n"<<std::endl;
|
2016-04-22 09:25:09 -05:00
|
|
|
}else{
|
2016-06-06 13:20:45 +05:30
|
|
|
std::cout<<"Failed two element vector data types"<<std::endl;
|
2016-04-22 09:25:09 -05:00
|
|
|
return -1;
|
|
|
|
|
}
|
2016-06-17 14:56:53 -05:00
|
|
|
#endif
|
2016-04-22 09:25:09 -05:00
|
|
|
|
|
|
|
|
|
2016-06-17 14:56:53 -05:00
|
|
|
#if 1
|
2016-04-22 09:25:09 -05:00
|
|
|
|
2016-06-06 13:20:45 +05:30
|
|
|
errors = dataTypesRun4<int4,int>() &
|
|
|
|
|
dataTypesRun4<char4,signed char>() &
|
|
|
|
|
dataTypesRun4<uchar4,unsigned char>() &
|
|
|
|
|
dataTypesRun4<short4, short>() &
|
|
|
|
|
dataTypesRun4<uint4,unsigned int>() &
|
|
|
|
|
dataTypesRun4<float4,float>() ;
|
|
|
|
|
|
2016-04-20 14:21:22 -05:00
|
|
|
if(errors == 1){
|
2016-06-06 13:20:45 +05:30
|
|
|
errors = 0;
|
|
|
|
|
std::cout<<"ldg working for four element data types\n"<<std::endl;
|
2016-04-22 09:25:09 -05:00
|
|
|
}else{
|
2016-06-06 13:20:45 +05:30
|
|
|
std::cout<<"Failed four element vector data types"<<std::endl;
|
2016-04-22 09:25:09 -05:00
|
|
|
return -1;
|
2016-04-20 14:21:22 -05:00
|
|
|
}
|
2016-06-17 14:56:53 -05:00
|
|
|
#endif
|
2016-04-22 11:12:00 +05:30
|
|
|
|
2016-06-06 13:20:45 +05:30
|
|
|
std::cout<<"ldg test PASSED \n"<<std::endl;
|
|
|
|
|
|
2016-04-16 21:12:09 +08:00
|
|
|
}
|
2016-04-22 09:25:09 -05:00
|
|
|
|
|
|
|
|
#endif
|