Apply .clangformat to all repo source files
Change-Id: I7e79c6058f0303f9a98911e3b7dd2e8596079344
Этот коммит содержится в:
@@ -24,48 +24,46 @@ THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "hip/hip_runtime.h"
|
||||
#include"test_common.h"
|
||||
#include "test_common.h"
|
||||
#include "hip/hip_runtime_api.h"
|
||||
#include<iostream>
|
||||
#include <iostream>
|
||||
|
||||
__global__ void vAdd(hipLaunchParm lp, float *a){}
|
||||
__global__ void vAdd(hipLaunchParm lp, float* a) {}
|
||||
|
||||
|
||||
//---
|
||||
//Some wrapper macro for testing:
|
||||
// Some wrapper macro for testing:
|
||||
#define WRAP(...) __VA_ARGS__
|
||||
|
||||
#include <sys/time.h>
|
||||
#define GPU_PRINT_TIME(cmd, elapsed, quiet) do {\
|
||||
struct timeval start, stop;\
|
||||
float elapsed;\
|
||||
gettimeofday(&start, NULL);\
|
||||
hipDeviceSynchronize();\
|
||||
cmd;\
|
||||
hipDeviceSynchronize();\
|
||||
gettimeofday(&stop, NULL);\
|
||||
} while(0);
|
||||
#define GPU_PRINT_TIME(cmd, elapsed, quiet) \
|
||||
do { \
|
||||
struct timeval start, stop; \
|
||||
float elapsed; \
|
||||
gettimeofday(&start, NULL); \
|
||||
hipDeviceSynchronize(); \
|
||||
cmd; \
|
||||
hipDeviceSynchronize(); \
|
||||
gettimeofday(&stop, NULL); \
|
||||
} while (0);
|
||||
|
||||
|
||||
|
||||
#define MY_LAUNCH(command, doTrace, msg) \
|
||||
{\
|
||||
if (doTrace) printf ("TRACE: %s %s\n", msg, #command); \
|
||||
command;\
|
||||
}
|
||||
#define MY_LAUNCH(command, doTrace, msg) \
|
||||
{ \
|
||||
if (doTrace) printf("TRACE: %s %s\n", msg, #command); \
|
||||
command; \
|
||||
}
|
||||
|
||||
|
||||
#define MY_LAUNCH_WITH_PAREN(command, doTrace, msg) \
|
||||
{\
|
||||
if (doTrace) printf ("TRACE: %s %s\n", msg, #command); \
|
||||
(command);\
|
||||
}
|
||||
#define MY_LAUNCH_WITH_PAREN(command, doTrace, msg) \
|
||||
{ \
|
||||
if (doTrace) printf("TRACE: %s %s\n", msg, #command); \
|
||||
(command); \
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
float *Ad;
|
||||
int main() {
|
||||
float* Ad;
|
||||
hipMalloc((void**)&Ad, 1024);
|
||||
|
||||
// Test the different hipLaunchParm options:
|
||||
@@ -76,23 +74,23 @@ int main()
|
||||
|
||||
// Test case with hipLaunchKernel inside another macro:
|
||||
float e0;
|
||||
GPU_PRINT_TIME (hipLaunchKernel(vAdd, dim3(1024), dim3(1), 0, 0, Ad), e0, j);
|
||||
GPU_PRINT_TIME (WRAP(hipLaunchKernel(vAdd, dim3(1024), dim3(1), 0, 0, Ad)), e0, j);
|
||||
GPU_PRINT_TIME(hipLaunchKernel(vAdd, dim3(1024), dim3(1), 0, 0, Ad), e0, j);
|
||||
GPU_PRINT_TIME(WRAP(hipLaunchKernel(vAdd, dim3(1024), dim3(1), 0, 0, Ad)), e0, j);
|
||||
|
||||
#ifdef EXTRA_PARENS_1
|
||||
// Don't wrap hipLaunchKernel in extra set of parens:
|
||||
GPU_PRINT_TIME ((hipLaunchKernel(vAdd, dim3(1024), dim3(1), 0, 0, Ad)), e0, j);
|
||||
GPU_PRINT_TIME((hipLaunchKernel(vAdd, dim3(1024), dim3(1), 0, 0, Ad)), e0, j);
|
||||
#endif
|
||||
|
||||
MY_LAUNCH (hipLaunchKernel(vAdd, dim3(1024), dim3(1), 0, 0, Ad), true, "firstCall");
|
||||
MY_LAUNCH(hipLaunchKernel(vAdd, dim3(1024), dim3(1), 0, 0, Ad), true, "firstCall");
|
||||
|
||||
float *A;
|
||||
float* A;
|
||||
float e1;
|
||||
MY_LAUNCH_WITH_PAREN (hipMalloc(&A, 100), true, "launch2");
|
||||
MY_LAUNCH_WITH_PAREN(hipMalloc(&A, 100), true, "launch2");
|
||||
|
||||
#ifdef EXTRA_PARENS_2
|
||||
//MY_LAUNCH_WITH_PAREN wraps cmd in () which can cause issues.
|
||||
MY_LAUNCH_WITH_PAREN (hipLaunchKernel(vAdd, dim3(1024), dim3(1), 0, 0, Ad), true, "firstCall");
|
||||
// MY_LAUNCH_WITH_PAREN wraps cmd in () which can cause issues.
|
||||
MY_LAUNCH_WITH_PAREN(hipLaunchKernel(vAdd, dim3(1024), dim3(1), 0, 0, Ad), true, "firstCall");
|
||||
#endif
|
||||
|
||||
passed();
|
||||
|
||||
Ссылка в новой задаче
Block a user