comparison TaskManager/Gpu/GpuScheduler.cc @ 1829:45d4ed567cd7 draft

fix GpuScheduler
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Tue, 17 Dec 2013 16:42:35 +0900
parents d3a9772074d6
children 812b14ffe5dc
comparison
equal deleted inserted replaced
1828:f0dab5fffe7a 1829:45d4ed567cd7
99 /** 99 /**
100 * wait for previous pipeline termination 100 * wait for previous pipeline termination
101 * kernel_event, memout_event 101 * kernel_event, memout_event
102 */ 102 */
103 void 103 void
104 GpuScheduler::wait_for_event(cl_event* kernel_event, GpuBufferPtr memout, memaddr* reply, TaskListPtr taskList, int cur) { 104 GpuScheduler::wait_for_event(cl_event* kernel_event, GpuBufferPtr memout, memaddr reply, TaskListPtr taskList, int cur) {
105 if (kernel_event[1-cur] == NOP_REPLY) { 105 if (kernel_event[1-cur] == NOP_REPLY) {
106 if(reply[1-cur]) { 106 if(reply) {
107 connector->mail_write(reply[1-cur]); 107 connector->mail_write(reply);
108 reply[1-cur]=0; 108 reply=0;
109 } 109 }
110 } else if (kernel_event[1-cur] != NULL) { 110 } else if (kernel_event[1-cur] != NULL) {
111 int ret=clWaitForEvents(1,&kernel_event[1-cur]); 111 int ret=clWaitForEvents(1,&kernel_event[1-cur]);
112 if (ret<0) { 112 if (ret<0) {
113 error(convert_error_status(ret)); 113 error(convert_error_status(ret));
159 error(convert_error_status(ret)); 159 error(convert_error_status(ret));
160 kernel_event[cur] = NOP_REPLY; 160 kernel_event[cur] = NOP_REPLY;
161 kernel[cur] = 0; 161 kernel[cur] = 0;
162 memout[cur].buf = 0; 162 memout[cur].buf = 0;
163 memin[cur].buf = 0; 163 memin[cur].buf = 0;
164 reply[cur] = (memaddr)tasklist->waiter; 164 reply = (memaddr)tasklist->waiter;
165 165
166 // wait kernel[1-cur] and write[1-cur] 166 // wait kernel[1-cur] and write[1-cur]
167 wait_for_event(kernel_event, memout, reply, tasklist, cur); 167 wait_for_event(kernel_event, memout, reply, tasklist, cur);
168 } 168 }
169 169
212 */ 212 */
213 if (tasklist->self) { 213 if (tasklist->self) {
214 flag = tasklist->self->flag; 214 flag = tasklist->self->flag;
215 } 215 }
216 TaskPtr nextTask = NULL; 216 TaskPtr nextTask = NULL;
217 nextTask[cur] = tasklist->tasks; 217 nextTask = tasklist->tasks;
218 while (nextTask < taskList->last()) { 218 while (nextTask < tasklist->last()) {
219 if(nextTask->command==ShowTime) { 219 if(nextTask->command==ShowTime) {
220 connector->show_profile(); 220 connector->show_profile();
221 gpuTaskError(cur,tasklist,ret); 221 gpuTaskError(cur,tasklist,ret);
222 continue; 222 continue;
223 } 223 }
367 // pipeline : 1-cur 367 // pipeline : 1-cur
368 // no pipeline : cur 368 // no pipeline : cur
369 cur = 1 - cur; 369 cur = 1 - cur;
370 nextTask = nextTask->next(); 370 nextTask = nextTask->next();
371 } 371 }
372 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); 372 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);
373 reply = (memaddr)tasklist->waiter; 373 reply = (memaddr)tasklist->waiter;
374 if(reply) { 374 if(reply) {
375 connector->mail_write(reply); 375 connector->mail_write(reply);
376 reply=0; 376 reply=0;
377 } 377 }