# HG changeset patch # User Yuhi TOMARI # Date 1352691792 -32400 # Node ID 9ae6eedd3ee3f1e3b778e7afb80b719d76242164 # Parent 031f26b15ae6e193a458eb72d91816ab75478bf7 fix GpuScheduler for debug diff -r 031f26b15ae6 -r 9ae6eedd3ee3 TaskManager/Gpu/GpuScheduler.cc --- 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 #include #include @@ -98,9 +100,9 @@ if (!flag.flip) { for(int i=0;iinData_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;ioutData_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;ioutData_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); } }