<div dir="ltr"><div>This patch is <br>Reviewed-by: Aaron Watry <<a href="mailto:awatry@gmail.com">awatry@gmail.com</a>><br><br></div>The other one I'm not as qualified to review the selected test values, so it is:<br>Acked-By: Aaron Watry <<a href="mailto:awatry@gmail.com">awatry@gmail.com</a>><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 18, 2016 at 2:25 PM, Jan Vesely <span dir="ltr"><<a href="mailto:jan.vesely@rutgers.edu" target="_blank">jan.vesely@rutgers.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
<br>
I plan to push both patches by the end of the week unless anyone<br>
objects. still a RB would be nice if anyone can spare some time.<br>
<br>
<br>
thank you,<br>
Jan<br>
<div class="HOEnZb"><div class="h5"><br>
On Fri, 2016-02-05 at 12:34 -0500, Jan Vesely wrote:<br>
> On Thu, 2016-02-04 at 22:15 -0600, Aaron Watry wrote:<br>
> > Type-o in the subject (Suport).<br>
> ><br>
> > On Wed, Feb 3, 2016 at 6:37 PM, Jan Vesely <<a href="mailto:jan.vesely@rutgers.edu">jan.vesely@rutgers.edu</a>><br>
> > wrote:<br>
> ><br>
> > > Reuses parts of Tom's fract test patch.<br>
> > > There is no change in generated tests with single output<br>
> > ><br>
> > > Signed-off-by: Jan Vesely <<a href="mailto:jan.vesely@rutgers.edu">jan.vesely@rutgers.edu</a>><br>
> > > ---<br>
> > > generated_tests/genclbuiltins.py | 108<br>
> > > ++++++++++++++++++++++++++++-----------<br>
> > > 1 file changed, 79 insertions(+), 29 deletions(-)<br>
> > ><br>
> > > diff --git a/generated_tests/genclbuiltins.py<br>
> > > b/generated_tests/genclbuiltins.py<br>
> > > index 24bf249..7df55c9 100644<br>
> > > --- a/generated_tests/genclbuiltins.py<br>
> > > +++ b/generated_tests/genclbuiltins.py<br>
> > > @@ -109,13 +109,24 @@ B = {<br>
> > ><br>
> > > # vecSizes has the layout [in0width, ..., inNwidth] where<br>
> > > outType<br>
> > > width is<br>
> > > # assumed to match the width of the first input<br>
> > > -def gen_kernel(f, fnName, inTypes, outType, vecSizes,<br>
> > > typePrefix):<br>
> > > +def gen_kernel(f, fnName, inTypes, outTypes, vecSizes,<br>
> > > typePrefix,<br>
> > > outLoc='private'):<br>
> > > f.write('kernel void test_' + typePrefix + str(vecSizes[0])<br>
> > > +<br>
> > > '_' +<br>
> > > fnName<br>
> > > - + '_' + inTypes[0]+'(global '+outType+'* out')<br>
> > > + + (('_' + outLoc) if len(outTypes) > 1 else '')<br>
> > > + + '_' + inTypes[0] + '(global ' + outTypes[0] + '*<br>
> > > out')<br>
> > > + for arg in range(1, len(outTypes)):<br>
> > > + f.write(', global '+outTypes[arg]+'* out'+str(arg))<br>
> > > for arg in range(0, len(inTypes)):<br>
> > > f.write(', global '+inTypes[arg]+'* in'+str(arg))<br>
> > > f.write('){\n')<br>
> > ><br>
> > > + for arg in range(1, len(outTypes)):<br>
> > > + f.write(' ' + outLoc + ' ' + outTypes[arg] + ('' if<br>
> > > vecSizes[0]<br>
> > > == 1 else str(vecSizes[0])));<br>
> > > + if (outLoc == 'global'):<br>
> > > + f.write(' *tmp' + str(arg) + ' = out' + str(arg) +<br>
> > > ';\n');<br>
> > > + else:<br>
> > > + #FIXME: This assumes WG size of 1<br>
> > ><br>
> ><br>
> > Was this FIXME left here intentionally for whoever needs that<br>
> > feature<br>
> > later? Cause yeah, the generated code for local memory tests with<br>
> > non-1 WG<br>
> > sizes is definitely broken.<br>
> ><br>
> > Do you plan on tackling that, or do you want to punt on it and just<br>
> > assume<br>
> > WG size =1 for now?<br>
><br>
> The FIXME is intentional. I don't expect anyone to ever need WG > 1<br>
> for<br>
> these tests and supporting it properly looked like to much effort for<br>
> little gain:<br>
><br>
> We'd need something like<br>
> local type tmpX[get_local_size(0)];<br>
> which is not allowed for obvious reasons.<br>
> we could to do:<br>
> local type tmpX[MAX_LOCAL_SIZE_X];<br>
> but we'd need to add that macro to cl-program-tester,<br>
><br>
><br>
> regards,<br>
> Jan<br>
><br>
> PS: I fixed the typos and whitespace locally<br>
><br>
> ><br>
> ><br>
> > > + f.write(' tmp' + str(arg) + ';\n');<br>
> > > +<br>
> > > suffix = ';'<br>
> > > if (vecSizes[0] == 1):<br>
> > > f.write(' out[get_global_id(0)] = ')<br>
> > > @@ -134,88 +145,113 @@ def gen_kernel(f, fnName, inTypes,<br>
> > > outType,<br>
> > > vecSizes, typePrefix):<br>
> > > f.write('in'+str(arg)+'[get_global_id(0)]')<br>
> > > else:<br>
> > > f.write('vload'+str(vecSizes[arg])+'(get_global_id(0<br>
> > > ),<br>
> > > in'+str(arg)+')')<br>
> > ><br>
> ><br>
> > Might be nice to have a blank line here.<br>
> ><br>
> ><br>
> > > + for arg in range(1, len(outTypes)):<br>
> > > + if (outLoc == 'global'):<br>
> > > + f.write(', &tmp' + str(arg) + '[get_global_id(0)]')<br>
> > > + else:<br>
> > > + f.write(', &tmp' + str(arg))<br>
> > > +<br>
> > > + f.write(suffix + '\n')<br>
> > > +<br>
> > ><br>
> ><br>
> > And one less here.<br>
> ><br>
> > Let me know about the local WG size thing. Otherwise, this looks ok<br>
> > with<br>
> > the spelling/formatting changes. I'm by no means a python expert,<br>
> > but this<br>
> > looks functional, and I've already re-used it to add frexp tests.<br>
> ><br>
> > --Aaron<br>
> ><br>
> ><br>
> > > +<br>
> > > + if (outLoc != 'global'):<br>
> > > + for arg in range(1, len(outTypes)):<br>
> > > + if (vecSizes[0] == 1):<br>
> > > + f.write(' out'+ str(arg) +'[get_global_id(0)] =<br>
> > > tmp' +<br>
> > > str(arg))<br>
> > > + else:<br>
> > > + f.write(' vstore' + str(vecSizes[0]) + '(tmp' +<br>
> > > str(arg)<br>
> > > + ', get_global_id(0), out' + str(arg) + ')')<br>
> > > + f.write(';\n')<br>
> > ><br>
> > > - f.write(suffix+'\n}\n\n')<br>
> > > + f.write('}\n\n')<br>
> > ><br>
> > ><br>
> > ><br>
> > > -def gen_kernel_1_arg(f, fnName, inType, outType):<br>
> > > +def gen_kernel_1_arg(f, fnName, inType, outTypes, loc =<br>
> > > 'private'):<br>
> > > for vecSize in ALL_WIDTHS:<br>
> > > - gen_kernel(f, fnName, [inType], outType, [vecSize], '')<br>
> > > + gen_kernel(f, fnName, [inType], outTypes, [vecSize], '',<br>
> > > loc)<br>
> > ><br>
> > ><br>
> > > # 2 argument kernel with input types that match their vector<br>
> > > size<br>
> > > -def gen_kernel_2_arg_same_size(f, fnName, inTypes, outType):<br>
> > > +def gen_kernel_2_arg_same_size(f, fnName, inTypes, outTypes):<br>
> > > for vecSize in ALL_WIDTHS:<br>
> > > - gen_kernel(f, fnName, inTypes, outType, [vecSize,<br>
> > > vecSize],<br>
> > > + gen_kernel(f, fnName, inTypes, outTypes, [vecSize,<br>
> > > vecSize],<br>
> > > '')<br>
> > ><br>
> > ><br>
> > > # 2 argument kernel with 1 vector and one scalar input argument<br>
> > > -def gen_kernel_2_arg_mixed_size(f, fnName, inTypes, outType):<br>
> > > +def gen_kernel_2_arg_mixed_size(f, fnName, inTypes, outTypes):<br>
> > > for vecSize in VEC_WIDTHS:<br>
> > > - gen_kernel(f, fnName, inTypes, outType, [vecSize, 1],<br>
> > > 'tss_')<br>
> > > + gen_kernel(f, fnName, inTypes, outTypes, [vecSize, 1],<br>
> > > 'tss_')<br>
> > ><br>
> > ><br>
> > > # 2 argument kernel with 1 vector and one scalar input argument<br>
> > > with<br>
> > > multiple<br>
> > > # input data types<br>
> > > -def gen_kernel_2_arg_mixed_sign(f, fnName, inTypes, outType):<br>
> > > +def gen_kernel_2_arg_mixed_sign(f, fnName, inTypes, outTypes):<br>
> > > for vecSize in ALL_WIDTHS:<br>
> > > - gen_kernel(f, fnName, inTypes, outType, [vecSize,<br>
> > > vecSize],<br>
> > > + gen_kernel(f, fnName, inTypes, outTypes, [vecSize,<br>
> > > vecSize],<br>
> > > '')<br>
> > ><br>
> > ><br>
> > > # 3-argument built-in functions<br>
> > ><br>
> > ><br>
> > > -def gen_kernel_3_arg_same_type(f, fnName, inTypes, outType):<br>
> > > +def gen_kernel_3_arg_same_type(f, fnName, inTypes, outTypes):<br>
> > > for vecSize in ALL_WIDTHS:<br>
> > > - gen_kernel(f, fnName, inTypes, outType,<br>
> > > + gen_kernel(f, fnName, inTypes, outTypes,<br>
> > > [vecSize, vecSize, vecSize], ''<br>
> > > )<br>
> > ><br>
> > > -def gen_kernel_3_arg_mixed_size_tss(f, fnName, inTypes,<br>
> > > outType):<br>
> > > +def gen_kernel_3_arg_mixed_size_tss(f, fnName, inTypes,<br>
> > > outTypes):<br>
> > > for vecSize in VEC_WIDTHS:<br>
> > > - gen_kernel(f, fnName, inTypes, outType,<br>
> > > + gen_kernel(f, fnName, inTypes, outTypes,<br>
> > > [vecSize, 1, 1], 'tss_')<br>
> > ><br>
> > > -def gen_kernel_3_arg_mixed_size_tts(f, fnName, inTypes,<br>
> > > outType):<br>
> > > +def gen_kernel_3_arg_mixed_size_tts(f, fnName, inTypes,<br>
> > > outTypes):<br>
> > > for vecSize in VEC_WIDTHS:<br>
> > > - gen_kernel(f, fnName, inTypes, outType,<br>
> > > + gen_kernel(f, fnName, inTypes, outTypes,<br>
> > > [vecSize, vecSize, 1], 'tts_')<br>
> > ><br>
> > ><br>
> > > def generate_kernels(f, dataType, fnName, fnDef):<br>
> > > +<br>
> > > argTypes = getArgTypes(dataType, fnDef['arg_types'])<br>
> > ><br>
> > > # For len(argTypes), remember that this includes the output<br>
> > > arg<br>
> > > if (len(argTypes) == 2):<br>
> > > - gen_kernel_1_arg(f, fnName, argTypes[1], argTypes[0])<br>
> > > + gen_kernel_1_arg(f, fnName, argTypes[1], [argTypes[0]])<br>
> > > return<br>
> > ><br>
> > > if (len(argTypes) == 3 and not fnName is 'upsample'):<br>
> > > - gen_kernel_2_arg_same_size(f, fnName,<br>
> > > - [argTypes[1], argTypes[2]],<br>
> > > argTypes[0])<br>
> > > + if (getNumOutArgs(fnDef) == 2):<br>
> > > + gen_kernel_1_arg(f, fnName,<br>
> > > + argTypes[2], [argTypes[0],<br>
> > > argTypes[1]],<br>
> > > 'private')<br>
> > > + gen_kernel_1_arg(f, fnName,<br>
> > > + argTypes[2], [argTypes[0],<br>
> > > argTypes[1]],<br>
> > > 'local')<br>
> > > + gen_kernel_1_arg(f, fnName,<br>
> > > + argTypes[2], [argTypes[0],<br>
> > > argTypes[1]],<br>
> > > 'global')<br>
> > > + else:<br>
> > > + gen_kernel_2_arg_same_size(f, fnName,<br>
> > > + [argTypes[1], argTypes[2]],<br>
> > > [argTypes[0]])<br>
> > > if (fnDef['function_type'] is 'tss'):<br>
> > > gen_kernel_2_arg_mixed_size(f, fnName,<br>
> > > - [argTypes[1], argTypes[2]],<br>
> > > argTypes[0])<br>
> > > + [argTypes[1], argTypes[2]],<br>
> > > [argTypes[0]])<br>
> > > return<br>
> > ><br>
> > > if (len(argTypes) == 4):<br>
> > > gen_kernel_3_arg_same_type(f, fnName,<br>
> > > - [argTypes[1], argTypes[2], argTypes[3]],<br>
> > > argTypes[0])<br>
> > > + [argTypes[1], argTypes[2], argTypes[3]],<br>
> > > [argTypes[0]])<br>
> > > if (fnDef['function_type'] is 'tss'):<br>
> > > gen_kernel_3_arg_mixed_size_tss(f, fnName,<br>
> > > - [argTypes[1], argTypes[2], argTypes[3]],<br>
> > > argTypes[0])<br>
> > > + [argTypes[1], argTypes[2], argTypes[3]],<br>
> > > [argTypes[0]])<br>
> > > if (fnDef['function_type'] is 'tts'):<br>
> > > gen_kernel_3_arg_mixed_size_tts(f, fnName,<br>
> > > - [argTypes[1], argTypes[2], argTypes[3]],<br>
> > > argTypes[0])<br>
> > > + [argTypes[1], argTypes[2], argTypes[3]],<br>
> > > [argTypes[0]])<br>
> > > return<br>
> > ><br>
> > > if (fnName is 'upsample'):<br>
> > > gen_kernel_2_arg_mixed_sign(f, fnName,<br>
> > > [argTypes[1], argTypes[2]],<br>
> > > - argTypes[0])<br>
> > > + [argTypes[0]])<br>
> > > return<br>
> > ><br>
> > > def getValue(type, val, isVector):<br>
> > > @@ -301,6 +337,15 @@ def getArgTypes(baseType, argTypes):<br>
> > > def isFloatType(t):<br>
> > > return t not in U<br>
> > ><br>
> > > +def getNumOutArgs(functionDef):<br>
> > > + if 'num_out_args' in functionDef:<br>
> > > + return functionDef['num_out_args']<br>
> > > + else:<br>
> > > + return 1<br>
> > > +<br>
> > > +def isOutArg(functionDef, argIdx):<br>
> > > + return argIdx < getNumOutArgs(functionDef)<br>
> > > +<br>
> > > # Print a test with all-vector inputs/outputs and/or mixed<br>
> > > vector/scalar<br>
> > > args<br>
> > > def print_test(f, fnName, argType, functionDef, tests, numTests,<br>
> > > vecSize,<br>
> > > fntype):<br>
> > > # If the test allows mixed vector/scalar arguments, handle<br>
> > > the<br>
> > > case<br>
> > > with<br>
> > > @@ -332,7 +377,7 @@ def print_test(f, fnName, argType,<br>
> > > functionDef,<br>
> > > tests,<br>
> > > numTests, vecSize, fntype<br>
> > > for arg in range(0, argCount):<br>
> > > argInOut = ''<br>
> > > argVal = getStrVal(argType, tests[arg], (vecSize > 1))<br>
> > > - if arg == 0:<br>
> > > + if isOutArg(functionDef, arg):<br>
> > > argInOut = 'arg_out: '<br>
> > > else:<br>
> > > argInOut = 'arg_in: '<br>
> > > @@ -345,7 +390,7 @@ def print_test(f, fnName, argType,<br>
> > > functionDef,<br>
> > > tests,<br>
> > > numTests, vecSize, fntype<br>
> > > '[' + str(numTests * vecSize) + '] ' +<br>
> > > ''.join(map(lambda x: (x + ' ') * vecSize,<br>
> > > argVal.split()))<br>
> > > )<br>
> > > - if arg == 0:<br>
> > > + if isOutArg(functionDef, arg) :<br>
> > > f.write(' tolerance {0} '.format(tolerance))<br>
> > > # Use ulp tolerance for float types<br>
> > > if isFloatType(argTypes[arg]):<br>
> > > @@ -418,8 +463,13 @@ def gen(types, minVersions, functions,<br>
> > > testDefs,<br>
> > > dirName):<br>
> > > sizes = sorted(VEC_WIDTHS)<br>
> > > sizes.insert(0, 1) # Add 1-wide scalar to the<br>
> > > vector<br>
> > > widths<br>
> > > for vecSize in sizes:<br>
> > > - print_test(f, fnName, dataType, functionDef,<br>
> > > tests,<br>
> > > - numTests, vecSize, fnType)<br>
> > > + if (getNumOutArgs(functionDef) == 1):<br>
> > > + print_test(f, fnName, dataType, functionDef,<br>
> > > tests,<br>
> > > + numTests, vecSize, fnType)<br>
> > > + else:<br>
> > > + for loc in ['_private', '_local',<br>
> > > '_global']:<br>
> > > + print_test(f, fnName + loc, dataType,<br>
> > > functionDef, tests,<br>
> > > + numTests, vecSize, fnType)<br>
> > ><br>
> > > # Terminate the header section<br>
> > > f.write('!*/\n\n')<br>
> > > --<br>
> > > 2.5.0<br>
> > ><br>
> > > _______________________________________________<br>
> > > Piglit mailing list<br>
> > > <a href="mailto:Piglit@lists.freedesktop.org">Piglit@lists.freedesktop.org</a><br>
> > > <a href="http://lists.freedesktop.org/mailman/listinfo/piglit" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/piglit</a><br>
> > ><br>
--<br>
Jan Vesely <<a href="mailto:jan.vesely@rutgers.edu">jan.vesely@rutgers.edu</a>><br>
</div></div></blockquote></div><br></div>