changeset 1509:acd86a0ff366 draft

fix pipelining in GpuScheduler
author Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
date Tue, 25 Sep 2012 16:23:31 +0900
parents 0e1318e7caed
children 81f1afd1851f
files TaskManager/Gpu/GpuScheduler.cc TaskManager/test/GpuRunTest/GpuRunTest.cc
diffstat 2 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Gpu/GpuScheduler.cc	Tue Sep 18 18:59:54 2012 +0900
+++ b/TaskManager/Gpu/GpuScheduler.cc	Tue Sep 25 16:23:31 2012 +0900
@@ -54,6 +54,8 @@
     int cur = 0;
     memaddr reply[2];
     HTask::htask_flag flag;
+    memset(reply, NULL, sizeof(memaddr)*2);
+    memset(&flag, 0, sizeof(HTask::htask_flag));
 
     for (;;) {
         memaddr params_addr = connector->task_list_mail_read();
@@ -65,8 +67,6 @@
             return ;
         }
 
-        memset(&flag, 0, sizeof(HTask::htask_flag));
-
         while (params_addr) {
             // since we are on the same memory space, we don't hae to use dma_load here
             TaskListPtr tasklist = (TaskListPtr)connector->dma_load(this, params_addr,
@@ -86,7 +86,6 @@
 
                 int param = 0;
 
-
                 cl_mem memparam = clCreateBuffer(context, CL_MEM_READ_ONLY,
                                                sizeof(memaddr)*nextTask->param_count, NULL, NULL);
                 err |= clEnqueueWriteBuffer(command_queue[cur], memparam, CL_TRUE, 0, sizeof(memaddr)*nextTask->param_count,
@@ -132,13 +131,20 @@
                                                nextTask->outData(i)->size, nextTask->outData(i)->addr, 1, &ev, NULL);
                 }
             }
+
             reply[cur] = (memaddr)tasklist->waiter;
             clFlush(command_queue[1-cur]); // waiting for queued task
-
-            connector->mail_write(reply[1-cur]);
+            if(reply[1-cur]) {
+                connector->mail_write(reply[1-cur]);
+            }
+            
             params_addr = (memaddr)tasklist->next;
             cur = 1 - cur;
         }
+
+        clFlush(command_queue[1-cur]); // waiting for queued task
+        connector->mail_write(reply[1-cur]);
+
         connector->mail_write((memaddr)MY_SPE_STATUS_READY);
     }
     // TaskArrayの処理
--- a/TaskManager/test/GpuRunTest/GpuRunTest.cc	Tue Sep 18 18:59:54 2012 +0900
+++ b/TaskManager/test/GpuRunTest/GpuRunTest.cc	Tue Sep 25 16:23:31 2012 +0900
@@ -86,7 +86,6 @@
     twice->set_inData(0, indata, sizeof (int)*length);
     twice->set_outData(0, outdata, sizeof (int)*length);
     twice->set_cpu(GPU_0);
-    twice->no_flip();
 
     /*
      * set_post() で ppe task を渡せるようにしたい