Quoting Jan Vesely (2017-09-01 12:30:51)
[snip]
> +#
> +# Authors: Tom Stellard <thomas.stell...@amd.com>

I think we've stopped using these, anyway, it doesn't seem correct.

> +#
> +#
> +
> +from __future__ import print_function, division, absolute_import
> +import os
> +import random
> +import textwrap
> +
> +from six.moves import range
> +
> +from modules import utils
> +from genclbuiltins import MAX_VALUES, DATA_SIZES
> +
> +TYPES = {
> +    'char': 'uchar',
> +    'uchar': 'uchar',
> +    'short': 'ushort',
> +    'ushort': 'ushort',
> +    'half': 'ushort',
> +    'int': 'uint',
> +    'uint': 'uint',
> +    'float': 'uint',
> +    'long': 'ulong',
> +    'ulong': 'ulong',
> +    'double': 'ulong'
> +}
> +
> +VEC_SIZES = ['2', '4', '8', '16']
> +ELEMENTS = 8
> +
> +DIR_NAME = os.path.join("cl", "builtin", "misc")
> +
> +
> +def gen_array(size, m):
> +    return [random.randint(0, m) for i in range(size)]
> +
> +
> +def permute(data, mask, ssize, dsize):
> +    ret = []
> +    for i in range(len(mask)):
> +        idx = mask[i] % ssize
> +        ret.append(data[idx + ((i // dsize) * ssize)])

enumerate would be more efficient and idiomatic
for i, m in enumerate(mask):
    idx = m % size
    ...

Alternatively if you like more functional approaches:
return [data[(m % ssize) + ((i // dsize) * ssize)]
        for i, m in enumerate(mask)]

You could even inline this approach if you want, since there's only one caller

> +    return ret
> +
> +

[snip]

Otherwise the python aspects look good to me. With either change:
Reviewed-by: Dylan Baker <dy...@pnwbakers.com>

Dylan

Attachment: signature.asc
Description: signature

_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to