<p dir="ltr"><br>
On Aug 30, 2014 12:27 PM, "Jan Vesely" <<a href="mailto:jan.vesely@rutgers.edu">jan.vesely@rutgers.edu</a>> wrote:<br>
><br>
> On Fri, 2014-08-01 at 16:24 -0400, Jan Vesely wrote:<br>
> > This fixes hidden failures where summary would report the result<br>
> > of the last test with given name.<br>
> ><br>
> > Signed-off-by: Jan Vesely <<a href="mailto:jan.vesely@rutgers.edu">jan.vesely@rutgers.edu</a>><br>
> > ---<br>
> ><br>
> > I saw 3 ways to deal with the problem of tests having the same name:<br>
> > a) Merge the tests<br>
> > b) Add index to every test<br>
> > c) add support for same named tests to summary<br>
><br>
> ping. any comments ?</p>
<p dir="ltr">I'd go for fixing the duplicates and then making it just fail in all.py if there are *any* duplicate names.  That way it's impossible to add a duplicate name and have piglit run at all.</p>
<p dir="ltr">--Jason Ekstrand</p>
<p dir="ltr">><br>
> ><br>
> > This patch implements a), it introduces 9 regressions on Intel OCL SDK all<br>
> > of which are previously hidden fails. No changes on r600.<br>
> ><br>
> > I don't really use python, so I went for least invasive changes with ugly/non-efficient code as a side-effect. Comments welcome.<br>
> ><br>
> > Jan<br>
> ><br>
> ><br>
> >  generated_tests/genclbuiltins.py | 63 ++++++++++++++++++++--------------------<br>
> >  1 file changed, 32 insertions(+), 31 deletions(-)<br>
> ><br>
> > diff --git a/generated_tests/genclbuiltins.py b/generated_tests/genclbuiltins.py<br>
> > index cdef80b..4a574b8 100644<br>
> > --- a/generated_tests/genclbuiltins.py<br>
> > +++ b/generated_tests/genclbuiltins.py<br>
> > @@ -113,10 +113,10 @@ def gen_kernel(f, fnName, inTypes, outType, vecSizes, typePrefix):<br>
> ><br>
> >      suffix = ';'<br>
> >      if (vecSizes[0] == 1):<br>
> > -        f.write('  *out = ')<br>
> > +        f.write('  out[get_global_id(0)] = ')<br>
> >      else:<br>
> >          f.write('  vstore'+str(vecSizes[0])+'(')<br>
> > -        suffix = ', 0, out)' + suffix<br>
> > +        suffix = ', get_global_id(0), out)' + suffix<br>
> ><br>
> >      f.write(fnName+'(')<br>
> >      suffix = ')' + suffix<br>
> > @@ -126,9 +126,9 @@ def gen_kernel(f, fnName, inTypes, outType, vecSizes, typePrefix):<br>
> >              f.write(', ')<br>
> >          # if scalar, don't print vload/vstore<br>
> >          if (vecSizes[arg] == 1):<br>
> > -            f.write('*in'+str(arg))<br>
> > +            f.write('in'+str(arg)+'[get_global_id(0)]')<br>
> >          else:<br>
> > -            f.write('vload'+str(vecSizes[arg])+'(0, in'+str(arg)+')')<br>
> > +            f.write('vload'+str(vecSizes[arg])+'(get_global_id(0), in'+str(arg)+')')<br>
> ><br>
> >      f.write(suffix+'\n}\n\n')<br>
> ><br>
> > @@ -247,16 +247,19 @@ def getValue(type, val, isVector):<br>
> ><br>
> >          # Evaluate the value of the requested function and arguments<br>
> >          # TODO: Change to varargs calls after unshifting the first list element<br>
> > -        if (len(val) == 2):<br>
> > -            return (val[0])(getValue(type, val[1], isVector))<br>
> > -        elif (len(val) == 3):<br>
> > -            return (val[0])(getValue(type, val[1], isVector), getValue(type, val[2], isVector))<br>
> > -        elif (len(val) == 4):<br>
> > -            return (val[0])(getValue(type, val[1], isVector), getValue(type, val[2], isVector),<br>
> > +        if (callable(val[0])):<br>
> > +            if (len(val) == 2):<br>
> > +                return (val[0])(getValue(type, val[1], isVector))<br>
> > +            elif (len(val) == 3):<br>
> > +                return (val[0])(getValue(type, val[1], isVector), getValue(type, val[2], isVector))<br>
> > +            elif (len(val) == 4):<br>
> > +                return (val[0])(getValue(type, val[1], isVector), getValue(type, val[2], isVector),<br>
> >                              getValue(type, val[3], isVector))<br>
> > -        else:<br>
> > -            return (val[0])(getValue(type, val[1], isVector), getValue(type, val[2], isVector),<br>
> > +            else:<br>
> > +                return (val[0])(getValue(type, val[1], isVector), getValue(type, val[2], isVector),<br>
> >                              getValue(type, val[3], isVector), getValue(type, val[4], isVector))<br>
> > +        else:<br>
> > +             return map(lambda x: getValue(type, x, isVector), val);<br>
> ><br>
> >      # At this point, we should have been passed a number<br>
> >      if (isinstance(val, (int, long, float))):<br>
> > @@ -267,7 +270,7 @@ def getValue(type, val, isVector):<br>
> ><br>
> ><br>
> >  def getStrVal(type, val, isVector):<br>
> > -    return str(getValue(type, val, isVector))<br>
> > +    return " ".join(map(str, getValue(type, val, isVector)))<br>
> ><br>
> ><br>
> >  def getArgType(baseType, argType):<br>
> > @@ -288,11 +291,11 @@ def isFloatType(t):<br>
> >      return t not in U<br>
> ><br>
> >  # Print a test with all-vector inputs/outputs and/or mixed vector/scalar args<br>
> > -def print_test(f, fnName, argType, functionDef, tests, testIdx, vecSize, tss):<br>
> > +def print_test(f, fnName, argType, functionDef, tests, numTests, vecSize, tss):<br>
> >      # If the test allows mixed vector/scalar arguments, handle the case with<br>
> >      # only vector arguments through a recursive call.<br>
> >      if (tss):<br>
> > -        print_test(f, fnName, argType, functionDef, tests, testIdx, vecSize,<br>
> > +        print_test(f, fnName, argType, functionDef, tests, numTests, vecSize,<br>
> >                     False)<br>
> ><br>
> >      # The tss && vecSize==1 case is handled in the non-tss case.<br>
> > @@ -305,20 +308,21 @@ def print_test(f, fnName, argType, functionDef, tests, testIdx, vecSize, tss):<br>
> >      if (not tss):<br>
> >          tssStr = ''<br>
> ><br>
> > +    argTypes = getArgTypes(argType, functionDef['arg_types'])<br>
> > +    argCount = len(argTypes)<br>
> > +    tolerance = functionDef['tolerance'] if 'tolerance' in functionDef else 0<br>
> > +<br>
> >      # Write the test header<br>
> >      f.write('[test]\n' + 'name: ' + fnName + ' ' + argType + str(vecSize) +<br>
> >              '\n' + 'kernel_name: test_' + tssStr + str(vecSize) + '_' + fnName<br>
> > -            + '_' + argType + '\n'<br>
> > +            + '_' + argType + '\n' + 'global_size: ' + str(numTests)<br>
> > +            + ' 0 0\n\n'<br>
> >      )<br>
> ><br>
> > -    argTypes = getArgTypes(argType, functionDef['arg_types'])<br>
> > -    argCount = len(argTypes)<br>
> > -    tolerance = functionDef['tolerance'] if 'tolerance' in functionDef else 0<br>
> > -<br>
> >      # For each argument, write a line containing its type, index, and values<br>
> >      for arg in range(0, argCount):<br>
> >          argInOut = ''<br>
> > -        argVal = getStrVal(argType, tests[arg][testIdx], (vecSize > 1))<br>
> > +        argVal = getStrVal(argType, tests[arg], (vecSize > 1))<br>
> >          if arg == 0:<br>
> >              argInOut = 'arg_out: '<br>
> >          else:<br>
> > @@ -329,7 +333,8 @@ def print_test(f, fnName, argType, functionDef, tests, testIdx, vecSize, tss):<br>
> >          # width<br>
> >          if (arg < 2 or not tss):<br>
> >              f.write(argInOut + str(arg) + ' buffer ' + argTypes[arg] +<br>
> > -                    '[' + str(vecSize) + '] ' + ' '.join([argVal]*vecSize)<br>
> > +                    '[' + str(numTests * vecSize) + '] ' +<br>
> > +                    ''.join(map(lambda x: (x + ' ') * vecSize, argVal.split()))<br>
> >              )<br>
> >              if arg == 0:<br>
> >                  f.write(' tolerance {0} '.format(tolerance))<br>
> > @@ -339,8 +344,8 @@ def print_test(f, fnName, argType, functionDef, tests, testIdx, vecSize, tss):<br>
> >              f.write('\n')<br>
> >          else:<br>
> >              argInOut = 'arg_in: '<br>
> > -            f.write(argInOut + str(arg) + ' buffer ' + argTypes[arg] + '[1] ' +<br>
> > -                    argVal + '\n'<br>
> > +            f.write(argInOut + str(arg) + ' buffer ' + argTypes[arg] + '[' +<br>
> > +                    str(numTests) + '] ' + argVal + '\n'<br>
> >              )<br>
> ><br>
> >      # Blank line between tests for formatting reasons<br>
> > @@ -379,8 +384,7 @@ def gen(types, minVersions, functions, testDefs, dirName):<br>
> >                      '[config]\n' +<br>
> >                      'name: Test '+dataType+' '+fnName+' built-in on CL 1.1\n' +<br>
> >                      'clc_version_min: '+str(clcVersionMin)+'\n' +<br>
> > -                    'dimensions: 1\n' +<br>
> > -                    'global_size: 1 0 0\n\n'<br>
> > +                    'dimensions: 1\n\n'<br>
> >              )<br>
> ><br>
> >              # Write all tests for the built-in function<br>
> > @@ -395,9 +399,8 @@ def gen(types, minVersions, functions, testDefs, dirName):<br>
> >              sizes = sorted(VEC_WIDTHS)<br>
> >              sizes.insert(0, 1)  # Add 1-wide scalar to the vector widths<br>
> >              for vecSize in sizes:<br>
> > -                for testIdx in range(0, numTests):<br>
> > -                    print_test(f, fnName, dataType, functionDef, tests,<br>
> > -                               testIdx, vecSize, (fnType is 'tss'))<br>
> > +                print_test(f, fnName, dataType, functionDef, tests,<br>
> > +                           numTests, vecSize, (fnType is 'tss'))<br>
> ><br>
> >              # Terminate the header section<br>
> >              f.write('!*/\n\n')<br>
> > @@ -406,5 +409,3 @@ def gen(types, minVersions, functions, testDefs, dirName):<br>
> >              generate_kernels(f, dataType, fnName, functionDef)<br>
> ><br>
> >          f.close()<br>
> > -<br>
> > -<br>
><br>
><br>
> --<br>
> Jan Vesely <<a href="mailto:jan.vesely@rutgers.edu">jan.vesely@rutgers.edu</a>><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">http://lists.freedesktop.org/mailman/listinfo/piglit</a><br>
><br>
</p>