changeset 1493:efced19350f8 draft

fix clSetKernelArg
author Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
date Thu, 16 Aug 2012 18:21:15 +0900
parents 73f4bfaeaf99
children 289e427bd49f
files TaskManager/Gpu/GpuScheduler.cc example/basic/main.cc
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Gpu/GpuScheduler.cc	Tue Aug 14 16:04:12 2012 +0900
+++ b/TaskManager/Gpu/GpuScheduler.cc	Thu Aug 16 18:21:15 2012 +0900
@@ -59,7 +59,7 @@
         while (params_addr) {
             tasklist = (TaskListPtr)connector->dma_load(this, params_addr, 
                                                         sizeof(TaskList), DMA_READ_TASKLIST);
-
+            
             for (TaskPtr nextTask = tasklist->tasks; nextTask < tasklist->last(); nextTask = nextTask->next()) {
 
                 load_kernel(nextTask->command);
@@ -69,7 +69,10 @@
                 int param = 0;
                 
                 for(;param<nextTask->param_count;param++) {
-                    err |= clSetKernelArg(kernel,  param, sizeof(memaddr), (cl_mem*)nextTask->param(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);
                 }
 
                 for(int i=0;i<nextTask->inData_count;i++) {
--- a/example/basic/main.cc	Tue Aug 14 16:04:12 2012 +0900
+++ b/example/basic/main.cc	Thu Aug 16 18:21:15 2012 +0900
@@ -68,7 +68,7 @@
      */ 
     twice = manager->create_task(TWICE_TASK);
     twice->set_cpu(SPE_ANY);
-    
+
     /**
      * Set of Input Data
      *   add_inData(address of input data, size of input data);