Mercurial > hg > Game > Cerium
changeset 1521:9ae6eedd3ee3 draft
fix GpuScheduler for debug
author | Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 12 Nov 2012 12:43:12 +0900 |
parents | 031f26b15ae6 |
children | 027d99ecb50e |
files | TaskManager/Gpu/GpuScheduler.cc |
diffstat | 1 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Gpu/GpuScheduler.cc Sat Nov 10 19:42:22 2012 +0900 +++ b/TaskManager/Gpu/GpuScheduler.cc Mon Nov 12 12:43:12 2012 +0900 @@ -3,6 +3,8 @@ #include "PreRefDmaManager.h" #include "SchedTask.h" #include "stdio.h" +// +#include "ListData.h" #include <fcntl.h> #include <sys/stat.h> #include <string.h> @@ -98,9 +100,9 @@ if (!flag.flip) { for(int i=0;i<nextTask->inData_count;i++) { memin[i] = clCreateBuffer(context, mem_flag, nextTask->inData(i)->size, NULL, NULL); - + ListElement *input_buf = nextTask->inData(i); ret = clEnqueueWriteBuffer(command_queue[cur], memin[i], CL_TRUE, 0, - nextTask->inData(i)->size, nextTask->inData(i)->addr, 0, NULL, NULL); + input_buf->size, input_buf->addr, 0, NULL, NULL); ret = clSetKernelArg(kernel, param, sizeof(memaddr), (void *)&memin[i]); param++; @@ -112,11 +114,14 @@ for(int i=0;i<nextTask->outData_count;i++) { - memout[i] = clCreateBuffer(context, out_mem_flag, nextTask->outData(i)->size, NULL, &ret); + ListElement *output_buf = nextTask->outData(i); + memout[i] = clCreateBuffer(context, out_mem_flag, output_buf->size, NULL, &ret); + if (flag.flip) { // use output buffer as input buffer + ListElement *input_buf = nextTask->inData(i); + ret = clEnqueueWriteBuffer(command_queue[cur], memout[i], CL_TRUE, 0, - nextTask->inData(i)->size, nextTask->inData(i)->addr, 0, NULL, NULL); - + input_buf->size, input_buf->addr, 0, NULL, NULL); } ret = clSetKernelArg(kernel, param, sizeof(memaddr), (void *)&memout[i]); param++; @@ -129,8 +134,9 @@ // clEnqueueNDRange // (command_queue[cur], kernel, dim, NULL,global_work_size[0],local_work_size[0],NULL&ev); for(int i=0;i<nextTask->outData_count;i++) { + ListElement *output_buf = nextTask->outData(i); ret = clEnqueueReadBuffer(command_queue[cur], memout[i], CL_TRUE, 0, - nextTask->outData(i)->size, nextTask->outData(i)->addr, 1, &ev, NULL); + output_buf->size, output_buf->addr, 1, &ev, NULL); } }