Changes between Version 15 and Version 16 of OpenCLTransformation


Ignore:
Timestamp:
08/07/14 14:03:19 (12 years ago)
Author:
fuufusuu
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • OpenCLTransformation

    v15 v16  
    2222}}}
    2323
     24=== Notes About Address Space ===
     25* 'clSetKernelArg': sets arguments for an array of each device in the kernel.
    2426
     27Currently, this method
     28{{{
     29err = clSetKernelArg(kernel, 0, sizeof(cl_mem), &input);
     30}}}
     31
     32Is replaced by careful use of malloc, but a method may be implemented later.
     33
     34* 'Private (local)' : Each kernel gets it's own version of this variable. malloc + memcpy is the way to do this.
     35
     36* 'Global' : Each kernel shares this data, an update to one will affect the other. Pointer with memory location. For regular non pointer variables, make a pointer and assign it to it, then use the pointer.
     37
     38* 'Group' : Each workgroup shares the same data. Currently unimplemented.
     39{{{
     40  ((args*)kernel.arguments)->input = input;
     41  //global
     42
     43  ((args*)kernel.arguments)->param[2] = (int *)malloc(sizeof(int));
     44  memcpy(((args*)kernel.arguments)->param[2], &count, sizeof(int));
     45  //local
     46}}}
    2547
    2648== Methods and equivalents ==
     
    7597}}}
    7698
    77 err  = clSetKernelArg(kernel, 0, sizeof(cl_mem), &input);
    78 err |= clSetKernelArg(kernel, 1, sizeof(cl_mem), &output);
    79 err |= clSetKernelArg(kernel, 2, sizeof(unsigned int), &count);
    80 
    81 * 'clSetKernelArg': sets arguments for an array of each device in the kernel.
    82 
    83 Support for global, local, constant and group, local being the default
    84 Private (local) - variable assignment, or malloc + memcpy
    85 
    86 Global - pointer with memory location. For regular non pointer variables, make a pointer and assign it to it, then use the pointer
    87 Global variables can be declared in program source but they must use the "constant" address space qualifier and need to be initialized.
    88 You cannot have global variables that can be modified by kernels and where the modified values are persistent across work-groups and kernel executions.
    89 
    90 Constant is just like global, but read only
    91 
    92 group - ???
    93 {{{
    94   ((args*)kernel.arguments)->input = input;
    95  
    96   ((args*)kernel.arguments)->output = output;
    97 
    98   ((args*)kernel.arguments)->count = count;
    99 }}}
    10099
    101100err = clGetKernelWorkGroupInfo(kernel, device_id, CL_KERNEL_WORK_GROUP_SIZE, sizeof(local), &local, NULL);