changeset 1829:45d4ed567cd7 draft

fix GpuScheduler
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Tue, 17 Dec 2013 16:42:35 +0900
parents f0dab5fffe7a
children 812b14ffe5dc
files TaskManager/Gpu/GpuScheduler.cc TaskManager/Gpu/GpuScheduler.h
diffstat 2 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Gpu/GpuScheduler.cc	Tue Dec 17 14:07:40 2013 +0900
+++ b/TaskManager/Gpu/GpuScheduler.cc	Tue Dec 17 16:42:35 2013 +0900
@@ -101,11 +101,11 @@
  * kernel_event, memout_event
  */
 void
-GpuScheduler::wait_for_event(cl_event* kernel_event, GpuBufferPtr memout, memaddr* reply, TaskListPtr taskList, int cur) {
+GpuScheduler::wait_for_event(cl_event* kernel_event, GpuBufferPtr memout, memaddr reply, TaskListPtr taskList, int cur) {
     if (kernel_event[1-cur] == NOP_REPLY) {
-        if(reply[1-cur]) {
-            connector->mail_write(reply[1-cur]);
-            reply[1-cur]=0;
+        if(reply) {
+            connector->mail_write(reply);
+            reply=0;
         }
     } else if (kernel_event[1-cur] != NULL) {
         int ret=clWaitForEvents(1,&kernel_event[1-cur]);
@@ -161,7 +161,7 @@
     kernel[cur] = 0;
     memout[cur].buf = 0;
     memin[cur].buf = 0;
-    reply[cur] = (memaddr)tasklist->waiter;
+    reply = (memaddr)tasklist->waiter;
 
     // wait kernel[1-cur] and write[1-cur]
     wait_for_event(kernel_event, memout, reply, tasklist, cur);
@@ -214,8 +214,8 @@
                 flag = tasklist->self->flag;
             }
             TaskPtr nextTask = NULL;
-            nextTask[cur] = tasklist->tasks;
-            while (nextTask < taskList->last()) {
+            nextTask = tasklist->tasks;
+            while (nextTask < tasklist->last()) {
                 if(nextTask->command==ShowTime) {
                     connector->show_profile();
                     gpuTaskError(cur,tasklist,ret);
@@ -369,7 +369,7 @@
                 cur = 1 - cur;
                 nextTask = nextTask->next();
             }
-            printf("GPU %d %s\t%lld\n",tasklist[cur]->self->cpu_type,(char*)(gpu_task_list[tasklist[cur]->tasks[0].command].name),tasklist[cur]->task_end_time-tasklist[cur]->task_start_time);
+            printf("GPU %d %s\t%lld\n",tasklist->self->cpu_type,(char*)(gpu_task_list[tasklist->tasks[0].command].name),tasklist->task_end_time-tasklist->task_start_time);
             reply = (memaddr)tasklist->waiter;
             if(reply) {
                 connector->mail_write(reply);
--- a/TaskManager/Gpu/GpuScheduler.h	Tue Dec 17 14:07:40 2013 +0900
+++ b/TaskManager/Gpu/GpuScheduler.h	Tue Dec 17 16:42:35 2013 +0900
@@ -27,7 +27,7 @@
     virtual ~GpuScheduler();
     void init_impl(int useRefDma);
     void init_gpu();
-    void wait_for_event(cl_event* event,GpuBufferPtr m, memaddr* reply,TaskListPtr* taskList,int cur);
+    void wait_for_event(cl_event* event,GpuBufferPtr m, memaddr reply,TaskListPtr taskList,int cur);
     void run();
     
     void mail_write_from_host(memaddr data) {
@@ -49,7 +49,7 @@
     cl_context context;
     cl_command_queue command_queue;
     cl_int ret;
-    memaddr reply[2];
+    memaddr reply;
     cl_kernel kernel[2];
     cl_event kernel_event[2];
     GpuBuffer memin[2];
@@ -61,7 +61,7 @@
     cl_mem createBuffer(GpuBufferPtr m, int i, cl_context context, cl_mem_flags flags, size_t size, cl_int *error);
     void initGpuBuffer(GpuBufferPtr m);
     void destroyGpuBuffer(GpuBufferPtr m);
-    void gpuTaskError(int cur, TaskListPtr *tasklist, int ret);
+    void gpuTaskError(int cur, TaskListPtr tasklist, int ret);
 };
 
 #define GpuSchedRegister(str, filename, functionname)   \