MCPcopy Create free account
hub / github.com/KhronosGroup/OpenCL-CTS / makeSelectProgram

Function makeSelectProgram

test_conformance/select/test_select.cpp:180–310  ·  view source on GitHub ↗

Make the various incarnations of the program we want to run stype: source and destination type for the select ctype: compare type

Source from the content-addressed store, hash-verified

178 }
179 break;
180 }
181 case 8: {
182 uint64_t *ul = (uint64_t *)cmp;
183 if (vecsize == 1)
184 {
185 for (uint32_t i = 0; i < count; i++)
186 ul[i] = i % 2 ? 0 : genrand_int64(d);
187 }
188 else
189 {
190 for (uint32_t i = 0; i < count; i++)
191 {
192 uint16_t vec_bitmask = (start + i) / vecsize;
193 uint16_t vec_idx = (start + i) % vecsize;
194 uint64_t gen = genrand_int64(d);
195 ul[i] = ((vec_bitmask >> vec_idx) & 0x1)
196 ? gen | 0x8000000000000000ULL
197 : gen & 0x7fffffffffffffffULL;
198 }
199 }
200 break;
201 }
202 default:
203 log_error("invalid cmptype %s\n",type_name[cmptype]);
204 } // end switch
205}
206
207// Make the various incarnations of the program we want to run
208// stype: source and destination type for the select
209// ctype: compare type
210static cl_program makeSelectProgram(cl_kernel *kernel_ptr,
211 const cl_context context, Type srctype,
212 Type cmptype, const size_t vec_len)
213{
214 char testname[256];
215 char stypename[32];
216 char ctypename[32];
217 char extension[128] = "";
218 int err = 0;
219
220 const char *source[] = {
221 extension,
222 "__kernel void ", testname,
223 "(__global ", stypename, " *dest, __global ", stypename, " *src1,\n __global ",
224 stypename, " *src2, __global ", ctypename, " *cmp)\n",
225 "{\n"
226 " size_t tid = get_global_id(0);\n"
227 " if( tid < get_global_size(0) )\n"
228 " dest[tid] = select(src1[tid], src2[tid], cmp[tid]);\n"
229 "}\n"
230 };
231
232
233 const char *sourceV3[] = {
234 extension,
235 "__kernel void ", testname,
236 "(__global ", stypename, " *dest, __global ", stypename, " *src1,\n __global ",
237 stypename, " *src2, __global ", ctypename, " *cmp)\n",

Callers 1

doTestFunction · 0.85

Calls 1

Tested by

no test coverage detected