Apply .clangformat to all repo source files

Change-Id: I7e79c6058f0303f9a98911e3b7dd2e8596079344
This commit is contained in:
Maneesh Gupta
2018-03-12 11:29:03 +05:30
والد 18e70b1e6b
کامیت 1ba06f63c4
293فایلهای تغییر یافته به همراه43980 افزوده شده و 45830 حذف شده
@@ -28,25 +28,29 @@ THE SOFTWARE.
#include <hip/hip_hcc.h>
#define LEN 64
#define SIZE LEN*sizeof(float)
#define SIZE LEN * sizeof(float)
#define fileName "vcpy_kernel.code.adipose"
float myDeviceGlobal;
float myDeviceGlobalArray[16];
#define HIP_CHECK(cmd) \
{\
hipError_t status = cmd;\
if(status != hipSuccess) {std::cout<<"error: #"<<status<<" ("<< hipGetErrorString(status) << ") at line:"<<__LINE__<<": "<<#cmd<<std::endl;abort();}\
}
#define HIP_CHECK(cmd) \
{ \
hipError_t status = cmd; \
if (status != hipSuccess) { \
std::cout << "error: #" << status << " (" << hipGetErrorString(status) \
<< ") at line:" << __LINE__ << ": " << #cmd << std::endl; \
abort(); \
} \
}
int main(){
int main() {
float *A, *B;
float* Ad, *Bd;
float *Ad, *Bd;
A = new float[LEN];
B = new float[LEN];
for(uint32_t i=0;i<LEN;i++){
A[i] = i*1.0f;
for (uint32_t i = 0; i < LEN; i++) {
A[i] = i * 1.0f;
B[i] = 0.0f;
}
@@ -70,18 +74,18 @@ int main(){
#define ARRAY_SIZE 16
float myDeviceGlobalArray_h[ARRAY_SIZE];
for (int i=0; i<ARRAY_SIZE; i++) {
myDeviceGlobalArray_h[i] = i*1000.0f;
myDeviceGlobalArray[i] = i*1000.0f;
for (int i = 0; i < ARRAY_SIZE; i++) {
myDeviceGlobalArray_h[i] = i * 1000.0f;
myDeviceGlobalArray[i] = i * 1000.0f;
}
#ifdef __HIP_PLATFORM_HCC__
uint32_t len = LEN;
uint32_t one = 1;
uint32_t len = LEN;
uint32_t one = 1;
struct {
void * _Ad;
void * _Bd;
void* _Ad;
void* _Bd;
} args;
args._Ad = Ad;
@@ -92,8 +96,8 @@ int main(){
#ifdef __HIP_PLATFORM_NVCC__
struct {
uint32_t _hidden[1];
void * _Ad;
void * _Bd;
void* _Ad;
void* _Bd;
} args;
args._hidden[0] = 0;
@@ -104,11 +108,8 @@ int main(){
size_t size = sizeof(args);
void *config[] = {
HIP_LAUNCH_PARAM_BUFFER_POINTER, &args,
HIP_LAUNCH_PARAM_BUFFER_SIZE, &size,
HIP_LAUNCH_PARAM_END
};
void* config[] = {HIP_LAUNCH_PARAM_BUFFER_POINTER, &args, HIP_LAUNCH_PARAM_BUFFER_SIZE, &size,
HIP_LAUNCH_PARAM_END};
{
hipFunction_t Function;
@@ -118,10 +119,10 @@ int main(){
hipMemcpyDtoH(B, Bd, SIZE);
int mismatchCount = 0;
for(uint32_t i=0;i<LEN;i++){
for (uint32_t i = 0; i < LEN; i++) {
if (A[i] != B[i]) {
mismatchCount++;
std::cout<<"error: mismatch " << A[i]<<" != "<<B[i]<<std::endl;
std::cout << "error: mismatch " << A[i] << " != " << B[i] << std::endl;
if (mismatchCount >= 10) {
break;
}
@@ -143,11 +144,11 @@ int main(){
hipMemcpyDtoH(B, Bd, SIZE);
int mismatchCount = 0;
for(uint32_t i=0;i<LEN;i++){
float expected = A[i] + myDeviceGlobal_h + myDeviceGlobalArray_h[i%16];
for (uint32_t i = 0; i < LEN; i++) {
float expected = A[i] + myDeviceGlobal_h + myDeviceGlobalArray_h[i % 16];
if (expected != B[i]) {
mismatchCount++;
std::cout<<"error: mismatch " << expected <<" != "<<B[i]<<std::endl;
std::cout << "error: mismatch " << expected << " != " << B[i] << std::endl;
if (mismatchCount >= 10) {
break;
}