Mercurial > hg > Game > Cerium
changeset 1716:c12df61ded45 draft
fix gpu profile. not work yet
author | Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 15 Oct 2013 17:21:10 +0900 |
parents | 996d216c837a |
children | 5d68a55d5561 |
files | TaskManager/Gpu/GpuScheduler.cc |
diffstat | 1 files changed, 14 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Gpu/GpuScheduler.cc Tue Oct 08 18:39:46 2013 +0900 +++ b/TaskManager/Gpu/GpuScheduler.cc Tue Oct 15 17:21:10 2013 +0900 @@ -7,6 +7,7 @@ #include "GpuError.h" #include "ListData.h" #include "SysFunc.h" +#include "gettime.h" #include <fcntl.h> #include <sys/stat.h> #include <string.h> @@ -98,6 +99,7 @@ cl_mem *memin[2]; cl_mem *memout[2]; + TaskListPtr tasklist[2]; HTask::htask_flag flag; memset(&flag, 0, sizeof(HTask::htask_flag)); @@ -121,18 +123,18 @@ (*connector->start_dmawait_profile)(); while (params_addr) { // since we are on the same memory space, we don't has to use dma_load here - TaskListPtr tasklist = (TaskListPtr)connector->dma_load(this, params_addr, + tasklist[cur] = (TaskListPtr)connector->dma_load(this, params_addr, sizeof(TaskList), DMA_READ_TASKLIST); - + tasklist[cur]->start_time = gettime(); /* * get flip flag * flip : When caluculate on input data, to treat this as a output data */ - if (tasklist->self) { - flag = tasklist->self->flag; + if (tasklist[cur]->self) { + flag = tasklist[cur]->self->flag; } - for (TaskPtr nextTask = tasklist->tasks;nextTask < tasklist->last(); nextTask = nextTask->next()) { + for (TaskPtr nextTask = tasklist[cur]->tasks;nextTask < tasklist[cur]->last(); nextTask = nextTask->next()) { if(nextTask->command==ShowTime) { connector->show_profile(); continue; @@ -243,9 +245,9 @@ param++; } - if (tasklist->dim > 0) { - ret = clEnqueueNDRangeKernel(command_queue, kernel[cur], tasklist->dim, - NULL, &tasklist->x, 0, 0, NULL, NULL); + if (tasklist[cur]->dim > 0) { + ret = clEnqueueNDRangeKernel(command_queue, kernel[cur], tasklist[cur]->dim, + NULL, &tasklist[cur]->x, 0, 0, NULL, NULL); } else { ret = clEnqueueTask(command_queue, kernel[cur], 0, NULL, NULL); } @@ -270,9 +272,10 @@ error(msg); } - reply[cur] = (memaddr)tasklist->waiter; + reply[cur] = (memaddr)tasklist[cur]->waiter; wait_for_event(event,reply,cur); + tasklist[1-cur]->stop_time = gettime(); //clFlush(command_queue); // waiting for queued task // clFlush(command_queue); @@ -283,11 +286,12 @@ * clReleaseMemObject(memout[1-cur]); */ - params_addr = (memaddr)tasklist->next; + params_addr = (memaddr)tasklist[cur]->next; cur = 1 - cur; } } wait_for_event(event,reply,cur); + tasklist[1-cur]->stop_time = gettime(); //clFlush(command_queue); // waiting for queued task //clFinish(command_queue); // waiting for queued task (*connector->end_dmawait_profile)(&connector->global_busy_time);