Changes between Version 20 and Version 21 of OpenCLTransformation
- Timestamp:
- 08/21/14 14:19:41 (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
OpenCLTransformation
v20 v21 2 2 * 'args' : a struct containing all of the variables that will be passed into a kernel. Uses an array of void pointers. Size determined by number of parameters. Has an array of ints as a flag for whether a method used malloc or not, used in clReleaseKernel 3 3 {{{ 4 #!c 4 5 typedef struct 5 6 { … … 12 13 13 14 {{{ 15 #!c 14 16 typedef struct 15 17 { … … 27 29 Currently, this method 28 30 {{{ 31 #!c 29 32 err = clSetKernelArg(kernel, 0, sizeof(cl_mem), &input); 30 33 }}} … … 38 41 * 'Group' : Each workgroup shares the same data. Currently unimplemented. 39 42 {{{ 43 #!c 40 44 ((args*)kernel.arguments)->input = input; 41 45 //global … … 51 55 52 56 {{{ 57 #!c 53 58 void __kernel foo( __qualifier type bar, ...){} 54 59 }}} … … 65 70 66 71 Memory fences and barriers can be used to control threads on the thread or workgroup level. 72 Note that data across workgroups are generally not shared except when using global memory. 67 73 68 74 Any method with cl_bool blocking_read in the parameter can be used to determine if the host can run work in parallel or sequentially across different devices. … … 74 80 75 81 {{{ 82 #!c 76 83 cl_kernel clCreateKernel(args * argument, char * function) 77 84 { … … 92 99 93 100 {{{ 101 #!c 94 102 void clReleaseKernel(cl_kernel kernel) 95 103 { … … 110 118 clCreateBuffer creates a buffer object with certain types of information attached to it. In the .cvl it only uses the right side with the third parameter, and mallocs space for it 111 119 {{{ 120 #!c 112 121 input = (int *) malloc(sizeof(int) * count); 113 122 }}} … … 117 126 clEnqueueWriteBuffer writes to a buffer with extra data. In the transformation it is currently a memcpy. 118 127 {{{ 128 #!c 119 129 memcpy(input, data, sizeof(int) * count); 120 130 }}} … … 125 135 In regular openCL this will ask the device what work group size to use at runtime. This is not used in the transformation, instead it will make an input for the local workgroup size. 126 136 {{{ 137 #!c 127 138 $input int LOCAL; 128 139 }}} … … 133 144 134 145 {{{ 146 #!c 135 147 int clEnqueueNDRangeKernel(cl_command_queue commands, cl_kernel kernel, int global, int local) 136 148 { … … 158 170 159 171 {{{ 172 #!c 160 173 void worksquare(size_t local, size_t global, kernel param) 161 174 { … … 174 187 175 188 {{{ 189 #!c 176 190 memcpy(results, output, sizeof(int) * count); 177 191 }}}
