Mercurial > hg > Game > Cerium
changeset 1494:289e427bd49f draft
fix set param kernelArg
author | Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 16 Aug 2012 23:31:25 +0900 |
parents | efced19350f8 |
children | 05505bd5c183 |
files | TaskManager/Cell/CellTaskManagerImpl.cc TaskManager/Gpu/GpuScheduler.cc |
diffstat | 2 files changed, 19 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Cell/CellTaskManagerImpl.cc Thu Aug 16 18:21:15 2012 +0900 +++ b/TaskManager/Cell/CellTaskManagerImpl.cc Thu Aug 16 23:31:25 2012 +0900 @@ -89,12 +89,15 @@ int speid; HTaskPtr htask = activeTaskQueue->getFirst(); while (htask != NULL) { - + if (htask->cpu_type == CPU_PPE) { htask = activeTaskQueue->getNext(htask); } else { +#ifdef __CERIUM_GPU__ + speid = htask->cpu_type - 1; +#else if (htask->cpu_type == SPE_ANY) { speid = cur_anySpeid++; } else { @@ -104,6 +107,7 @@ // 配列的 (SPE0 = arr[0], SPE1 = arr[1]) にするため speid = htask->cpu_type - CPU_SPE - 1; } +#endif speid %= machineNum; set_taskList(htask, taskListInfo[speid]);
--- a/TaskManager/Gpu/GpuScheduler.cc Thu Aug 16 18:21:15 2012 +0900 +++ b/TaskManager/Gpu/GpuScheduler.cc Thu Aug 16 23:31:25 2012 +0900 @@ -68,12 +68,16 @@ int err = CL_SUCCESS; int param = 0; - for(;param<nextTask->param_count;param++) { - cl_mem memobj = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(nextTask->param(param)), NULL, NULL); - err |= clEnqueueWriteBuffer(command_queue, memobj, CL_TRUE, 0, - sizeof(nextTask->param(param)), nextTask->param(param), 0, NULL, NULL); - err |= clSetKernelArg(kernel, param, sizeof(memaddr), memobj); - } + + //inDataをparamに + //sizeof * nextTask->param_countてきな + cl_mem memobj = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(nextTask->param(param))*nextTask->param_count, NULL, NULL); + err |= clEnqueueWriteBuffer(command_queue, memobj, CL_TRUE, 0, + sizeof(nextTask->param(param))*nextTask->param_count, + nextTask->param(param), 0, NULL, NULL); + err |= clSetKernelArg(kernel, param, sizeof(memaddr), memobj); + for(int i=0;i<nextTask->inData_count;i++) { cl_mem memobj = clCreateBuffer(context, CL_MEM_READ_WRITE, nextTask->inData(i)->size, NULL, NULL); @@ -82,9 +86,7 @@ err |= clSetKernelArg(kernel, param, sizeof(memaddr), memobj); param++; } - // カーネル引数の設定 - - clEnqueueTask(command_queue, kernel, 0, NULL, NULL); + for(int i=0;i<nextTask->outData_count;i++) { cl_mem memobj = clCreateBuffer(context, CL_MEM_READ_WRITE, nextTask->outData(i)->size, NULL, NULL); @@ -93,6 +95,9 @@ err |= clSetKernelArg(kernel, param, sizeof(memaddr), memobj); param++; } + // カーネル引数の設定 + + clEnqueueTask(command_queue, kernel, 0, NULL, NULL); } clFlush(command_queue); // waiting for queued task