[dtest] Kernel Execution time fix for hipExtLaunchKernelGGL and hipExtModuleLaunchKernel API's

Fix for kernel execution time using clock rate

SWDEV-238517 for enhancing hip unit tests

Change-Id: Id06df31387ecab96f219e0c1fbcdda1609f75605


[ROCm/hip commit: 0b871a24f6]
Этот коммит содержится в:
DURGESH KROTTAPALLI
2021-01-11 21:10:55 +05:30
коммит произвёл Mohan Kumar Mithur
родитель e7073fc17c
Коммит 76eb4b7b1e
3 изменённых файлов: 44 добавлений и 27 удалений
+7
Просмотреть файл
@@ -63,6 +63,7 @@ class ModuleLaunchKernel {
hipFunction_t MultKernel, SixteenSecKernel, FourSecKernel,
TwoSecKernel, KernelandExtraParamKernel;
struct {
int clockRate;
void* _Ad;
void* _Bd;
void* _Cd;
@@ -101,14 +102,18 @@ void ModuleLaunchKernel::AllocateMemory() {
HIPCHECK(hipHostMalloc(reinterpret_cast<void**>(&C), SIZE*sizeof(int)));
HIPCHECK(hipMemcpy(Ad, A, SIZE*sizeof(int), hipMemcpyHostToDevice));
HIPCHECK(hipMemcpy(Bd, B, SIZE*sizeof(int), hipMemcpyHostToDevice));
int clkRate = 0;
HIPCHECK(hipDeviceGetAttribute(&clkRate, hipDeviceAttributeClockRate, 0));
args1._Ad = Ad;
args1._Bd = Bd;
args1._Cd = C;
args1._n = N;
args1.clockRate = clkRate;
args2._Ad = NULL;
args2._Bd = NULL;
args2._Cd = NULL;
args2._n = 0;
args2.clockRate = clkRate;
size1 = sizeof(args1);
size2 = sizeof(args2);
HIPCHECK(hipEventCreate(&start_event1));
@@ -156,10 +161,12 @@ void ModuleLaunchKernel::DeAllocateMemory() {
*/
bool ModuleLaunchKernel::ExtModule_KernelExecutionTime() {
bool testStatus = true;
HIPCHECK(hipSetDevice(0));
AllocateMemory();
ModuleLoad();
hipError_t e;
float time_4sec, time_2sec;
void *config2[] = {HIP_LAUNCH_PARAM_BUFFER_POINTER, &args2,
HIP_LAUNCH_PARAM_BUFFER_SIZE, &size2,
HIP_LAUNCH_PARAM_END};