Re: [Piglit] [PATCH 1/1] cl: Add support for OCL 2.0

2017-07-30 Thread Aaron Watry
On Sun, Jul 30, 2017, 10:31 AM Jan Vesely  wrote:

> On Thu, 2017-07-20 at 22:59 -0500, Aaron Watry wrote:
> > Hey Jan,
> >
> > I've skimmed my way through this, and it's looking ok so far.  I'll
> > try to do a deeper dive over the changes needed for the 2.0 spec in
> > the near future (I've been stuck in 1.1/1.2-land for too long).
> >
> > For now, you can have an:
> > Acked-by: Aaron Watry 
>
> thanks for taking a look.
>
> >
> > I'll see if I can find some time tomorrow, or possibly this weekend to
> > do a more detailed review.
>
> I plan to push this together with the sampler test fix early next week.
> Let me know if you want me to postpone, the patch is not on critical
> path.
>

Nah, don't feel like you need to postpone this.  I'm not familiar enough
with the 2.0 spec yet, so any additional review I gave for this would still
be based on a limited understanding.

>
> regards,
> Jan
>
> >
> > --Aaron
> >
> > On Wed, Jul 19, 2017 at 5:51 PM, Jan Vesely 
> wrote:
> > > v2: Fix warning in cl-api-get-mem-object-info
> > > v3: Filter permissible queue properties combinations
> > > Use and test clCreateCommandQueueWithProperties on OCL 2.0
> > >
> > > Signed-off-by: Jan Vesely 
> > > ---
> > >
> > > I see few regressions with this patch on beignet(SKL) in generated
> clamp/mad_sat long16 tests. Forcing the clc version to 1.2 in those test
> fixes the regression so I believe it's beignet bug.
> > > No regressions on clover Turks and beignet(IVB).
> > >
> > > Jan
> > >
> > >  tests/cl/api/create-command-queue.c | 37 +--
> > >  tests/cl/api/get-mem-object-info.c  |  8 
> > >  tests/util/piglit-util-cl-enum.c| 95
> +++--
> > >  tests/util/piglit-util-cl-enum.h|  4 ++
> > >  tests/util/piglit-util-cl.h |  4 +-
> > >  5 files changed, 119 insertions(+), 29 deletions(-)
> > >
> > > diff --git a/tests/cl/api/create-command-queue.c
> b/tests/cl/api/create-command-queue.c
> > > index 0ffd1377c..3ada5af90 100644
> > > --- a/tests/cl/api/create-command-queue.c
> > > +++ b/tests/cl/api/create-command-queue.c
> > > @@ -52,7 +52,7 @@ get_mixed_command_queue_properties(int mask,
> > > const cl_command_queue_properties
> properties[]) {
> > > int i = 0;
> > > cl_command_queue_properties mixed_properties = 0;
> > > -
> > > +
> > > while(mask > 0) {
> > > if(mask%2 == 1) {
> > > mixed_properties |= properties[i];
> > > @@ -64,6 +64,21 @@ get_mixed_command_queue_properties(int mask,
> > > return mixed_properties;
> > >  }
> > >
> > > +static bool
> > > +properties_forbidden(const cl_command_queue_properties properties,
> > > + const struct piglit_cl_api_test_env* env)
> > > +{
> > > +   int num_command_queue_properties_mutexes =
> > > +
>  PIGLIT_CL_ENUM_NUM(cl_command_queue_properties_mutexes, env->version);
> > > +   const cl_command_queue_properties*
> command_queue_properties_mutexes =
> > > +
>  PIGLIT_CL_ENUM_ARRAY(cl_command_queue_properties_mutexes);
> > > +   int i = 0;
> > > +   for (; i < num_command_queue_properties_mutexes; ++i)
> > > +   if (properties == command_queue_properties_mutexes[i])
> > > +   return true;
> > > +   return false;
> > > +}
> > > +
> > >  enum piglit_result
> > >  piglit_cl_test(const int argc,
> > > const char** argv,
> > > @@ -79,7 +94,8 @@ piglit_cl_test(const int argc,
> > > cl_command_queue command_queue;
> > > cl_uint num_devices;
> > > cl_device_id* devices;
> > > -   cl_command_queue_properties mixed_command_queue_properties;
> > > +   cl_command_queue_properties mixed_command_queue_properties[4] =
> > > +   {CL_QUEUE_PROPERTIES, 0, 0, 0};
> > >
> > > cl_context_properties context_properties[] = {
> > > CL_CONTEXT_PLATFORM,
> (cl_context_properties)env->platform_id,
> > > @@ -116,12 +132,25 @@ piglit_cl_test(const int argc,
> > >  * There are 2^(num_command_queue_properties)-1 possible
> options.
> > >  */
> > > 

Re: [Piglit] [PATCH 1/1] cl: Add support for OCL 2.0

2017-07-20 Thread Aaron Watry
Hey Jan,

I've skimmed my way through this, and it's looking ok so far.  I'll
try to do a deeper dive over the changes needed for the 2.0 spec in
the near future (I've been stuck in 1.1/1.2-land for too long).

For now, you can have an:
Acked-by: Aaron Watry 

I'll see if I can find some time tomorrow, or possibly this weekend to
do a more detailed review.

--Aaron

On Wed, Jul 19, 2017 at 5:51 PM, Jan Vesely  wrote:
> v2: Fix warning in cl-api-get-mem-object-info
> v3: Filter permissible queue properties combinations
> Use and test clCreateCommandQueueWithProperties on OCL 2.0
>
> Signed-off-by: Jan Vesely 
> ---
>
> I see few regressions with this patch on beignet(SKL) in generated 
> clamp/mad_sat long16 tests. Forcing the clc version to 1.2 in those test 
> fixes the regression so I believe it's beignet bug.
> No regressions on clover Turks and beignet(IVB).
>
> Jan
>
>  tests/cl/api/create-command-queue.c | 37 +--
>  tests/cl/api/get-mem-object-info.c  |  8 
>  tests/util/piglit-util-cl-enum.c| 95 
> +++--
>  tests/util/piglit-util-cl-enum.h|  4 ++
>  tests/util/piglit-util-cl.h |  4 +-
>  5 files changed, 119 insertions(+), 29 deletions(-)
>
> diff --git a/tests/cl/api/create-command-queue.c 
> b/tests/cl/api/create-command-queue.c
> index 0ffd1377c..3ada5af90 100644
> --- a/tests/cl/api/create-command-queue.c
> +++ b/tests/cl/api/create-command-queue.c
> @@ -52,7 +52,7 @@ get_mixed_command_queue_properties(int mask,
> const cl_command_queue_properties 
> properties[]) {
> int i = 0;
> cl_command_queue_properties mixed_properties = 0;
> -
> +
> while(mask > 0) {
> if(mask%2 == 1) {
> mixed_properties |= properties[i];
> @@ -64,6 +64,21 @@ get_mixed_command_queue_properties(int mask,
> return mixed_properties;
>  }
>
> +static bool
> +properties_forbidden(const cl_command_queue_properties properties,
> + const struct piglit_cl_api_test_env* env)
> +{
> +   int num_command_queue_properties_mutexes =
> +   PIGLIT_CL_ENUM_NUM(cl_command_queue_properties_mutexes, 
> env->version);
> +   const cl_command_queue_properties* command_queue_properties_mutexes =
> +   PIGLIT_CL_ENUM_ARRAY(cl_command_queue_properties_mutexes);
> +   int i = 0;
> +   for (; i < num_command_queue_properties_mutexes; ++i)
> +   if (properties == command_queue_properties_mutexes[i])
> +   return true;
> +   return false;
> +}
> +
>  enum piglit_result
>  piglit_cl_test(const int argc,
> const char** argv,
> @@ -79,7 +94,8 @@ piglit_cl_test(const int argc,
> cl_command_queue command_queue;
> cl_uint num_devices;
> cl_device_id* devices;
> -   cl_command_queue_properties mixed_command_queue_properties;
> +   cl_command_queue_properties mixed_command_queue_properties[4] =
> +   {CL_QUEUE_PROPERTIES, 0, 0, 0};
>
> cl_context_properties context_properties[] = {
> CL_CONTEXT_PLATFORM, (cl_context_properties)env->platform_id,
> @@ -116,12 +132,25 @@ piglit_cl_test(const int argc,
>  * There are 2^(num_command_queue_properties)-1 possible options.
>  */
> for(mask = 0; mask < (1 << num_command_queue_properties); mask++) {
> -   mixed_command_queue_properties =
> +   mixed_command_queue_properties[1] =
> get_mixed_command_queue_properties(mask, 
> command_queue_properties);
> -   command_queue = clCreateCommandQueue(cl_ctx,
> +   if (properties_forbidden(mixed_command_queue_properties[1], 
> env))
> +   continue;
> +#if defined CL_VERSION_2_0
> +   if (env->version >= 20) {
> +   command_queue = clCreateCommandQueueWithProperties(
> +cl_ctx,
>  env->device_id,
>  
> mixed_command_queue_properties,
>  &errNo);
> +   } else
> +#endif //CL_VERSION_2_0
> +   {
> +   command_queue = clCreateCommandQueue(cl_ctx,
> +env->device_id,
> +
> mixed_command_queue_properties[1],
> +&errNo);
> +

[Piglit] [PATCH] cl: Add basic remainder(float, float) builtin tests

2017-01-17 Thread Aaron Watry
Tested with libclc on a Radeon HD 7850.

Hex output values were generated via remainderf(float, float).

No implications as to the quality of the inputs is intended.

Signed-off-by: Aaron Watry 
---
 generated_tests/gen_cl_math_builtins.py | 13 +
 1 file changed, 13 insertions(+)

diff --git a/generated_tests/gen_cl_math_builtins.py 
b/generated_tests/gen_cl_math_builtins.py
index f609d73..178ff95 100644
--- a/generated_tests/gen_cl_math_builtins.py
+++ b/generated_tests/gen_cl_math_builtins.py
@@ -65,6 +65,7 @@ CLC_VERSION_MIN = {
 'log10' : 10,
 'log1p' : 10,
 'nextafter' : 10,
+'remainder' : 10,
 'round' : 10,
 'sin' : 10,
 'sinh' : 10,
@@ -398,6 +399,18 @@ tests = {
 [1.0,  -1.0 , 2.0, 0.0, 3.4, float("nan"), 5.0], # 
Arg1
 ]
 },
+'remainder' : {
+'arg_types': [F, F, F],
+'function_type': 'ttt',
+'values': [
+[float.fromhex("-0x1.dp-1"), float.fromhex("0x1.dp-1"),
+ float.fromhex("-0x1.dp-1"), float.fromhex("0x1.dp-1"),
+ 0.0, -0.0, 5.1, float("-nan")
+], # Result
+[ 5.1, -5.1,  5.1, -5.1, 0.0, -0.0, 5.1,  5.1], # Arg0
+[ 3.0,  3.0, -3.0, -3.0, 1.0,  1.0, float("inf"), 0.0], # Arg1
+]
+},
 'round' : {
 'arg_types': [F, F],
 'function_type': 'ttt',
-- 
2.9.3

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


[Piglit] [PATCH 1/3] CL: Fix up erfc tests

2017-01-16 Thread Aaron Watry
erfc(1.960/sqrt(2.0)) was completely wrong. It expected 0.95, but the
actual result should be ~0.05.

Also updated: erfc(2.576/sqrt(2.0)) for more precision in expected result

Tested with clover/libclc on PITCAIRN and Beignet on haswell.

This prevents regressions if/when the piglit ULP calculation is ever fixed.

Signed-off-by: Aaron Watry 
---
 generated_tests/gen_cl_math_builtins.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/generated_tests/gen_cl_math_builtins.py 
b/generated_tests/gen_cl_math_builtins.py
index 29b4e1a..a14d97b 100644
--- a/generated_tests/gen_cl_math_builtins.py
+++ b/generated_tests/gen_cl_math_builtins.py
@@ -252,8 +252,8 @@ tests = {
 'arg_types' : [F, F],
 'function_type': 'ttt',
 'values' : [
-[1.0, 0.95, 0.009995, 1.994999, 0.0, 0.0, 2.0], # Result
-[0.0, 1.960/sqrt(2.0), 2.576/sqrt(2.0), -2.807/sqrt(2.0), 11.1, 
float("inf"), float("-inf")]  # Arg0
+[1.0, 0.049995790296440745, 0.0099950646314, 1.994999, 0.0, 0.0, 
2.0], # Result
+[0.0, 1.960/sqrt(2.0),  2.576/sqrt(2.0), -2.807/sqrt(2.0), 
11.1, float("inf"), float("-inf")]  # Arg0
 ],
 'tolerance' : 16
 },
-- 
2.9.3

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


[Piglit] [PATCH 2/3] CL: Fix up erf tests

2017-01-16 Thread Aaron Watry
erf(11.1) was completely wrong.

Tested with clover/libclc on PITCAIRN and Beignet on haswell.

This prevents regressions if/when the piglit ULP calculation is ever fixed.

Signed-off-by: Aaron Watry 
---
 generated_tests/gen_cl_math_builtins.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/generated_tests/gen_cl_math_builtins.py 
b/generated_tests/gen_cl_math_builtins.py
index a14d97b..e9cfebf 100644
--- a/generated_tests/gen_cl_math_builtins.py
+++ b/generated_tests/gen_cl_math_builtins.py
@@ -243,7 +243,7 @@ tests = {
 'arg_types' : [F, F],
 'function_type': 'ttt',
 'values' : [
-[0.0, 0.950004,0.990005,-0.994999475,  
0.27219439321703e-29, 1, -1], # Result
+[0.0, 0.950004,0.990005,-0.994999475,  1, 1, 
-1], # Result
 [0.0, 1.960/sqrt(2.0), 2.576/sqrt(2.0), -2.807/sqrt(2.0), 11.1, 
float("inf"), float("-inf")]  # Arg0
 ],
 'tolerance' : 16
-- 
2.9.3

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


[Piglit] [PATCH 3/3] CL: Add some basic expm1 tests

2017-01-16 Thread Aaron Watry
These aren't too comprehensive, but there's some checks for reasonable accuracy
when the input is near 0.

Signed-off-by: Aaron Watry 
---
 generated_tests/gen_cl_math_builtins.py | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/generated_tests/gen_cl_math_builtins.py 
b/generated_tests/gen_cl_math_builtins.py
index e9cfebf..f609d73 100644
--- a/generated_tests/gen_cl_math_builtins.py
+++ b/generated_tests/gen_cl_math_builtins.py
@@ -27,7 +27,7 @@ from __future__ import print_function, division, 
absolute_import
 import os
 
 from genclbuiltins import gen, NEGNAN
-from math import acos, acosh, asin, asinh, atan, atan2, atanh, cos, cosh, exp
+from math import acos, acosh, asin, asinh, atan, atan2, atanh, cos, cosh, e, 
exp
 from math import fabs, fmod, log10, log1p, pi, pow, sin, sinh, sqrt, tan, tanh
 
 CLC_VERSION_MIN = {
@@ -51,6 +51,7 @@ CLC_VERSION_MIN = {
 'erf' : 10,
 'erfc' : 10,
 'exp' : 10,
+'expm1' : 10,
 'fabs' : 10,
 'fdim' : 10,
 'floor' : 10,
@@ -266,6 +267,15 @@ tests = {
 ],
 'tolerance' : 3
 },
+'expm1' : {
+'arg_types' : [F, F],
+'function_type': 'ttt',
+'values' : [
+[0.0, e-1.0, 1.005e-10, 1e-16, float("inf"), exp(-pi)-1, 
float("nan") ], # Result
+[0.0, 1.0, 1e-10, 1e-16, 710, -pi, float("nan")]  # Arg0
+],
+'tolerance' : 3
+},
 'fabs' : {
 'arg_types' : [F, F],
 'function_type': 'ttt',
-- 
2.9.3

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


[Piglit] [PATCH 1/5] cl/program-tester: Make sure that platform_ids is initialized

2016-12-22 Thread Aaron Watry
Otherwise, if you have ICDs installed and none successfully dlopen, you
end up freeing uninitialized/invalid memory.

Signed-off-by: Aaron Watry 

Discovered after an upgrade where I forgot to build mesa into clover, and
the nvidia icd was left around with no library to back it.
---
 tests/util/piglit-framework-cl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/util/piglit-framework-cl.c b/tests/util/piglit-framework-cl.c
index 9dc73c7..235f160 100644
--- a/tests/util/piglit-framework-cl.c
+++ b/tests/util/piglit-framework-cl.c
@@ -194,7 +194,7 @@ int piglit_cl_framework_run(int argc, char** argv)
 
bool platform_defined;
unsigned int num_platforms;
-   cl_platform_id* platform_ids;
+   cl_platform_id* platform_ids = NULL;
 
/* Create regexes */
if(   config->platform_regex != NULL
-- 
2.9.3

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


[Piglit] [PATCH] cl: Add some tests for fdim

2016-02-27 Thread Aaron Watry
Signed-off-by: Aaron Watry 
---
 generated_tests/gen_cl_math_builtins.py | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/generated_tests/gen_cl_math_builtins.py 
b/generated_tests/gen_cl_math_builtins.py
index 35fbce3..29b4e1a 100644
--- a/generated_tests/gen_cl_math_builtins.py
+++ b/generated_tests/gen_cl_math_builtins.py
@@ -52,6 +52,7 @@ CLC_VERSION_MIN = {
 'erfc' : 10,
 'exp' : 10,
 'fabs' : 10,
+'fdim' : 10,
 'floor' : 10,
 'fmax' : 10,
 'fmin' : 10,
@@ -274,6 +275,15 @@ tests = {
 ],
 'tolerance' : 0
 },
+'fdim' : {
+'arg_types' : [F, F, F],
+'function_type': 'ttt',
+'values' : [
+[0.0, 0.75, 0.0, 0.0, float("inf"),  0.0,  float("nan"), 
float("nan"), float("nan"), 2.2469 ], # Result
+[0.3, 1.0,  pi,  0.0, float("inf"),  float("inf"), float("nan"), 
1.0,  float("nan"), 1.12345 ], # Arg0
+[1.5, 0.25, pi, -0.0, float("-inf"), float("inf"), float("nan"), 
float("nan"), 1.0,  -1.12345] # Arg1
+]
+},
 'floor' : {
 'arg_types': [F, F],
 'function_type': 'ttt',
-- 
2.7.2

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


Re: [Piglit] [PATCH 1/2] cl: Add suport for builtins with multiple outputs

2016-02-22 Thread Aaron Watry
This patch is
Reviewed-by: Aaron Watry 

The other one I'm not as qualified to review the selected test values, so
it is:
Acked-By: Aaron Watry 

On Thu, Feb 18, 2016 at 2:25 PM, Jan Vesely  wrote:

> Hi,
>
>
> I plan to push both patches by the end of the week unless anyone
> objects. still a RB would be nice if anyone can spare some time.
>
>
> thank you,
> Jan
>
> On Fri, 2016-02-05 at 12:34 -0500, Jan Vesely wrote:
> > On Thu, 2016-02-04 at 22:15 -0600, Aaron Watry wrote:
> > > Type-o in the subject (Suport).
> > >
> > > On Wed, Feb 3, 2016 at 6:37 PM, Jan Vesely 
> > > wrote:
> > >
> > > > Reuses parts of Tom's fract test patch.
> > > > There is no change in generated tests with single output
> > > >
> > > > Signed-off-by: Jan Vesely 
> > > > ---
> > > >  generated_tests/genclbuiltins.py | 108
> > > > ---
> > > >  1 file changed, 79 insertions(+), 29 deletions(-)
> > > >
> > > > diff --git a/generated_tests/genclbuiltins.py
> > > > b/generated_tests/genclbuiltins.py
> > > > index 24bf249..7df55c9 100644
> > > > --- a/generated_tests/genclbuiltins.py
> > > > +++ b/generated_tests/genclbuiltins.py
> > > > @@ -109,13 +109,24 @@ B = {
> > > >
> > > >  # vecSizes has the layout [in0width, ..., inNwidth] where
> > > > outType
> > > > width is
> > > >  # assumed to match the width of the first input
> > > > -def gen_kernel(f, fnName, inTypes, outType, vecSizes,
> > > > typePrefix):
> > > > +def gen_kernel(f, fnName, inTypes, outTypes, vecSizes,
> > > > typePrefix,
> > > > outLoc='private'):
> > > >  f.write('kernel void test_' + typePrefix + str(vecSizes[0])
> > > > +
> > > > '_' +
> > > > fnName
> > > > -+ '_' + inTypes[0]+'(global '+outType+'* out')
> > > > ++ (('_' + outLoc) if len(outTypes) > 1 else '')
> > > > ++ '_' + inTypes[0] + '(global ' + outTypes[0] + '*
> > > > out')
> > > > +for arg in range(1, len(outTypes)):
> > > > +f.write(', global '+outTypes[arg]+'* out'+str(arg))
> > > >  for arg in range(0, len(inTypes)):
> > > >  f.write(', global '+inTypes[arg]+'* in'+str(arg))
> > > >  f.write('){\n')
> > > >
> > > > +for arg in range(1, len(outTypes)):
> > > > +f.write('  ' + outLoc + ' ' + outTypes[arg] + ('' if
> > > > vecSizes[0]
> > > > == 1 else str(vecSizes[0])));
> > > > +if (outLoc == 'global'):
> > > > +f.write(' *tmp' + str(arg) + ' = out' + str(arg) +
> > > > ';\n');
> > > > +else:
> > > > +#FIXME: This assumes WG size of 1
> > > >
> > >
> > > Was this FIXME left here intentionally for whoever needs that
> > > feature
> > > later? Cause yeah, the generated code for local memory tests with
> > > non-1 WG
> > > sizes is definitely broken.
> > >
> > > Do you plan on tackling that, or do you want to punt on it and just
> > > assume
> > > WG size =1 for now?
> >
> > The FIXME is intentional. I don't expect anyone to ever need WG > 1
> > for
> > these tests and supporting it properly looked like to much effort for
> > little gain:
> >
> > We'd need something like
> > local type tmpX[get_local_size(0)];
> > which is not allowed for obvious reasons.
> > we could to do:
> > local type tmpX[MAX_LOCAL_SIZE_X];
> > but we'd need to add that macro to cl-program-tester,
> >
> >
> > regards,
> > Jan
> >
> > PS: I fixed the typos and whitespace locally
> >
> > >
> > >
> > > > +f.write(' tmp' + str(arg) + ';\n');
> > > > +
> > > >  suffix = ';'
> > > >  if (vecSizes[0] == 1):
> > > >  f.write('  out[get_global_id(0)] = ')
> > > > @@ -134,88 +145,113 @@ def gen_kernel(f, fnName, inTypes,
> > > > outType,
> > > > vecSizes, typePrefix):
> > &

[Piglit] [PATCH] CL: Add tests to make sure that ilogb(0.0 or nan) returns FP_ILOGB0|FP_ILOGBNAN

2016-02-22 Thread Aaron Watry
Signed-off-by: Aaron Watry 
---
 tests/cl/program/execute/builtin/math/ilogb.cl | 31 ++
 1 file changed, 31 insertions(+)
 create mode 100644 tests/cl/program/execute/builtin/math/ilogb.cl

diff --git a/tests/cl/program/execute/builtin/math/ilogb.cl 
b/tests/cl/program/execute/builtin/math/ilogb.cl
new file mode 100644
index 000..0b23f2c
--- /dev/null
+++ b/tests/cl/program/execute/builtin/math/ilogb.cl
@@ -0,0 +1,31 @@
+/*!
+[config]
+name: ilogb
+clc_version_min: 10
+dimensions: 1
+
+[test]
+name: float scalar ilogb(0.0)
+kernel_name: ilogb_macro_ilogb0
+global_size: 1 0 0
+arg_out: 0 buffer int[1] 0
+arg_in: 1 buffer float[1] 0.0
+
+[test]
+name: float scalar ilogb(nan)
+kernel_name: ilogb_macro_ilogbnan
+global_size: 1 0 0
+arg_out: 0 buffer int[1] 0
+arg_in: 1 buffer float[1] nan
+
+!*/
+
+kernel void ilogb_macro_ilogb0(global int* out, global float* in1) {
+size_t id = get_global_id(0);
+out[id] = ilogb(in1[id]) - FP_ILOGB0;
+}
+
+kernel void ilogb_macro_ilogbnan(global int* out, global float* in1) {
+size_t id = get_global_id(0);
+out[id] = ilogb(in1[id]) - FP_ILOGBNAN;
+}
-- 
2.5.0

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


[Piglit] [PATCH] cl/math: Add some basic ilogb builtin tests

2016-02-10 Thread Aaron Watry
Note: Doesn't test 0 or NaN as those inputs support multiple possible output 
values.

Signed-off-by: Aaron Watry 
---
 generated_tests/gen_cl_math_builtins.py | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/generated_tests/gen_cl_math_builtins.py 
b/generated_tests/gen_cl_math_builtins.py
index df4e94b..6406495 100644
--- a/generated_tests/gen_cl_math_builtins.py
+++ b/generated_tests/gen_cl_math_builtins.py
@@ -56,6 +56,7 @@ CLC_VERSION_MIN = {
 'fmax' : 10,
 'fmin' : 10,
 'fmod' : 10,
+'ilogb' : 10,
 'ldexp' : 10,
 'log10' : 10,
 'log1p' : 10,
@@ -307,6 +308,15 @@ tests = {
 ],
 'tolerance' : 0
 },
+'ilogb' : {
+'arg_types': [I, F],
+'function_type': 'ttt',
+'values': [
+[0, 3, 1, 10, 2147483647, 2147483647],
+[1.0, 10.0, -3.0, 1234.5, float("inf"), float("-inf")]
+],
+'tolerance' : 0
+},
 'ldexp' : {
 'arg_types': [F, F, I],
 'function_type': 'tss',
-- 
2.5.0

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


Re: [Piglit] [PATCH 1/2] cl: Add suport for builtins with multiple outputs

2016-02-04 Thread Aaron Watry
Type-o in the subject (Suport).

On Wed, Feb 3, 2016 at 6:37 PM, Jan Vesely  wrote:

> Reuses parts of Tom's fract test patch.
> There is no change in generated tests with single output
>
> Signed-off-by: Jan Vesely 
> ---
>  generated_tests/genclbuiltins.py | 108
> ---
>  1 file changed, 79 insertions(+), 29 deletions(-)
>
> diff --git a/generated_tests/genclbuiltins.py
> b/generated_tests/genclbuiltins.py
> index 24bf249..7df55c9 100644
> --- a/generated_tests/genclbuiltins.py
> +++ b/generated_tests/genclbuiltins.py
> @@ -109,13 +109,24 @@ B = {
>
>  # vecSizes has the layout [in0width, ..., inNwidth] where outType width is
>  # assumed to match the width of the first input
> -def gen_kernel(f, fnName, inTypes, outType, vecSizes, typePrefix):
> +def gen_kernel(f, fnName, inTypes, outTypes, vecSizes, typePrefix,
> outLoc='private'):
>  f.write('kernel void test_' + typePrefix + str(vecSizes[0]) + '_' +
> fnName
> -+ '_' + inTypes[0]+'(global '+outType+'* out')
> ++ (('_' + outLoc) if len(outTypes) > 1 else '')
> ++ '_' + inTypes[0] + '(global ' + outTypes[0] + '* out')
> +for arg in range(1, len(outTypes)):
> +f.write(', global '+outTypes[arg]+'* out'+str(arg))
>  for arg in range(0, len(inTypes)):
>  f.write(', global '+inTypes[arg]+'* in'+str(arg))
>  f.write('){\n')
>
> +for arg in range(1, len(outTypes)):
> +f.write('  ' + outLoc + ' ' + outTypes[arg] + ('' if vecSizes[0]
> == 1 else str(vecSizes[0])));
> +if (outLoc == 'global'):
> +f.write(' *tmp' + str(arg) + ' = out' + str(arg) + ';\n');
> +else:
> +#FIXME: This assumes WG size of 1
>

Was this FIXME left here intentionally for whoever needs that feature
later? Cause yeah, the generated code for local memory tests with non-1 WG
sizes is definitely broken.

Do you plan on tackling that, or do you want to punt on it and just assume
WG size =1 for now?


> +f.write(' tmp' + str(arg) + ';\n');
> +
>  suffix = ';'
>  if (vecSizes[0] == 1):
>  f.write('  out[get_global_id(0)] = ')
> @@ -134,88 +145,113 @@ def gen_kernel(f, fnName, inTypes, outType,
> vecSizes, typePrefix):
>  f.write('in'+str(arg)+'[get_global_id(0)]')
>  else:
>  f.write('vload'+str(vecSizes[arg])+'(get_global_id(0),
> in'+str(arg)+')')
>

Might be nice to have a blank line here.


> +for arg in range(1, len(outTypes)):
> +if (outLoc == 'global'):
> +f.write(', &tmp' + str(arg) + '[get_global_id(0)]')
> +else:
> +f.write(', &tmp' + str(arg))
> +
> +f.write(suffix + '\n')
> +
>

And one less here.

Let me know about the local WG size thing. Otherwise, this looks ok with
the spelling/formatting changes.  I'm by no means a python expert, but this
looks functional, and I've already re-used it to add frexp tests.

--Aaron


> +
> +if (outLoc != 'global'):
> +for arg in range(1, len(outTypes)):
> +if (vecSizes[0] == 1):
> +f.write('  out'+ str(arg) +'[get_global_id(0)] = tmp' +
> str(arg))
> +else:
> +f.write('  vstore' + str(vecSizes[0]) + '(tmp' + str(arg)
> + ', get_global_id(0), out' + str(arg) + ')')
> +f.write(';\n')
>
> -f.write(suffix+'\n}\n\n')
> +f.write('}\n\n')
>
>
>
> -def gen_kernel_1_arg(f, fnName, inType, outType):
> +def gen_kernel_1_arg(f, fnName, inType, outTypes, loc = 'private'):
>  for vecSize in ALL_WIDTHS:
> -gen_kernel(f, fnName, [inType], outType, [vecSize], '')
> +gen_kernel(f, fnName, [inType], outTypes, [vecSize], '', loc)
>
>
>  #  2 argument kernel with input types that match their vector size
> -def gen_kernel_2_arg_same_size(f, fnName, inTypes, outType):
> +def gen_kernel_2_arg_same_size(f, fnName, inTypes, outTypes):
>  for vecSize in ALL_WIDTHS:
> -gen_kernel(f, fnName, inTypes, outType, [vecSize, vecSize],
> +gen_kernel(f, fnName, inTypes, outTypes, [vecSize, vecSize],
> '')
>
>
>  #  2 argument kernel with 1 vector and one scalar input argument
> -def gen_kernel_2_arg_mixed_size(f, fnName, inTypes, outType):
> +def gen_kernel_2_arg_mixed_size(f, fnName, inTypes, outTypes):
>  for vecSize in VEC_WIDTHS:
> -gen_kernel(f, fnName, inTypes, outType, [vecSize, 1], 'tss_')
> +gen_kernel(f, fnName, inTypes, outTypes, [vecSize, 1], 'tss_')
>
>
>  #  2 argument kernel with 1 vector and one scalar input argument with
> multiple
>  #input data types
> -def gen_kernel_2_arg_mixed_sign(f, fnName, inTypes, outType):
> +def gen_kernel_2_arg_mixed_sign(f, fnName, inTypes, outTypes):
>  for vecSize in ALL_WIDTHS:
> -gen_kernel(f, fnName, inTypes, outType, [vecSize, vecSize],
> +gen_kernel(f, fnName, inTypes, outTypes, [vecSize, vecSize],
> '')
>
>
>  #  3-argument built-in functions
>
>
> -def gen_kernel_

[Piglit] [PATCH] cl: Add frexp generated tests

2016-02-04 Thread Aaron Watry
Tested on MacOS Intel CPU CL and GeForce 9400M.

Signed-off-by: Aaron Watry 
---
This applies on top of Tom/Jan's 2-patch series to add fract generated tests 
and 2-output builtins

 generated_tests/gen_cl_math_builtins.py | 12 
 1 file changed, 12 insertions(+)

diff --git a/generated_tests/gen_cl_math_builtins.py 
b/generated_tests/gen_cl_math_builtins.py
index b6bae2a..c00321c 100644
--- a/generated_tests/gen_cl_math_builtins.py
+++ b/generated_tests/gen_cl_math_builtins.py
@@ -57,6 +57,7 @@ CLC_VERSION_MIN = {
 'fmin' : 10,
 'fmod' : 10,
 'fract' : 10,
+'frexp' : 10,
 'ldexp' : 10,
 'log10' : 10,
 'log1p' : 10,
@@ -319,6 +320,17 @@ tests = {
 ],
 'num_out_args' : 2
 },
+   'frexp' : {
+'arg_types': [F, I, F],
+'function_type': 'ttt',
+# For frexp we have two outputs per address space.
+'values': [
+[0.602783203125, 0.5, float("nan"), float("nan"),  float("inf"), 
float("-inf"), 0.0],
+[11, 1,   0,0, 0,
0, 0],
+[1234.5, 1.0, float("nan"), float("-nan"), float("inf"), 
float("-inf"), 0.0]
+],
+'num_out_args' : 2
+},
 'ldexp' : {
 'arg_types': [F, F, I],
 'function_type': 'tss',
-- 
2.6.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] CL/math: Add frexp builtin tests

2016-02-03 Thread Aaron Watry
Now that I saw Jan/Tom's patches for generating tests for built-ins with
multiple outputs, I think I'll try to rewrite these tests using that.

--Aaron

On Mon, Feb 1, 2016 at 10:41 PM, Aaron Watry  wrote:

> Add some non-generated float/double tests for the frexp builtin function.
>
> float frexp(float x, int* exp);
>
> The tests are in separate files so that devices that don't support doubles
> can still have the float variant tested.
>
> Because the function signature is so unique, I elected to not auto-generate
> tests for now.
>
> The double tests don't handle inf/nan, as I couldn't get piglit's CL tester
> to interpret those values correctly... Advice welcome.
>
> Signed-off-by: Aaron Watry 
> ---
>  tests/cl/program/execute/builtin/math/frexp.cl | 98
> ++
>  .../program/execute/builtin/math/frexp_double.cl   | 95
> +
>  2 files changed, 193 insertions(+)
>  create mode 100644 tests/cl/program/execute/builtin/math/frexp.cl
>  create mode 100644 tests/cl/program/execute/builtin/math/frexp_double.cl
>
> diff --git a/tests/cl/program/execute/builtin/math/frexp.cl
> b/tests/cl/program/execute/builtin/math/frexp.cl
> new file mode 100644
> index 000..66b0bdf
> --- /dev/null
> +++ b/tests/cl/program/execute/builtin/math/frexp.cl
> @@ -0,0 +1,98 @@
> +/*!
> +[config]
> +name: frexp
> +clc_version_min: 10
> +dimensions: 1
> +
> +#import struct
> +#def float_to_hex(f):
> +#return hex(struct.unpack(' +#
> +
> +[test]
> +name: float scalar simple
> +kernel_name: frexp_float_scalar
> +global_size: 1 0 0
> +arg_out: 0 buffer float[1] 0.602783203125
> +arg_in: 1 buffer float[1] 1234.5
> +arg_out: 2 buffer int[1] 11
> +
> +[test]
> +name: float scalar
> +kernel_name: frexp_float_scalar
> +global_size: 7 0 0
> +arg_out: 0 buffer float[7] 0.602783203125 0.5 nan nan  inf -inf 0.0
> +arg_in: 1 buffer float[7]  1234.5 1.0 nan -nan inf -inf 0.0
> +arg_out: 2 buffer int[7]   11 1   0   00   00
> +
> +[test]
> +name: float vector 2 simple
> +kernel_name: frexp_float_vec2
> +global_size: 1 0 0
> +arg_out: 0 buffer float[2] repeat 0.602783203125
> +arg_in: 1 buffer float[2] repeat 1234.5
> +arg_out: 2 buffer int[2] repeat 11
> +
> +[test]
> +name: float vector 3 complex
> +kernel_name: frexp_float_vec3
> +global_size: 1 0 0
> +arg_out: 0 buffer float[3] 0.602783203125 0.0 0.5
> +arg_in: 1 buffer float[3] 1234.5 0.0 1.0
> +arg_out: 2 buffer int[3] 11 0 1
> +
> +[test]
> +name: float vector 4 complex
> +kernel_name: frexp_float_vec4
> +global_size: 1 0 0
> +arg_out: 0 buffer float[4] 0.602783203125 0.0 0.5 nan
> +arg_in: 1 buffer float[4] 1234.5 0.0 1.0 nan
> +arg_out: 2 buffer int[4] 11 0 1 0
> +
> +[test]
> +name: float vector 8 complex
> +kernel_name: frexp_float_vec8
> +global_size: 1 0 0
> +arg_out: 0 buffer float[8] 0.602783203125 0.0 0.5 nan 0.5 nan
> 0.602783203125 0.0
> +arg_in: 1 buffer float[8] 1234.5 0.0 1.0 nan 1.0 nan 1234.5 0.0
> +arg_out: 2 buffer int[8] 11 0 1 0 1 0 11 0
> +
> +[test]
> +name: float vector 16 simple
> +kernel_name: frexp_float_vec16
> +global_size: 1 0 0
> +arg_out: 0 buffer float[16] repeat 0.602783203125
> +arg_in: 1 buffer float[16] repeat 1234.5
> +arg_out: 2 buffer int[16] repeat 11
> +
> +!*/
> +
> +kernel void frexp_float_scalar(global float* out, global float* in1,
> global int* out2) {
> +size_t id = get_global_id(0);
> +out[id] = frexp(in1[id], &out2[id]);
> +}
> +
> +kernel void frexp_float_vec2(global float2* out, global float2* in1,
> global int2* out2) {
> +size_t id = get_global_id(0);
> +out[id] = frexp(in1[id], &out2[id]);
> +}
> +
> +kernel void frexp_float_vec3(global float3* out, global float3* in1,
> global int3* out2) {
> +size_t id = get_global_id(0);
> +out[id] = frexp(in1[id], &out2[id]);
> +}
> +
> +kernel void frexp_float_vec4(global float4* out, global float4* in1,
> global int4* out2) {
> +size_t id = get_global_id(0);
> +out[id] = frexp(in1[id], &out2[id]);
> +}
> +
> +kernel void frexp_float_vec8(global float8* out, global float8* in1,
> global int8* out2) {
> +size_t id = get_global_id(0);
> +out[id] = frexp(in1[id], &out2[id]);
> +}
> +
> +kernel void frexp_float_vec16(global float16* out, global float16* in1,
> global int16* out2) {
> +size_t id = get_global_id(0);
> +out[id] = frexp(in1[id], &out2[id]);
> +}
> diff --git a/tests/cl/program/execute/builtin/math/frexp_double.cl
> b/tests/cl/program/execute/builtin/math/frexp_double.cl
> new file mode 100644
> index 000

[Piglit] [PATCH] CL/math: Add frexp builtin tests

2016-02-01 Thread Aaron Watry
Add some non-generated float/double tests for the frexp builtin function.

float frexp(float x, int* exp);

The tests are in separate files so that devices that don't support doubles
can still have the float variant tested.

Because the function signature is so unique, I elected to not auto-generate
tests for now.

The double tests don't handle inf/nan, as I couldn't get piglit's CL tester
to interpret those values correctly... Advice welcome.

Signed-off-by: Aaron Watry 
---
 tests/cl/program/execute/builtin/math/frexp.cl | 98 ++
 .../program/execute/builtin/math/frexp_double.cl   | 95 +
 2 files changed, 193 insertions(+)
 create mode 100644 tests/cl/program/execute/builtin/math/frexp.cl
 create mode 100644 tests/cl/program/execute/builtin/math/frexp_double.cl

diff --git a/tests/cl/program/execute/builtin/math/frexp.cl 
b/tests/cl/program/execute/builtin/math/frexp.cl
new file mode 100644
index 000..66b0bdf
--- /dev/null
+++ b/tests/cl/program/execute/builtin/math/frexp.cl
@@ -0,0 +1,98 @@
+/*!
+[config]
+name: frexp
+clc_version_min: 10
+dimensions: 1
+
+#import struct
+#def float_to_hex(f):
+#return hex(struct.unpack('http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] CL: Fix check of ULP when probing float/double results

2015-12-29 Thread Aaron Watry
On Tue, Dec 29, 2015 at 2:28 PM, Ilia Mirkin  wrote:

> On Tue, Dec 29, 2015 at 3:18 PM, Aaron Watry  wrote:
> > Regardless of whether 0.0 is the absolutely correct answer for
> > cos(1.57079632679), we can hopefully all agree that -4.0 is NOT a valid
> > answer for cosine of anything
>
> Right so that's clearly wrong :) I was largely warning you about some
> of the issues we ran into trying to compute ULPs, and especially
> combining them with each other. The GL_ARB_shader_precision text is
> quite precise and similarly difficult to test -- e.g. fma() is allowed
> to be fused or non-fused, at the implementation's option. But that
> causes all sorts of results to be way different.
>
> Perhaps you don't have these issues in the OpenCL specs.
>
>
Answers, hopefully?

With regards to FMA(a,b,c):
CL 1.2, Section 6.12.2 says:
"Returns the correctly rounded floating-point
representation of the sum of c with the infinitely
precise product of a and b. Rounding of
intermediate products shall not occur. Edge case
behavior is per the IEEE 754-2008 standard."

Rounding mode is also called out in section 6.12.2:
"The built-in math functions are not affected by the prevailing rounding
mode in the calling
environment, and always return the same value as they would if called with
the round to nearest
even rounding mode."

CL 1.2, section 7.4:
"In this section we discuss the maximum relative error defined as ulp
(units in the last place).
Addition, subtraction, multiplication, fused multiply-add and conversion
between integer and a
single precision floating-point format are IEEE 754 compliant and are
therefore correctly
rounded. Conversion between floating-point formats and explicit conversions
specified in
section 6.2.3 must be correctly rounded."

"The reference value used to compute the ULP value of an
arithmetic operation is the infinitely precise result."

So, we will still have to deal with the discrepancy between the infinitely
precise result and the rounded "expected" result when calculating our
ULP-based tolerances, but as already covered in the previous email, the
absolute tolerance was definitely wrong.

CL has a set of native_* functions that allows the implementation to choose
how to calculate the result.
Example: native_cos(x), which has implementation-defined precision, but
allows the vendor to optimize as they see fit while possibly sacrificing
accuracy.

Most of the time, I've seen the native_* functions used to call the
hardware implementation of those instructions, while the non-native ones
are implemented in CL C to achieve the required precision.

--Aaron




>   -ilia
>
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] CL: Fix check of ULP when probing float/double results

2015-12-29 Thread Aaron Watry
On Tue, Dec 29, 2015 at 12:16 PM, Ilia Mirkin  wrote:

> On Tue, Dec 29, 2015 at 1:01 PM, Aaron Watry  wrote:
> > Hi Jan/Tom,
> >
> > Sorry to resurrect an ancient thread, but I was poking at the piglit CL
> ULP
> > issue last night, and thought I'd try to get us closer to a solution
> after
> > dropping the matter for too long.
> >
> > I've modified your test program with what I was thinking of trying, and I
> > wouldn't mind your feedback.
> >
> > I realize that we still have issues with discrepancies between
> > python-generated expected results based on cpu/rounding mode and the ,
> but
> > I'd at least like for us to be able to nail down the C portion before we
> > start redefining all of our expected test results.  In the long term, we
> > probably want to hand-select our inputs/outputs instead of trusting
> python,
> > but I don't necessarily think that we should block fixing our ULP
> > calculations on getting that done.
> >
> > For now, I'm still ignoring the half-ULP possibility, and just
> generating a
> > minimum/maximum allowed value based on running nextafterf(expected,
> POS/NEG
> > INFINITY) in a loop for ULP iterations. Does that sound like a tenable
> > solution?
>
> I'm not 100% sure what you're trying to do, but Micah Fedke (and to a
> lesser extent I) spent a ton of time trying to make
> GL_ARB_shader_precision piglits in an automated manner (the ext
> specifies allowable error for a bunch of functions). We ended up with
> a solution which can test some very basic things on its own (single
> operations), but any complex function basically can only be tested
> with manually-selected values.
>
> Take a look at generated_tests/gen_shader_precision_tests.py .
>
> The basic issue that you have to contend with is that if you ever end
> up with a mul + add anywhere in the intermediate calculation of
> anything (e.g. dot product), it might get collapsed into a fma(),
> which will mess things up greatly. For example imagine you have the
> following code:
>
> x = uniform value which == a * b;
> y = a * b - x
>
> One way y == 0, another way y == some small but not insignificant
> number due to the added precision in the a*b calculation. No amount of
> ULP cleverness will save you here.
>
> If this has nothing to do with what you're trying to achieve, feel
> free to ignore :)
>
>
The issue that we have in CL piglits right now is that the program-tester
is treating the ULP value for a given test as an absolute tolerance, not as
floating units of least precision.

Example (generated_tests/cl/builtin/math/builtin-float-cos-1.0.generated.cl
):
[test]
name: cos float1
kernel_name: test_1_cos_float
global_size: 12 0 0

arg_out: 0 buffer float[12] 1.0 0.0 -1.0 0.0 1.0 0.432574513059
0.753902254343 -0.145500033809 0.943808393901 0.626322983292
-0.925879022855 nan  tolerance 4 ulp
arg_in: 1 buffer float[12] 0.0 1.57079632679 3.14159265359 4.71238898038
6.28318530718 1.12345 7 8 1048576.0 16777216.0 1.32922799578e+36 nan

Let's take the second test:
cos(1.57079632679) [essentially cos(pi/2)] should be roughly 0.0. The test
is specified with a tolerance of 4 ULP. The current piglit CL code is
accepting any value in the range [-4.0, ..., 4.0], because it is treating
the ULP as an absolute tolerance, not units of least precision.

Regardless of whether 0.0 is the absolutely correct answer for
cos(1.57079632679), we can hopefully all agree that -4.0 is NOT a valid
answer for cosine of anything

The functions that I'm trying to fix here (piglit-util-cl.c:
piglit_cl_probe_[floating|double]), take:
1) The actual result from the kernel/shader.
2) The expected result defined in the test.
3) A ULP value to use to calculate the acceptable tolerances.

But it does it wrong. It was copy/pasted from the integer checking code
which takes a tolerance...

--Aaron




>   -ilia
>
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] CL: Fix check of ULP when probing float/double results

2015-12-29 Thread Aaron Watry
Hi Jan/Tom,

Sorry to resurrect an ancient thread, but I was poking at the piglit CL ULP
issue last night, and thought I'd try to get us closer to a solution after
dropping the matter for too long.

I've modified your test program with what I was thinking of trying, and I
wouldn't mind your feedback.

I realize that we still have issues with discrepancies between
python-generated expected results based on cpu/rounding mode and the , but
I'd at least like for us to be able to nail down the C portion before we
start redefining all of our expected test results.  In the long term, we
probably want to hand-select our inputs/outputs instead of trusting python,
but I don't necessarily think that we should block fixing our ULP
calculations on getting that done.

For now, I'm still ignoring the half-ULP possibility, and just generating a
minimum/maximum allowed value based on running nextafterf(expected, POS/NEG
INFINITY) in a loop for ULP iterations. Does that sound like a tenable
solution?

--Aaron

On Sun, Jun 14, 2015 at 4:19 PM, Jan Vesely  wrote:

> On Sat, 2015-06-13 at 21:22 -0500, Aaron Watry wrote:
> > Meh, this still feels broken.  Give me a bit longer.
>
> and it is :). I don't think this can work based on abs(expected - real),
> since ULP depends on the magnitude of the numbers. This information is
> lost after subtraction.
>
> I had an idea some time back to implement this using nextafterf in both
> directions and checking whether the result falls in that interval.
> However, there is still a problem. Some of the expected values are
> already rounded (I'm not sure what rounding mode is used by python by
> default), but unless it always rounds in one direction, we'll still get
> slight differences based on whether the actual value was rounded up or
> down.
>
> I have attached a small test program that shows the deficiencies of
> fabsf based approaches.
>
> regards,
> Jan
>
> >
> > --Aaron
> >
> > On Sat, Jun 13, 2015 at 2:28 PM, Aaron Watry  wrote:
> >
> > > We need to actually check against the float value from the union,
> > > instead of just doing (diff > ulp), which seems to cast the diff to
> > > an int before checking against ulp.
> > >
> > > Signed-off-by: Aaron Watry 
> > > CC: Tom Stellard 
> > > CC: Jan Vesely 
> > > ---
> > >  tests/util/piglit-util-cl.c | 28 ++--
> > >  1 file changed, 14 insertions(+), 14 deletions(-)
> > >
> > > diff --git a/tests/util/piglit-util-cl.c b/tests/util/piglit-util-cl.c
> > > index 47e0c7a..6cdd718 100644
> > > --- a/tests/util/piglit-util-cl.c
> > > +++ b/tests/util/piglit-util-cl.c
> > > @@ -80,7 +80,7 @@ piglit_cl_probe_floating(float value, float expect,
> > > uint32_t ulp)
> > >
> > > diff = fabsf(value - expect);
> > >
> > > -   if(diff > ulp || isnan(value)) {
> > > +   if (diff > t.f || isnan(value)) {
> > > printf("Expecting %f (0x%x) with tolerance %f (%u
> ulps),
> > > but got %f (0x%x)\n",
> > >e.f, e.u, t.f, t.u, v.f, v.u);
> > > return false;
> > > @@ -108,7 +108,7 @@ piglit_cl_probe_double(double value, double expect,
> > > uint64_t ulp)
> > >
> > > diff = fabsl(value - expect);
> > >
> > > -   if(diff > ulp || isnan(value)) {
> > > +   if (diff > t.f || isnan(value)) {
> > > printf("Expecting %f (0x%lx) with tolerance %f (%lu
> ulps),
> > > but got %f (0x%lx)\n",
> > >e.f, e.u, t.f, t.u, v.f, v.u);
> > > return false;
> > > @@ -162,7 +162,7 @@ piglit_cl_get_platform_version(cl_platform_id
> platform)
> > > int scanf_count;
> > > int major;
> > > int minor;
> > > -
> > > +
> > > /*
> > >  * Returned format:
> > >  *
> > >  OpenCL > > information>
> > > @@ -353,7 +353,7 @@ piglit_cl_get_info(void* fn_ptr, void* obj, cl_uint
> > > param)
> > >
> > > if(errNo == CL_SUCCESS) {
> > > param_ptr = calloc(param_size, sizeof(char));
> > > -
> > > +
> > > /* retrieve param */
> > > if(fn_ptr == clGetPlatformInfo) {
> > > errNo =
> clGetPlatformInfo(*(cl_platform_id*)obj,
> > > param,
> > > @@ -463,7 +463,7 @@ piglit_cl_get_program_build_info(cl

[Piglit] [PATCH] cl: Update integer/long limit tests to detect incorrect storage sizes

2015-10-02 Thread Aaron Watry
The tests for the integer/long minimums do not properly
check that the value is stored in the correct type.
E.g. (-2147483648) actually gets parsed as a long by the preprocessor,
and therefore INT_MIN is actually stored as long and can't be automatically
vectorized.

By subtracting a vector with value of 0 from the given defined *_MIN
and then grabbing the first element of the resulting vector, we can
make sure that the values are actually stored in the correct type.

v2: Remove char/short modifications.
Test *_MAX vectorization as well as _MIN for int/long

CC: Jan Vesely 
Reported-By: Moritz Pflanzer 
Signed-off-by: Aaron Watry 
---
 tests/cl/program/execute/int-definitions.cl | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/cl/program/execute/int-definitions.cl 
b/tests/cl/program/execute/int-definitions.cl
index 011599d..75ce2ed 100644
--- a/tests/cl/program/execute/int-definitions.cl
+++ b/tests/cl/program/execute/int-definitions.cl
@@ -51,14 +51,14 @@ kernel void test_short(global int* out) {
 
 kernel void test_int(global int* out) {
   int i = 0;
-  out[i++] = INT_MAX;
-  out[i++] = INT_MIN;
-  out[i++] = UINT_MAX;
+  out[i++] = (INT_MAX - (int2)(0)).s0;
+  out[i++] = (INT_MIN - (int2)(0)).s0;
+  out[i++] = (UINT_MAX - (uint2)(0)).s0;
 }
 
 kernel void test_long(global long* out) {
   int i = 0;
-  out[i++] = LONG_MAX;
-  out[i++] = LONG_MIN;
-  out[i++] = ULONG_MAX;
+  out[i++] = (LONG_MAX - (long2)(0)).s0;
+  out[i++] = (LONG_MIN - (long2)(0)).s0;
+  out[i++] = (ULONG_MAX - (ulong2)(0)).s0;
 }
-- 
2.1.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 2/2] cl: Change data types of char/short buffers in integer limits tests

2015-09-22 Thread Aaron Watry
On Tue, Sep 22, 2015 at 12:02 AM, Jan Vesely  wrote:

> On Mon, 2015-09-21 at 23:07 -0500, Aaron Watry wrote:
> > On Thu, Sep 17, 2015 at 7:06 PM, Jan Vesely 
> > wrote:
> >
> > > On Thu, 2015-09-17 at 10:34 -0500, Aaron Watry wrote:
> > > > On Wed, Sep 16, 2015 at 7:33 PM, Jan Vesely <
> > > > jan.ves...@rutgers.edu>
> > > > wrote:
> > > >
> > > > > On Wed, 2015-09-16 at 17:18 -0500, Aaron Watry wrote:
> > > > > > On Tue, Sep 15, 2015 at 9:42 AM, Jan Vesely <
> > > > > > jan.ves...@rutgers.edu>
> > > > > > wrote:
> > > > > >
> > > > > > >
> > > > > > >
> > > > > > > On Tue, Sep 15, 2015 at 7:28 AM, Jan Vesely <
> > > > > > > jan.ves...@rutgers.edu
> > > > > > > >
> > > > > > > wrote:
> > > > > > >
> > > > > > > > On Thu, 2015-09-10 at 10:12 -0500, Aaron Watry wrote:
> > > > > > > > > The char/short return buffers were declared as ints.
> > > > > > > > >
> > > > > > > > > Signed-off-by: Aaron Watry 
> > > > > > > >
> > > > > > > > Reviewed-by: Jan Vesely 
> > > > > > > > For both patches.
> > > > > > > >
> > > > > > > > though, I agree with Serge that a spec reference would be
> > > > > > > > nice.
> > > > > > > >
> > > > > > >
> > > > > > > PS: don't we need to test this for *_MAX too? I'd expect at
> > > > > > > least
> > > > > > > char and
> > > > > > > short to have the same problem.
> > > > > > >
> > > > > >
> > > > > >
> > > > > > Yes, it seems that the _MAX values are also broken because
> > > > > > the
> > > > > > values
> > > > > > are
> > > > > > upgraded to ints by llvm.
> > > > >
> > > > > I checked the c99 specs, section 6.4.4.1 says that the type
> > > > > decimal
> > > > > constants without suffix is the first of int, long int, long
> > > > > long
> > > > > int,
> > > > > in which the value can be represented.
> > > > > So I guess llvm is doing the right thing here.
> > > > >
> > > > >
> > > > Yeah, I believe it...  It's just sad that the CL spec doesn't
> > > > take
> > > > into
> > > > account that the main usage of [CHAR|SHORT]_[MIN|MAX] will be for
> > > > comparisons that possibly include values of those types (or
> > > > something
> > > > smaller than an int).
> > > >
> > > > I'm updating the patches to send the _MAX values for each type
> > > > through a
> > > > vector/scalar round trip.
> > > >
> > > > While I'm at it, do we have any consensus on how the CHAR_BIT
> > > > macro
> > > > should
> > > > be defined?  The value of CHAR_BIT is the number of bits in a
> > > > byte,
> > > > but I'm
> > > > not really sure if it makes sense to cast it to char as well
> > > > (probably
> > > > doesn't hurt anything), or if we should leave it as an int.
> > >
> > > I did a bit more digging, and it turns out that both c99 and OpenCL
> > > require that "The values shall all be constant expressions suitable
> > > for
> > > use in #if preprocessing directives." (section 5.2.4.2.1 and
> > > 6.12.3).
> > > type casts don't work with preprocessor, so I think adding them is
> > > against the specs.
> > >
> > >
> > Yeah, I read that part of the CL spec as well... But I'm not sure why
> > you're saying that casts don't work with the pre-processor.  It most
> > definitely does work to cast those values to the desired type without
> > altering the underlying numeric value (if they're needed as ints,
> > they can
> > be sign/zero-extended without a change in the value), but given the
> > wording
> > surrounding that section, maybe we do want to leave the
> > CHAR/SHORT_MIN/MAX
> > values without an explicit cast (therefore as scalar ints).
&g

Re: [Piglit] [PATCH 2/2] cl: Change data types of char/short buffers in integer limits tests

2015-09-21 Thread Aaron Watry
On Thu, Sep 17, 2015 at 7:06 PM, Jan Vesely  wrote:

> On Thu, 2015-09-17 at 10:34 -0500, Aaron Watry wrote:
> > On Wed, Sep 16, 2015 at 7:33 PM, Jan Vesely 
> > wrote:
> >
> > > On Wed, 2015-09-16 at 17:18 -0500, Aaron Watry wrote:
> > > > On Tue, Sep 15, 2015 at 9:42 AM, Jan Vesely <
> > > > jan.ves...@rutgers.edu>
> > > > wrote:
> > > >
> > > > >
> > > > >
> > > > > On Tue, Sep 15, 2015 at 7:28 AM, Jan Vesely <
> > > > > jan.ves...@rutgers.edu
> > > > > >
> > > > > wrote:
> > > > >
> > > > > > On Thu, 2015-09-10 at 10:12 -0500, Aaron Watry wrote:
> > > > > > > The char/short return buffers were declared as ints.
> > > > > > >
> > > > > > > Signed-off-by: Aaron Watry 
> > > > > >
> > > > > > Reviewed-by: Jan Vesely 
> > > > > > For both patches.
> > > > > >
> > > > > > though, I agree with Serge that a spec reference would be
> > > > > > nice.
> > > > > >
> > > > >
> > > > > PS: don't we need to test this for *_MAX too? I'd expect at
> > > > > least
> > > > > char and
> > > > > short to have the same problem.
> > > > >
> > > >
> > > >
> > > > Yes, it seems that the _MAX values are also broken because the
> > > > values
> > > > are
> > > > upgraded to ints by llvm.
> > >
> > > I checked the c99 specs, section 6.4.4.1 says that the type decimal
> > > constants without suffix is the first of int, long int, long long
> > > int,
> > > in which the value can be represented.
> > > So I guess llvm is doing the right thing here.
> > >
> > >
> > Yeah, I believe it...  It's just sad that the CL spec doesn't take
> > into
> > account that the main usage of [CHAR|SHORT]_[MIN|MAX] will be for
> > comparisons that possibly include values of those types (or something
> > smaller than an int).
> >
> > I'm updating the patches to send the _MAX values for each type
> > through a
> > vector/scalar round trip.
> >
> > While I'm at it, do we have any consensus on how the CHAR_BIT macro
> > should
> > be defined?  The value of CHAR_BIT is the number of bits in a byte,
> > but I'm
> > not really sure if it makes sense to cast it to char as well
> > (probably
> > doesn't hurt anything), or if we should leave it as an int.
>
> I did a bit more digging, and it turns out that both c99 and OpenCL
> require that "The values shall all be constant expressions suitable for
> use in #if preprocessing directives." (section 5.2.4.2.1 and 6.12.3).
> type casts don't work with preprocessor, so I think adding them is
> against the specs.
>
>
Yeah, I read that part of the CL spec as well... But I'm not sure why
you're saying that casts don't work with the pre-processor.  It most
definitely does work to cast those values to the desired type without
altering the underlying numeric value (if they're needed as ints, they can
be sign/zero-extended without a change in the value), but given the wording
surrounding that section, maybe we do want to leave the CHAR/SHORT_MIN/MAX
values without an explicit cast (therefore as scalar ints).

I tested with the nvidia CL implementation and any char/short tests that
assume that [U][CHAR|SHORT]_[MIN|MAX] are of those respective types fail
because at least Nvidia treates them as ints.  I haven't tried out the AMD
implementation yet (it'd take a bit of setup work to do).

So where does that leave us?  Do we partially revert the libclc changes
(remove the explicit casts) to the [S]CHAR_MIN/SHORT_MIN values and leave
those values as ints, and then just modify the unit tests for
INT_MIN/INT_MAX to make sure they aren't upgraded to longs while leaving
the char/short tests alone?

I guess that's probably the way to go, but at this point, I'd like some
sort of consensus before I waste any more time going down the wrong
route... free time is in way too short a supply these days.

--Aaron



>
> Jan
>
>
>
> >
> >
> > > Jan
> > >
> > > >
> > > >
> > > > >
> > > > > > Jan
> > > > > >
> > > > > > > ---
> > > > > > >  tests/cl/program/execute/int-definitions.cl | 8 
> > > > > > >

Re: [Piglit] [PATCH 2/2] cl: Change data types of char/short buffers in integer limits tests

2015-09-17 Thread Aaron Watry
On Wed, Sep 16, 2015 at 7:33 PM, Jan Vesely  wrote:

> On Wed, 2015-09-16 at 17:18 -0500, Aaron Watry wrote:
> > On Tue, Sep 15, 2015 at 9:42 AM, Jan Vesely 
> > wrote:
> >
> > >
> > >
> > > On Tue, Sep 15, 2015 at 7:28 AM, Jan Vesely  > > >
> > > wrote:
> > >
> > > > On Thu, 2015-09-10 at 10:12 -0500, Aaron Watry wrote:
> > > > > The char/short return buffers were declared as ints.
> > > > >
> > > > > Signed-off-by: Aaron Watry 
> > > >
> > > > Reviewed-by: Jan Vesely 
> > > > For both patches.
> > > >
> > > > though, I agree with Serge that a spec reference would be nice.
> > > >
> > >
> > > PS: don't we need to test this for *_MAX too? I'd expect at least
> > > char and
> > > short to have the same problem.
> > >
> >
> >
> > Yes, it seems that the _MAX values are also broken because the values
> > are
> > upgraded to ints by llvm.
>
> I checked the c99 specs, section 6.4.4.1 says that the type decimal
> constants without suffix is the first of int, long int, long long int,
> in which the value can be represented.
> So I guess llvm is doing the right thing here.
>
>
Yeah, I believe it...  It's just sad that the CL spec doesn't take into
account that the main usage of [CHAR|SHORT]_[MIN|MAX] will be for
comparisons that possibly include values of those types (or something
smaller than an int).

I'm updating the patches to send the _MAX values for each type through a
vector/scalar round trip.

While I'm at it, do we have any consensus on how the CHAR_BIT macro should
be defined?  The value of CHAR_BIT is the number of bits in a byte, but I'm
not really sure if it makes sense to cast it to char as well (probably
doesn't hurt anything), or if we should leave it as an int.


> Jan
>
> >
> >
> > >
> > > > Jan
> > > >
> > > > > ---
> > > > >  tests/cl/program/execute/int-definitions.cl | 8 
> > > > >  1 file changed, 4 insertions(+), 4 deletions(-)
> > > > >
> > > > > diff --git a/tests/cl/program/execute/int-definitions.cl
> > > > > b/tests/cl/program/execute/int-definitions.cl
> > > > > index 3d8ee63..a438fe4 100644
> > > > > --- a/tests/cl/program/execute/int-definitions.cl
> > > > > +++ b/tests/cl/program/execute/int-definitions.cl
> > > > > @@ -12,12 +12,12 @@ global_size: 1 0 0
> > > > >  [test]
> > > > >  name: Char Definitions
> > > > >  kernel_name: test_char
> > > > > -arg_out: 0 buffer int[6] 8 127 -128 127 -128 255
> > > > > +arg_out: 0 buffer char[6] 8 127 -128 127 -128 255
> > > > >
> > > > >  [test]
> > > > >  name: Short Definitions
> > > > >  kernel_name: test_short
> > > > > -arg_out: 0 buffer int[3] 32767 -32768 65535
> > > > > +arg_out: 0 buffer short[3] 32767 -32768 65535
> > > > >
> > > > >  [test]
> > > > >  name: Int Definitions
> > > > > @@ -32,7 +32,7 @@ arg_out: 0 buffer long[3] 9223372036854775807
> > > > > \
> > > > >18446744073709551615
> > > > >  !*/
> > > > >
> > > > > -kernel void test_char(global int* out) {
> > > > > +kernel void test_char(global char* out) {
> > > > >int i = 0;
> > > > >out[i++] = CHAR_BIT;
> > > > >out[i++] = CHAR_MAX;
> > > > > @@ -42,7 +42,7 @@ kernel void test_char(global int* out) {
> > > > >out[i++] = UCHAR_MAX;
> > > > >  }
> > > > >
> > > > > -kernel void test_short(global int* out) {
> > > > > +kernel void test_short(global short* out) {
> > > > >int i = 0;
> > > > >out[i++] = SHRT_MAX;
> > > > >out[i++] = (SHRT_MIN - (short2)(0)).s0;
> > > >
> > >
> > >
>
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 2/2] cl: Change data types of char/short buffers in integer limits tests

2015-09-16 Thread Aaron Watry
On Tue, Sep 15, 2015 at 9:42 AM, Jan Vesely  wrote:

>
>
> On Tue, Sep 15, 2015 at 7:28 AM, Jan Vesely 
> wrote:
>
>> On Thu, 2015-09-10 at 10:12 -0500, Aaron Watry wrote:
>> > The char/short return buffers were declared as ints.
>> >
>> > Signed-off-by: Aaron Watry 
>>
>> Reviewed-by: Jan Vesely 
>> For both patches.
>>
>> though, I agree with Serge that a spec reference would be nice.
>>
>
> PS: don't we need to test this for *_MAX too? I'd expect at least char and
> short to have the same problem.
>


Yes, it seems that the _MAX values are also broken because the values are
upgraded to ints by llvm.


>
>> Jan
>>
>> > ---
>> >  tests/cl/program/execute/int-definitions.cl | 8 
>> >  1 file changed, 4 insertions(+), 4 deletions(-)
>> >
>> > diff --git a/tests/cl/program/execute/int-definitions.cl
>> > b/tests/cl/program/execute/int-definitions.cl
>> > index 3d8ee63..a438fe4 100644
>> > --- a/tests/cl/program/execute/int-definitions.cl
>> > +++ b/tests/cl/program/execute/int-definitions.cl
>> > @@ -12,12 +12,12 @@ global_size: 1 0 0
>> >  [test]
>> >  name: Char Definitions
>> >  kernel_name: test_char
>> > -arg_out: 0 buffer int[6] 8 127 -128 127 -128 255
>> > +arg_out: 0 buffer char[6] 8 127 -128 127 -128 255
>> >
>> >  [test]
>> >  name: Short Definitions
>> >  kernel_name: test_short
>> > -arg_out: 0 buffer int[3] 32767 -32768 65535
>> > +arg_out: 0 buffer short[3] 32767 -32768 65535
>> >
>> >  [test]
>> >  name: Int Definitions
>> > @@ -32,7 +32,7 @@ arg_out: 0 buffer long[3] 9223372036854775807 \
>> >18446744073709551615
>> >  !*/
>> >
>> > -kernel void test_char(global int* out) {
>> > +kernel void test_char(global char* out) {
>> >int i = 0;
>> >out[i++] = CHAR_BIT;
>> >out[i++] = CHAR_MAX;
>> > @@ -42,7 +42,7 @@ kernel void test_char(global int* out) {
>> >out[i++] = UCHAR_MAX;
>> >  }
>> >
>> > -kernel void test_short(global int* out) {
>> > +kernel void test_short(global short* out) {
>> >int i = 0;
>> >out[i++] = SHRT_MAX;
>> >out[i++] = (SHRT_MIN - (short2)(0)).s0;
>>
>
>
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/2] cl: Update integer limit tests to detect incorrect storage sizes

2015-09-10 Thread Aaron Watry
The tests for the char/short/integer/long minimums do not properly
check that the value is stored in the correct type.  E.g. (-32768)
actually gets parsed as an int by the preprocessor, and INT_MIN is
actually stored as a long.

By subtracting a vector with value of 0 from the given defined *_MIN
and then grabbing the first element of the resulting vector, we can
make sure that the values are actually stored in the correct type.

Reported-By: Moritz Pflanzer 
Signed-off-by: Aaron Watry 
---
 tests/cl/program/execute/int-definitions.cl | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/cl/program/execute/int-definitions.cl 
b/tests/cl/program/execute/int-definitions.cl
index 011599d..3d8ee63 100644
--- a/tests/cl/program/execute/int-definitions.cl
+++ b/tests/cl/program/execute/int-definitions.cl
@@ -36,29 +36,29 @@ kernel void test_char(global int* out) {
   int i = 0;
   out[i++] = CHAR_BIT;
   out[i++] = CHAR_MAX;
-  out[i++] = CHAR_MIN;
+  out[i++] = (CHAR_MIN - (char2)(0)).s0;
   out[i++] = SCHAR_MAX;
-  out[i++] = SCHAR_MIN;
+  out[i++] = (SCHAR_MIN - (char2)(0)).s0;
   out[i++] = UCHAR_MAX;
 }
 
 kernel void test_short(global int* out) {
   int i = 0;
   out[i++] = SHRT_MAX;
-  out[i++] = SHRT_MIN;
+  out[i++] = (SHRT_MIN - (short2)(0)).s0;
   out[i++] = USHRT_MAX;
 }
 
 kernel void test_int(global int* out) {
   int i = 0;
   out[i++] = INT_MAX;
-  out[i++] = INT_MIN;
+  out[i++] = (INT_MIN - (int2)(0)).s0;
   out[i++] = UINT_MAX;
 }
 
 kernel void test_long(global long* out) {
   int i = 0;
   out[i++] = LONG_MAX;
-  out[i++] = LONG_MIN;
+  out[i++] = (LONG_MIN - (long2)(0)).s0;
   out[i++] = ULONG_MAX;
 }
-- 
2.1.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/2] cl: Change data types of char/short buffers in integer limits tests

2015-09-10 Thread Aaron Watry
The char/short return buffers were declared as ints.

Signed-off-by: Aaron Watry 
---
 tests/cl/program/execute/int-definitions.cl | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/cl/program/execute/int-definitions.cl 
b/tests/cl/program/execute/int-definitions.cl
index 3d8ee63..a438fe4 100644
--- a/tests/cl/program/execute/int-definitions.cl
+++ b/tests/cl/program/execute/int-definitions.cl
@@ -12,12 +12,12 @@ global_size: 1 0 0
 [test]
 name: Char Definitions
 kernel_name: test_char
-arg_out: 0 buffer int[6] 8 127 -128 127 -128 255
+arg_out: 0 buffer char[6] 8 127 -128 127 -128 255
 
 [test]
 name: Short Definitions
 kernel_name: test_short
-arg_out: 0 buffer int[3] 32767 -32768 65535
+arg_out: 0 buffer short[3] 32767 -32768 65535
 
 [test]
 name: Int Definitions
@@ -32,7 +32,7 @@ arg_out: 0 buffer long[3] 9223372036854775807 \
   18446744073709551615
 !*/
 
-kernel void test_char(global int* out) {
+kernel void test_char(global char* out) {
   int i = 0;
   out[i++] = CHAR_BIT;
   out[i++] = CHAR_MAX;
@@ -42,7 +42,7 @@ kernel void test_char(global int* out) {
   out[i++] = UCHAR_MAX;
 }
 
-kernel void test_short(global int* out) {
+kernel void test_short(global short* out) {
   int i = 0;
   out[i++] = SHRT_MAX;
   out[i++] = (SHRT_MIN - (short2)(0)).s0;
-- 
2.1.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cl: fix bug in piglit_cl_probe_floating

2015-08-28 Thread Aaron Watry
Hmm, I'm not sure this is totally correct.  We actually ran into this back
in June, and I believe the conclusion is that we should actually be using
nextafterf/nextafter for calculating the tolerances for a given ulp.

See the email thread that started with my first patch here:
http://lists.freedesktop.org/archives/piglit/2015-June/016238.html

--Aaron

On Sat, Aug 15, 2015 at 8:37 AM, Zoltan Gilian 
wrote:

> The uint ulp value is compared to the float diff instead of
> reinterpreting the ulp as float.
> ---
>  Note: I'm new to contributing to piglit, and I don't have commit access.
>  tests/util/piglit-util-cl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/util/piglit-util-cl.c b/tests/util/piglit-util-cl.c
> index 47e0c7a..b49665a 100644
> --- a/tests/util/piglit-util-cl.c
> +++ b/tests/util/piglit-util-cl.c
> @@ -80,7 +80,7 @@ piglit_cl_probe_floating(float value, float expect,
> uint32_t ulp)
>
> diff = fabsf(value - expect);
>
> -   if(diff > ulp || isnan(value)) {
> +   if(diff > t.f || isnan(value)) {
> printf("Expecting %f (0x%x) with tolerance %f (%u ulps),
> but got %f (0x%x)\n",
>e.f, e.u, t.f, t.u, v.f, v.u);
> return false;
> --
> 2.4.6
>
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
>
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] CL: Fix check of ULP when probing float/double results

2015-06-14 Thread Aaron Watry
On Sun, Jun 14, 2015 at 4:19 PM, Jan Vesely  wrote:

> On Sat, 2015-06-13 at 21:22 -0500, Aaron Watry wrote:
> > Meh, this still feels broken.  Give me a bit longer.
>
> and it is :). I don't think this can work based on abs(expected - real),
> since ULP depends on the magnitude of the numbers. This information is
> lost after subtraction.
>

Yeah, that's essentially the conclusion that I came to last night as well.
Currently, we're saying that 3 ULP is 3x the smallest representable
floating point number, not 3x the interval between adjacent float values
for the given magnitude.

I was thinking that we might need to take the expected value, cast to
unsigned, add the ulp value, then convert back to float.  From there, find
the difference between expected and the expected+ulp, and use that as a
tolerance.  We could alternatively call nextafterf/nextafter the required
number of times from the expected value in either direction and get a
min/max allowed value and then check that the result value is in that range.

Yes, we still run into cases where the tests themselves are expected an
incorrectly rounded value, but at least the ULP checking code might be
functioning correctly then.

Thoughts?

--Aaron


> I had an idea some time back to implement this using nextafterf in both
> directions and checking whether the result falls in that interval.
> However, there is still a problem. Some of the expected values are
> already rounded (I'm not sure what rounding mode is used by python by
> default), but unless it always rounds in one direction, we'll still get
> slight differences based on whether the actual value was rounded up or
> down.
>
> I have attached a small test program that shows the deficiencies of
> fabsf based approaches.
>
> regards,
> Jan
>
> >
> > --Aaron
> >
> > On Sat, Jun 13, 2015 at 2:28 PM, Aaron Watry  wrote:
> >
> > > We need to actually check against the float value from the union,
> > > instead of just doing (diff > ulp), which seems to cast the diff to
> > > an int before checking against ulp.
> > >
> > > Signed-off-by: Aaron Watry 
> > > CC: Tom Stellard 
> > > CC: Jan Vesely 
> > > ---
> > >  tests/util/piglit-util-cl.c | 28 ++--
> > >  1 file changed, 14 insertions(+), 14 deletions(-)
> > >
> > > diff --git a/tests/util/piglit-util-cl.c b/tests/util/piglit-util-cl.c
> > > index 47e0c7a..6cdd718 100644
> > > --- a/tests/util/piglit-util-cl.c
> > > +++ b/tests/util/piglit-util-cl.c
> > > @@ -80,7 +80,7 @@ piglit_cl_probe_floating(float value, float expect,
> > > uint32_t ulp)
> > >
> > > diff = fabsf(value - expect);
> > >
> > > -   if(diff > ulp || isnan(value)) {
> > > +   if (diff > t.f || isnan(value)) {
> > > printf("Expecting %f (0x%x) with tolerance %f (%u
> ulps),
> > > but got %f (0x%x)\n",
> > >e.f, e.u, t.f, t.u, v.f, v.u);
> > > return false;
> > > @@ -108,7 +108,7 @@ piglit_cl_probe_double(double value, double expect,
> > > uint64_t ulp)
> > >
> > > diff = fabsl(value - expect);
> > >
> > > -   if(diff > ulp || isnan(value)) {
> > > +   if (diff > t.f || isnan(value)) {
> > > printf("Expecting %f (0x%lx) with tolerance %f (%lu
> ulps),
> > > but got %f (0x%lx)\n",
> > >e.f, e.u, t.f, t.u, v.f, v.u);
> > > return false;
> > > @@ -162,7 +162,7 @@ piglit_cl_get_platform_version(cl_platform_id
> platform)
> > > int scanf_count;
> > > int major;
> > > int minor;
> > > -
> > > +
> > > /*
> > >  * Returned format:
> > >  *
> > >  OpenCL > > information>
> > > @@ -353,7 +353,7 @@ piglit_cl_get_info(void* fn_ptr, void* obj, cl_uint
> > > param)
> > >
> > > if(errNo == CL_SUCCESS) {
> > > param_ptr = calloc(param_size, sizeof(char));
> > > -
> > > +
> > > /* retrieve param */
> > > if(fn_ptr == clGetPlatformInfo) {
> > > errNo =
> clGetPlatformInfo(*(cl_platform_id*)obj,
> > > param,
> > > @@ -463,7 +463,7 @@ piglit_cl_get_program_build_info(cl_program
> program,
> > > cl_device_id device,
> > > .program = program,
> > > .device = devic

Re: [Piglit] [PATCH] CL: Fix check of ULP when probing float/double results

2015-06-13 Thread Aaron Watry
Meh, this still feels broken.  Give me a bit longer.

--Aaron

On Sat, Jun 13, 2015 at 2:28 PM, Aaron Watry  wrote:

> We need to actually check against the float value from the union,
> instead of just doing (diff > ulp), which seems to cast the diff to
> an int before checking against ulp.
>
> Signed-off-by: Aaron Watry 
> CC: Tom Stellard 
> CC: Jan Vesely 
> ---
>  tests/util/piglit-util-cl.c | 28 ++--
>  1 file changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/tests/util/piglit-util-cl.c b/tests/util/piglit-util-cl.c
> index 47e0c7a..6cdd718 100644
> --- a/tests/util/piglit-util-cl.c
> +++ b/tests/util/piglit-util-cl.c
> @@ -80,7 +80,7 @@ piglit_cl_probe_floating(float value, float expect,
> uint32_t ulp)
>
> diff = fabsf(value - expect);
>
> -   if(diff > ulp || isnan(value)) {
> +   if (diff > t.f || isnan(value)) {
> printf("Expecting %f (0x%x) with tolerance %f (%u ulps),
> but got %f (0x%x)\n",
>e.f, e.u, t.f, t.u, v.f, v.u);
> return false;
> @@ -108,7 +108,7 @@ piglit_cl_probe_double(double value, double expect,
> uint64_t ulp)
>
> diff = fabsl(value - expect);
>
> -   if(diff > ulp || isnan(value)) {
> +   if (diff > t.f || isnan(value)) {
> printf("Expecting %f (0x%lx) with tolerance %f (%lu ulps),
> but got %f (0x%lx)\n",
>e.f, e.u, t.f, t.u, v.f, v.u);
> return false;
> @@ -162,7 +162,7 @@ piglit_cl_get_platform_version(cl_platform_id platform)
> int scanf_count;
> int major;
> int minor;
> -
> +
> /*
>  * Returned format:
>  *
>  OpenCL information>
> @@ -353,7 +353,7 @@ piglit_cl_get_info(void* fn_ptr, void* obj, cl_uint
> param)
>
> if(errNo == CL_SUCCESS) {
> param_ptr = calloc(param_size, sizeof(char));
> -
> +
> /* retrieve param */
> if(fn_ptr == clGetPlatformInfo) {
> errNo = clGetPlatformInfo(*(cl_platform_id*)obj,
> param,
> @@ -463,7 +463,7 @@ piglit_cl_get_program_build_info(cl_program program,
> cl_device_id device,
> .program = program,
> .device = device
> };
> -
> +
> return piglit_cl_get_info(clGetProgramBuildInfo, &args, param);
>  }
>
> @@ -479,7 +479,7 @@ piglit_cl_get_kernel_work_group_info(cl_kernel kernel,
> cl_device_id device,
> .kernel = kernel,
> .device = device
> };
> -
> +
> return piglit_cl_get_info(clGetKernelWorkGroupInfo, &args, param);
>  }
>
> @@ -620,7 +620,7 @@ piglit_cl_get_device_ids(cl_platform_id platform_id,
> cl_device_type device_type,
> piglit_cl_get_error_name(errNo));
> return 0;
> }
> -
> +
> /* get device list */
> if(device_ids != NULL && num_device_ids > 0) {
> *device_ids = malloc(num_device_ids *
> sizeof(cl_device_id));
> @@ -761,7 +761,7 @@
> piglit_cl_build_program_with_source_extended(piglit_cl_context context,
> piglit_cl_get_error_name(errNo));
> return NULL;
> }
> -
> +
> errNo = clBuildProgram(program,
>context->num_devices,
>context->device_ids,
> @@ -788,7 +788,7 @@
> piglit_cl_build_program_with_source_extended(piglit_cl_context context,
> char* log =
> piglit_cl_get_program_build_info(program,
>
>  context->device_ids[i],
>
>  CL_PROGRAM_BUILD_LOG);
> -
> +
> printf("Build log for device %s:\n  \n%s\n
>  \n",
>device_name,
>log);
> @@ -848,11 +848,11 @@
> piglit_cl_build_program_with_binary_extended(piglit_cl_context context,
> for(i = 0; i < context->num_devices; i++) {
> char* device_name =
> piglit_cl_get_device_info(context->device_ids[i],
>
> CL_DEVICE_NAME);
> -
> +
> printf("Error for %s: %s\n",
>device_name,
>piglit_cl_get_error_name(binary_status[i]));
> -
> +
> free(device_name);
> }
>
> @@ -860,7 +860,7 @@
> piglit_cl_build_program_with_binary_extended(pig

[Piglit] [PATCH] CL: Fix check of ULP when probing float/double results

2015-06-13 Thread Aaron Watry
We need to actually check against the float value from the union,
instead of just doing (diff > ulp), which seems to cast the diff to
an int before checking against ulp.

Signed-off-by: Aaron Watry 
CC: Tom Stellard 
CC: Jan Vesely 
---
 tests/util/piglit-util-cl.c | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/tests/util/piglit-util-cl.c b/tests/util/piglit-util-cl.c
index 47e0c7a..6cdd718 100644
--- a/tests/util/piglit-util-cl.c
+++ b/tests/util/piglit-util-cl.c
@@ -80,7 +80,7 @@ piglit_cl_probe_floating(float value, float expect,  uint32_t 
ulp)
 
diff = fabsf(value - expect);
 
-   if(diff > ulp || isnan(value)) {
+   if (diff > t.f || isnan(value)) {
printf("Expecting %f (0x%x) with tolerance %f (%u ulps), but 
got %f (0x%x)\n",
   e.f, e.u, t.f, t.u, v.f, v.u);
return false;
@@ -108,7 +108,7 @@ piglit_cl_probe_double(double value, double expect, 
uint64_t ulp)
 
diff = fabsl(value - expect);
 
-   if(diff > ulp || isnan(value)) {
+   if (diff > t.f || isnan(value)) {
printf("Expecting %f (0x%lx) with tolerance %f (%lu ulps), but 
got %f (0x%lx)\n",
   e.f, e.u, t.f, t.u, v.f, v.u);
return false;
@@ -162,7 +162,7 @@ piglit_cl_get_platform_version(cl_platform_id platform)
int scanf_count;
int major;
int minor;
-   
+
/*
 * Returned format:
 *   
OpenCL
@@ -353,7 +353,7 @@ piglit_cl_get_info(void* fn_ptr, void* obj, cl_uint param)
 
if(errNo == CL_SUCCESS) {
param_ptr = calloc(param_size, sizeof(char));
-   
+
/* retrieve param */
if(fn_ptr == clGetPlatformInfo) {
errNo = clGetPlatformInfo(*(cl_platform_id*)obj, param,
@@ -463,7 +463,7 @@ piglit_cl_get_program_build_info(cl_program program, 
cl_device_id device,
.program = program,
.device = device
};
-   
+
return piglit_cl_get_info(clGetProgramBuildInfo, &args, param);
 }
 
@@ -479,7 +479,7 @@ piglit_cl_get_kernel_work_group_info(cl_kernel kernel, 
cl_device_id device,
.kernel = kernel,
.device = device
};
-   
+
return piglit_cl_get_info(clGetKernelWorkGroupInfo, &args, param);
 }
 
@@ -620,7 +620,7 @@ piglit_cl_get_device_ids(cl_platform_id platform_id, 
cl_device_type device_type,
piglit_cl_get_error_name(errNo));
return 0;
}
-   
+
/* get device list */
if(device_ids != NULL && num_device_ids > 0) {
*device_ids = malloc(num_device_ids * 
sizeof(cl_device_id));
@@ -761,7 +761,7 @@ 
piglit_cl_build_program_with_source_extended(piglit_cl_context context,
piglit_cl_get_error_name(errNo));
return NULL;
}
-   
+
errNo = clBuildProgram(program,
   context->num_devices,
   context->device_ids,
@@ -788,7 +788,7 @@ 
piglit_cl_build_program_with_source_extended(piglit_cl_context context,
char* log = piglit_cl_get_program_build_info(program,
 
context->device_ids[i],
 
CL_PROGRAM_BUILD_LOG);
-   
+
printf("Build log for device %s:\n  \n%s\n 
 \n",
   device_name,
   log);
@@ -848,11 +848,11 @@ 
piglit_cl_build_program_with_binary_extended(piglit_cl_context context,
for(i = 0; i < context->num_devices; i++) {
char* device_name = 
piglit_cl_get_device_info(context->device_ids[i],
  
CL_DEVICE_NAME);
-   
+
printf("Error for %s: %s\n",
   device_name,
   piglit_cl_get_error_name(binary_status[i]));
-   
+
free(device_name);
}
 
@@ -860,7 +860,7 @@ 
piglit_cl_build_program_with_binary_extended(piglit_cl_context context,
return NULL;
}
free(binary_status);
-   
+
errNo = clBuildProgram(program,
   context->num_devices,
   context->device_ids,
@@ -884,11 +884,11 @@ 
piglit_cl_build_program_with_binary_extended(piglit_cl_context context,
char* log = piglit_cl_get_program_build_info(pr

[Piglit] CL FYI: ULP seems broken

2015-06-12 Thread Aaron Watry
Hi all,

I was working on some unit tests for the expm1 builtin cl function tonight,
and I noticed that in piglit-util-cl.c the code to probe  float/double
results and check that the result is within a given ulp sees to be treating
the ulp as an actual tolerance  instead of as a proper ulp value.

I'll try to see what I can do to fix it, but I wanted to let people know
about it, as fixing the bug may cause a bunch of math rests to start
failing if we have implementations that do not meet the precision
requirements.

--Aaron
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] CL: Add support for generating double-precision tests

2015-02-12 Thread Aaron Watry
Ping.  I just realized that I had this sitting around in my local
repository and never got any review (yay for the holidays causing things to
get lost).

--Aaron

On Wed, Dec 17, 2014 at 10:52 PM, Aaron Watry  wrote:

> The tests are skipped for devices that don't support doubles, and
> when the primary data type for a file is double, we enable the cl_khr_fp64
> pragma
> before writing any kernels.
>
> Signed-off-by: Aaron Watry 
> ---
>  generated_tests/genclbuiltins.py | 10 +-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/generated_tests/genclbuiltins.py
> b/generated_tests/genclbuiltins.py
> index 7e85a51..9a8e85e 100644
> --- a/generated_tests/genclbuiltins.py
> +++ b/generated_tests/genclbuiltins.py
> @@ -395,8 +395,13 @@ def gen(types, minVersions, functions, testDefs,
> dirName):
>  '[config]\n' +
>  'name: Test '+dataType+' '+fnName+' built-in on CL
> 1.1\n' +
>  'clc_version_min: '+str(clcVersionMin)+'\n' +
> -'dimensions: 1\n\n'
> +'dimensions: 1\n'
>  )
> +if (dataType == 'double'):
> +f.write('require_device_extensions: cl_khr_fp64\n')
> +
> +# Blank line  to provide separation between config header and
> tests
> +f.write('\n')
>
>  # Write all tests for the built-in function
>  tests = functionDef['values']
> @@ -416,6 +421,9 @@ def gen(types, minVersions, functions, testDefs,
> dirName):
>  # Terminate the header section
>  f.write('!*/\n\n')
>
> +if (dataType == 'double'):
> +f.write('#pragma OPENCL EXTENSION cl_khr_fp64 :
> enable\n\n')
> +
>  # Generate the actual kernels
>  generate_kernels(f, dataType, fnName, functionDef)
>
> --
> 2.2.0
>
>
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] CL: Add support for generating double-precision tests

2014-12-17 Thread Aaron Watry
The tests are skipped for devices that don't support doubles, and
when the primary data type for a file is double, we enable the cl_khr_fp64 
pragma
before writing any kernels.

Signed-off-by: Aaron Watry 
---
 generated_tests/genclbuiltins.py | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/generated_tests/genclbuiltins.py b/generated_tests/genclbuiltins.py
index 7e85a51..9a8e85e 100644
--- a/generated_tests/genclbuiltins.py
+++ b/generated_tests/genclbuiltins.py
@@ -395,8 +395,13 @@ def gen(types, minVersions, functions, testDefs, dirName):
 '[config]\n' +
 'name: Test '+dataType+' '+fnName+' built-in on CL 1.1\n' +
 'clc_version_min: '+str(clcVersionMin)+'\n' +
-'dimensions: 1\n\n'
+'dimensions: 1\n'
 )
+if (dataType == 'double'):
+f.write('require_device_extensions: cl_khr_fp64\n')
+
+# Blank line  to provide separation between config header and tests
+f.write('\n')
 
 # Write all tests for the built-in function
 tests = functionDef['values']
@@ -416,6 +421,9 @@ def gen(types, minVersions, functions, testDefs, dirName):
 # Terminate the header section
 f.write('!*/\n\n')
 
+if (dataType == 'double'):
+f.write('#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n\n')
+
 # Generate the actual kernels
 generate_kernels(f, dataType, fnName, functionDef)
 
-- 
2.2.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/2] CL: refactor genclbuiltins.py to allow TSS functions with different arg types

2014-12-17 Thread Aaron Watry
Ping.

The other patches I have no qualms about pushing, but I wouldn't mind
getting review for this one.

--Aaron

On Fri, Dec 12, 2014 at 3:05 PM, Aaron Watry  wrote:
> Before, if you had a function that had 2-3 args, it was assumed that all
> arguments were of the same base type.
>
> Now, that assumption is removed and we used the argument type defined in the
> test profile.
>
> This will be useful in the next commit, where ldexp(floatN,int) is introduced.
>
> This patch updates all multi-argument kernel generators to take an array of
> input types, instead of assuming that all inputs are of the same base type as
> the first argument.
> ---
>  generated_tests/genclbuiltins.py | 44 
> +++-
>  1 file changed, 25 insertions(+), 19 deletions(-)
>
> diff --git a/generated_tests/genclbuiltins.py 
> b/generated_tests/genclbuiltins.py
> index 571930d..6a595ff 100644
> --- a/generated_tests/genclbuiltins.py
> +++ b/generated_tests/genclbuiltins.py
> @@ -139,44 +139,44 @@ def gen_kernel_1_arg(f, fnName, inType, outType):
>  gen_kernel(f, fnName, [inType], outType, [vecSize], '')
>
>
> -#  2 argument kernel with input types that match
> -def gen_kernel_2_arg_same_type(f, fnName, inType, outType):
> +#  2 argument kernel with input types that match their vector size
> +def gen_kernel_2_arg_same_size(f, fnName, inTypes, outType):
>  for vecSize in ALL_WIDTHS:
> -gen_kernel(f, fnName, [inType, inType], outType, [vecSize, vecSize],
> +gen_kernel(f, fnName, inTypes, outType, [vecSize, vecSize],
> '')
>
>
>  #  2 argument kernel with 1 vector and one scalar input argument
> -def gen_kernel_2_arg_mixed_size(f, fnName, inType, outType):
> +def gen_kernel_2_arg_mixed_size(f, fnName, inTypes, outType):
>  for vecSize in VEC_WIDTHS:
> -gen_kernel(f, fnName, [inType, inType], outType, [vecSize, 1], 
> 'tss_')
> +gen_kernel(f, fnName, inTypes, outType, [vecSize, 1], 'tss_')
>
>
>  #  2 argument kernel with 1 vector and one scalar input argument with 
> multiple
>  #input data types
> -def gen_kernel_2_arg_mixed_sign(f, fnName, inType1, inType2, outType):
> +def gen_kernel_2_arg_mixed_sign(f, fnName, inTypes, outType):
>  for vecSize in ALL_WIDTHS:
> -gen_kernel(f, fnName, [inType1, inType2], outType, [vecSize, 
> vecSize],
> +gen_kernel(f, fnName, inTypes, outType, [vecSize, vecSize],
> '')
>
>
>  #  3-argument built-in functions
>
>
> -def gen_kernel_3_arg_same_type(f, fnName, inType, outType):
> +def gen_kernel_3_arg_same_type(f, fnName, inTypes, outType):
>  for vecSize in ALL_WIDTHS:
> -gen_kernel(f, fnName, [inType, inType, inType], outType,
> +gen_kernel(f, fnName, inTypes, outType,
> [vecSize, vecSize, vecSize], ''
>  )
>
> -def gen_kernel_3_arg_mixed_size_tss(f, fnName, inType, outType):
> +def gen_kernel_3_arg_mixed_size_tss(f, fnName, inTypes, outType):
>  for vecSize in VEC_WIDTHS:
> -gen_kernel(f, fnName, [inType, inType, inType], outType,
> +gen_kernel(f, fnName, inTypes, outType,
> [vecSize, 1, 1], 'tss_')
>
> -def gen_kernel_3_arg_mixed_size_tts(f, fnName, inType, outType):
> +def gen_kernel_3_arg_mixed_size_tts(f, fnName, inTypes, outType):
>  for vecSize in VEC_WIDTHS:
> -gen_kernel(f, fnName, [inType, inType, inType], outType,
> +gen_kernel(f, fnName, inTypes, outType,
> [vecSize, vecSize, 1], 'tts_')
>
>
> @@ -189,21 +189,27 @@ def generate_kernels(f, dataType, fnName, fnDef):
>  return
>
>  if (len(argTypes) == 3 and not fnName is 'upsample'):
> -gen_kernel_2_arg_same_type(f, fnName, argTypes[1], argTypes[0])
> +gen_kernel_2_arg_same_size(f, fnName,
> +[argTypes[1], argTypes[2]], argTypes[0])
>  if (fnDef['function_type'] is 'tss'):
> -gen_kernel_2_arg_mixed_size(f, fnName, argTypes[1], argTypes[0])
> +gen_kernel_2_arg_mixed_size(f, fnName,
> +[argTypes[1], argTypes[2]], argTypes[0])
>  return
>
>  if (len(argTypes) == 4):
> -gen_kernel_3_arg_same_type(f, fnName, argTypes[1], argTypes[0])
> +gen_kernel_3_arg_same_type(f, fnName,
> +   [argTypes[1], argTypes[2], argTypes[3]], argTypes[0])
>  if (fnDef['function_type'] is 'tss'):
> -gen_kernel_3_arg_mixed_size_tss(f, fnName, argTypes[1], 
> argTypes[0])
> +   

[Piglit] [PATCH 1/2] CL: refactor genclbuiltins.py to allow TSS functions with different arg types

2014-12-12 Thread Aaron Watry
Before, if you had a function that had 2-3 args, it was assumed that all
arguments were of the same base type.

Now, that assumption is removed and we used the argument type defined in the
test profile.

This will be useful in the next commit, where ldexp(floatN,int) is introduced.

This patch updates all multi-argument kernel generators to take an array of
input types, instead of assuming that all inputs are of the same base type as
the first argument.
---
 generated_tests/genclbuiltins.py | 44 +++-
 1 file changed, 25 insertions(+), 19 deletions(-)

diff --git a/generated_tests/genclbuiltins.py b/generated_tests/genclbuiltins.py
index 571930d..6a595ff 100644
--- a/generated_tests/genclbuiltins.py
+++ b/generated_tests/genclbuiltins.py
@@ -139,44 +139,44 @@ def gen_kernel_1_arg(f, fnName, inType, outType):
 gen_kernel(f, fnName, [inType], outType, [vecSize], '')
 
 
-#  2 argument kernel with input types that match
-def gen_kernel_2_arg_same_type(f, fnName, inType, outType):
+#  2 argument kernel with input types that match their vector size
+def gen_kernel_2_arg_same_size(f, fnName, inTypes, outType):
 for vecSize in ALL_WIDTHS:
-gen_kernel(f, fnName, [inType, inType], outType, [vecSize, vecSize],
+gen_kernel(f, fnName, inTypes, outType, [vecSize, vecSize],
'')
 
 
 #  2 argument kernel with 1 vector and one scalar input argument
-def gen_kernel_2_arg_mixed_size(f, fnName, inType, outType):
+def gen_kernel_2_arg_mixed_size(f, fnName, inTypes, outType):
 for vecSize in VEC_WIDTHS:
-gen_kernel(f, fnName, [inType, inType], outType, [vecSize, 1], 'tss_')
+gen_kernel(f, fnName, inTypes, outType, [vecSize, 1], 'tss_')
 
 
 #  2 argument kernel with 1 vector and one scalar input argument with multiple
 #input data types
-def gen_kernel_2_arg_mixed_sign(f, fnName, inType1, inType2, outType):
+def gen_kernel_2_arg_mixed_sign(f, fnName, inTypes, outType):
 for vecSize in ALL_WIDTHS:
-gen_kernel(f, fnName, [inType1, inType2], outType, [vecSize, vecSize],
+gen_kernel(f, fnName, inTypes, outType, [vecSize, vecSize],
'')
 
 
 #  3-argument built-in functions
 
 
-def gen_kernel_3_arg_same_type(f, fnName, inType, outType):
+def gen_kernel_3_arg_same_type(f, fnName, inTypes, outType):
 for vecSize in ALL_WIDTHS:
-gen_kernel(f, fnName, [inType, inType, inType], outType,
+gen_kernel(f, fnName, inTypes, outType,
[vecSize, vecSize, vecSize], ''
 )
 
-def gen_kernel_3_arg_mixed_size_tss(f, fnName, inType, outType):
+def gen_kernel_3_arg_mixed_size_tss(f, fnName, inTypes, outType):
 for vecSize in VEC_WIDTHS:
-gen_kernel(f, fnName, [inType, inType, inType], outType,
+gen_kernel(f, fnName, inTypes, outType,
[vecSize, 1, 1], 'tss_')
 
-def gen_kernel_3_arg_mixed_size_tts(f, fnName, inType, outType):
+def gen_kernel_3_arg_mixed_size_tts(f, fnName, inTypes, outType):
 for vecSize in VEC_WIDTHS:
-gen_kernel(f, fnName, [inType, inType, inType], outType,
+gen_kernel(f, fnName, inTypes, outType,
[vecSize, vecSize, 1], 'tts_')
 
 
@@ -189,21 +189,27 @@ def generate_kernels(f, dataType, fnName, fnDef):
 return
 
 if (len(argTypes) == 3 and not fnName is 'upsample'):
-gen_kernel_2_arg_same_type(f, fnName, argTypes[1], argTypes[0])
+gen_kernel_2_arg_same_size(f, fnName,
+[argTypes[1], argTypes[2]], argTypes[0])
 if (fnDef['function_type'] is 'tss'):
-gen_kernel_2_arg_mixed_size(f, fnName, argTypes[1], argTypes[0])
+gen_kernel_2_arg_mixed_size(f, fnName,
+[argTypes[1], argTypes[2]], argTypes[0])
 return
 
 if (len(argTypes) == 4):
-gen_kernel_3_arg_same_type(f, fnName, argTypes[1], argTypes[0])
+gen_kernel_3_arg_same_type(f, fnName,
+   [argTypes[1], argTypes[2], argTypes[3]], argTypes[0])
 if (fnDef['function_type'] is 'tss'):
-gen_kernel_3_arg_mixed_size_tss(f, fnName, argTypes[1], 
argTypes[0])
+gen_kernel_3_arg_mixed_size_tss(f, fnName,
+   [argTypes[1], argTypes[2], argTypes[3]], argTypes[0])
 if (fnDef['function_type'] is 'tts'):
-gen_kernel_3_arg_mixed_size_tts(f, fnName, argTypes[1], 
argTypes[0])
+gen_kernel_3_arg_mixed_size_tts(f, fnName,
+   [argTypes[1], argTypes[2], argTypes[3]], argTypes[0])
 return
 
 if (fnName is 'upsample'):
-gen_kernel_2_arg_mixed_sign(f, fnName, argTypes[1], argTypes[2],
+gen_kernel_2_arg_mixed_sign(f, fnName,
+[argTypes[1], argTypes[2]],
 argTypes[0])
 return
 
-- 
2.1.0

___
Piglit mailing list
Piglit@lists.freedesktop.or

[Piglit] [PATCH 2/2] CL: Add ldexp tests

2014-12-12 Thread Aaron Watry
Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-math-builtins.py | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index 7e475f2..490c0b8 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -48,6 +48,7 @@ CLC_VERSION_MIN = {
 'fabs' : 10,
 'floor' : 10,
 'fmod' : 10,
+'ldexp' : 10,
 'log1p' : 10,
 'mix' : 10,
 'nextafter' : 10,
@@ -68,6 +69,10 @@ F = {
 'float' : 'float'
 }
 
+I = {
+'float' : 'int'
+}
+
 tests = {
 'acos' : {
 'arg_types' : [F, F],
@@ -231,6 +236,16 @@ tests = {
 ],
 'tolerance' : 0
 },
+'ldexp' : {
+'arg_types': [F, F, I],
+'function_type': 'tss',
+'values': [
+[0.0, 4.0, 15.2, 1.75, float("nan"), float("inf")],
+[0.0, 1.0, 0.95, 3.5,  float("nan"), 1.12312312],
+[0,   2,   4,-1,   1,2031231231]
+],
+'tolerance' : 0
+},
 'log1p' : {
 'arg_types': [F, F],
 'function_type': 'ttt',
-- 
2.1.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/8] cl: Add atomic_sub global tests

2014-10-28 Thread Aaron Watry
Thanks for looking at these.

Yes, I agree that they would be easier to understand with separate
output buffers...  I started these long enough ago that I don't
remember why I did it this way, but am just left with the impression
that I thought I had a good reason at the time.

I want to get these in for now, and if we want, I can refactor them to
split up the output arrays. The important bit is to make sure to avoid
barriers if at all possible, since r600g/radeonsi + clover doesn't yet
have working global barriers (at least last I checked).

--Aaron

On Fri, Oct 24, 2014 at 11:08 AM, Jan Vesely  wrote:
> On Fri, 2014-10-24 at 07:55 -0500, Aaron Watry wrote:
>> Tests both usage of return value and no-return-usage variants.
>>
>> Signed-off-by: Aaron Watry 
>
> I think it would be easier to read/understand if the return variants
> used separate output buffer for the return values instead of offset
> magic.
>
> either way, for the series
> Reviewed-by: Jan Vesely 
>
>> ---
>>  .../builtin/atomic/atomic_sub-global-return.cl | 62 
>> ++
>>  .../execute/builtin/atomic/atomic_sub-global.cl| 59 
>>  2 files changed, 121 insertions(+)
>>  create mode 100644 
>> tests/cl/program/execute/builtin/atomic/atomic_sub-global-return.cl
>>  create mode 100644 
>> tests/cl/program/execute/builtin/atomic/atomic_sub-global.cl
>>
>> diff --git 
>> a/tests/cl/program/execute/builtin/atomic/atomic_sub-global-return.cl 
>> b/tests/cl/program/execute/builtin/atomic/atomic_sub-global-return.cl
>> new file mode 100644
>> index 000..8d826be
>> --- /dev/null
>> +++ b/tests/cl/program/execute/builtin/atomic/atomic_sub-global-return.cl
>> @@ -0,0 +1,62 @@
>> +/*!
>> +[config]
>> +name: atomic_sub global, with usage of return variable
>> +clc_version_min: 11
>> +
>> +[test]
>> +name: simple int
>> +kernel_name: simple_int
>> +dimensions: 1
>> +global_size: 1 0 0
>> +local_size:  1 0 0
>> +arg_out: 0 buffer int[2] -6 -4
>> +arg_in:  0 buffer int[2] -4 0
>> +
>> +[test]
>> +name: simple uint
>> +kernel_name: simple_uint
>> +dimensions: 1
>> +global_size: 1 0 0
>> +local_size:  1 0 0
>> +arg_out: 0 buffer uint[2] 1 3
>> +arg_in:  0 buffer uint[2] 3 0
>> +
>> +[test]
>> +name: threads int
>> +kernel_name: threads_int
>> +dimensions: 1
>> +global_size: 8 0 0
>> +local_size:  8 0 0
>> +arg_out: 0 buffer int[18] 0  0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8
>> +arg_in:  0 buffer int[18] 28 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0
>> +
>> +[test]
>> +name: threads uint
>> +kernel_name: threads_uint
>> +dimensions: 1
>> +global_size: 8 0 0
>> +local_size:  8 0 0
>> +arg_out: 0 buffer uint[18] 0  0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8
>> +arg_in:  0 buffer uint[18] 28 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0
>> +
>> +!*/
>> +
>> +#define SIMPLE_TEST(TYPE) \
>> +kernel void simple_##TYPE(global TYPE *mem) { \
>> +  mem[1] = atomic_sub(mem, 2); \
>> +}
>> +
>> +#define THREADS_TEST(TYPE) \
>> +kernel void threads_##TYPE(global TYPE *mem) { \
>> +  TYPE mul = mem[1]; \
>> +  TYPE id = get_global_id(0); \
>> +  TYPE ret = atomic_sub(mem, id); \
>> +  TYPE ret2 = atomic_sub(&mem[(id+1)*2], id+ret*mul); \
>> +  mem[(id+1)*2+1] = ret2; \
>> +}
>> +
>> +SIMPLE_TEST(int)
>> +SIMPLE_TEST(uint)
>> +
>> +THREADS_TEST(int)
>> +THREADS_TEST(uint)
>> diff --git a/tests/cl/program/execute/builtin/atomic/atomic_sub-global.cl 
>> b/tests/cl/program/execute/builtin/atomic/atomic_sub-global.cl
>> new file mode 100644
>> index 000..a3dca39
>> --- /dev/null
>> +++ b/tests/cl/program/execute/builtin/atomic/atomic_sub-global.cl
>> @@ -0,0 +1,59 @@
>> +/*!
>> +[config]
>> +name: atomic_sub global, no usage of return variable
>> +clc_version_min: 11
>> +
>> +[test]
>> +name: simple int
>> +kernel_name: simple_int
>> +dimensions: 1
>> +global_size: 1 0 0
>> +local_size:  1 0 0
>> +arg_out: 0 buffer int[1] -6
>> +arg_in:  0 buffer int[1] -4
>> +
>> +[test]
>> +name: simple uint
>> +kernel_name: simple_uint
>> +dimensions: 1
>> +global_size: 1 0 0
>> +local_size:  1 0 0
>> +arg_out: 0 buffer uint[1] 1
>> +arg_in:  0 buffer uint[1] 3
>> +
>> +[test]
>> +name: threads int
>> +kernel_name: threads_int
>> +dimensions: 1
>> +global_size: 8 0 0
>> +local_size:  8 0 0
>> +arg_out: 0 buf

Re: [Piglit] [PATCH 1/2] cl: Add some erf builtin tests

2014-10-28 Thread Aaron Watry
No, you're not missing anything. I had originally imported the
functions when working on these tests with the intention to use
them...  Then I just wrote in the expected results in the tests
without calling the functions (I'm occasionally wary that we're
trusting python's math lib to give us what we are treating as the
one-true-result).

Of course if python, intel-ocl, Apple CPU and the Apple GPU (Nvidia
GF9400) all agree on the answer, then we're probably good for now.

I'll remove the import statements before pushing.  If someone else
wants to use them in the future, it's easy enough to add them back in.

--Aaron



On Fri, Oct 24, 2014 at 10:07 AM, Jan Vesely  wrote:
> On Fri, 2014-10-24 at 07:49 -0500, Aaron Watry wrote:
>> Tested on Apple CL (CPU and GF9400m) down to 1 ULP precision, but
>> the spec says 16ULP.
>>
>> Signed-off-by: Aaron Watry 
>> ---
>>  generated_tests/generate-cl-math-builtins.py | 12 +++-
>>  1 file changed, 11 insertions(+), 1 deletion(-)
>>
>> diff --git a/generated_tests/generate-cl-math-builtins.py 
>> b/generated_tests/generate-cl-math-builtins.py
>> index cc9b60b..2919768 100644
>> --- a/generated_tests/generate-cl-math-builtins.py
>> +++ b/generated_tests/generate-cl-math-builtins.py
>> @@ -27,7 +27,7 @@ import os
>>
>>  from genclbuiltins import gen, NEGNAN
>>  from math import acos, acosh, asin, asinh, atan, atan2, atanh, cos, cosh
>> -from math import fabs, fmod, log1p, pi, pow, sin, sinh, sqrt, tan, tanh
>> +from math import erf, fabs, fmod, log1p, pi, pow, sin, sinh, sqrt, tan, tanh
> you import erf 
> but don't use it, am I missing something?
>
> same for the 2/2
>
> otherwise both lgtm
> i tested on intel-ocl too
>
> jan
>
>>
>>  CLC_VERSION_MIN = {
>>  'acos' : 10,
>> @@ -43,6 +43,7 @@ CLC_VERSION_MIN = {
>>  'cos' : 10,
>>  'cosh' : 10,
>>  'cospi' : 10,
>> +'erf' : 10,
>>  'fabs' : 10,
>>  'floor' : 10,
>>  'fmod' : 10,
>> @@ -184,6 +185,15 @@ tests = {
>>  ],
>>  'tolerance' : 4
>>  },
>> +'erf' : {
>> +'arg_types' : [F, F],
>> +'function_type': 'ttt',
>> +'values' : [
>> +[0.0, 0.950004,0.990005,-0.994999475,  
>> 0.27219439321703e-29, 1, -1], # Result
>> +[0.0, 1.960/sqrt(2.0), 2.576/sqrt(2.0), -2.807/sqrt(2.0), 11.1, 
>> float("inf"), float("-inf")]  # Arg0
>> +],
>> +'tolerance' : 16
>> +},
>>  'fabs' : {
>>  'arg_types' : [F, F],
>>  'function_type': 'ttt',
>
> --
> Jan Vesely 
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/8] cl: Add atomic_inc global tests

2014-10-24 Thread Aaron Watry
Tests both usage of return values and no usage in separate files.

Signed-off-by: Aaron Watry 
---
 .../builtin/atomic/atomic_inc-global-return.cl | 62 ++
 .../execute/builtin/atomic/atomic_inc-global.cl| 58 
 2 files changed, 120 insertions(+)
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_inc-global-return.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_inc-global.cl

diff --git 
a/tests/cl/program/execute/builtin/atomic/atomic_inc-global-return.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_inc-global-return.cl
new file mode 100644
index 000..e98e7f0
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_inc-global-return.cl
@@ -0,0 +1,62 @@
+/*!
+[config]
+name: atomic_inc global, with usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2] -4 -5
+arg_in:  0 buffer int[2] -5 0
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 1 0
+arg_in:  0 buffer uint[2] 0 0
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] -1 0  0 -1 2 1 3 2 4 3 5 4 6 5 7 6 8 7
+arg_in:  0 buffer int[18] -9 0 -1  0 1 0 2 0 3 0 4 0 5 0 6 0 7 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[18] 8 0 1 0 2 1 3 2 4 3 5 4 6 5 7 6 8 7
+arg_in:  0 buffer uint[18] 0 0 0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+  mem[1] = atomic_inc(mem); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE mul = mem[1]; \
+  TYPE id = get_global_id(0); \
+  TYPE ret = atomic_inc(mem); \
+  TYPE ret2 = atomic_inc(&mem[(id+1)*2]); \
+  mem[(id+1)*2+1] = ret2; \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_inc-global.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_inc-global.cl
new file mode 100644
index 000..e4b7315
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_inc-global.cl
@@ -0,0 +1,58 @@
+/*!
+[config]
+name: atomic_inc global, no usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[1] -4
+arg_in:  0 buffer int[1] -5
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[1] 1
+arg_in:  0 buffer uint[1] 0
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1]  0
+arg_in:  0 buffer int[1] -8
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 8
+arg_in:  0 buffer uint[1] 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+  atomic_inc(mem); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  atomic_inc(mem); \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
-- 
2.1.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 6/9] cl: Add atomic_min global tests

2014-10-24 Thread Aaron Watry
Tests for both usage-of and non-usage-of the return value

Signed-off-by: Aaron Watry 
---
 .../builtin/atomic/atomic_min-global-return.cl | 62 ++
 .../execute/builtin/atomic/atomic_min-global.cl| 59 
 2 files changed, 121 insertions(+)
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_min-global-return.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_min-global.cl

diff --git 
a/tests/cl/program/execute/builtin/atomic/atomic_min-global-return.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_min-global-return.cl
new file mode 100644
index 000..4b6caf5
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_min-global-return.cl
@@ -0,0 +1,62 @@
+/*!
+[config]
+name: atomic_min global, with usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2] 1 5
+arg_in:  0 buffer int[2] 5 0
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 1 2
+arg_in:  0 buffer uint[2] 2 0
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] 0 0 -1 -1 1 2 2 3 3 4 4 5 5 6 6 7 7 8
+arg_in:  0 buffer int[18] 7 0 -1  0 2 0 3 0 4 0 5 0 6 0 7 0 8 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[18] 0 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8
+arg_in:  0 buffer uint[18] 7 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+  mem[1] = atomic_min(mem, 1); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE mul = mem[1]; \
+  TYPE id = get_global_id(0); \
+  TYPE ret = atomic_min(mem, id); \
+  TYPE ret2 = atomic_min(&mem[(id+1)*2], id+ret*mul); \
+  mem[(id+1)*2+1] = ret2; \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_min-global.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_min-global.cl
new file mode 100644
index 000..0aaa13f
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_min-global.cl
@@ -0,0 +1,59 @@
+/*!
+[config]
+name: atomic_min global, no usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[1] -5
+arg_in:  0 buffer int[1] -5
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[1] 1
+arg_in:  0 buffer uint[1] 2
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 0
+arg_in:  0 buffer int[1] 7
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 0
+arg_in:  0 buffer uint[1] 7
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+  atomic_min(mem, 1); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE id = get_global_id(0); \
+  atomic_min(mem, id); \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
-- 
2.1.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 5/8] cl: Add atomic_max global tests

2014-10-24 Thread Aaron Watry
Tests both usage of return and no usage of return.

Signed-off-by: Aaron Watry 
---
 .../builtin/atomic/atomic_max-global-return.cl | 62 ++
 .../execute/builtin/atomic/atomic_max-global.cl| 59 
 2 files changed, 121 insertions(+)
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_max-global-return.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_max-global.cl

diff --git 
a/tests/cl/program/execute/builtin/atomic/atomic_max-global-return.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_max-global-return.cl
new file mode 100644
index 000..ff82e89
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_max-global-return.cl
@@ -0,0 +1,62 @@
+/*!
+[config]
+name: atomic_max global, with usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2]  1 -5
+arg_in:  0 buffer int[2] -5  0
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 1 0
+arg_in:  0 buffer uint[2] 0 0
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] 7 0 1 1 1 0 2 1 3 2 4 3 5 4 6 5 7 6
+arg_in:  0 buffer int[18] 0 0 1 0 0 0 1 0 2 0 3 0 4 0 5 0 6 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[18] 7 0 1 1 1 0 2 1 3 2 4 3 5 4 6 5 7 6
+arg_in:  0 buffer uint[18] 0 0 1 0 0 0 1 0 2 0 3 0 4 0 5 0 6 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+  mem[1] = atomic_max(mem, 1); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE mul = mem[1]; \
+  TYPE id = get_global_id(0); \
+  TYPE ret = atomic_max(mem, id); \
+  TYPE ret2 = atomic_max(&mem[(id+1)*2], id+ret*mul); \
+  mem[(id+1)*2+1] = ret2; \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_max-global.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_max-global.cl
new file mode 100644
index 000..e9526ac
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_max-global.cl
@@ -0,0 +1,59 @@
+/*!
+[config]
+name: atomic_max global, no usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[1]  1
+arg_in:  0 buffer int[1] -5
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[1] 1
+arg_in:  0 buffer uint[1] 0
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 7
+arg_in:  0 buffer int[1] 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 7
+arg_in:  0 buffer uint[1] 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+  atomic_max(mem, 1); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE id = get_global_id(0); \
+  atomic_max(mem, id); \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
-- 
2.1.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 3/8] cl: Add atomic_dec global tests

2014-10-24 Thread Aaron Watry
Tests both usage and non-usage of return value.

Signed-off-by: Aaron Watry 
---
 .../builtin/atomic/atomic_dec-global-return.cl | 62 ++
 .../execute/builtin/atomic/atomic_dec-global.cl| 58 
 2 files changed, 120 insertions(+)
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_dec-global-return.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_dec-global.cl

diff --git 
a/tests/cl/program/execute/builtin/atomic/atomic_dec-global-return.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_dec-global-return.cl
new file mode 100644
index 000..fc250b8
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_dec-global-return.cl
@@ -0,0 +1,62 @@
+/*!
+[config]
+name: atomic_dec global, with usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2] -5 -4
+arg_in:  0 buffer int[2] -4 0
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 1 2
+arg_in:  0 buffer uint[2] 2 0
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] -9 0 -1 0 1 2 2 3 3 4 4 5 5 6 6 7 7 8
+arg_in:  0 buffer int[18] -1 0  0 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[18] 0 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8
+arg_in:  0 buffer uint[18] 8 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+  mem[1] = atomic_dec(mem); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE mul = mem[1]; \
+  TYPE id = get_global_id(0); \
+  TYPE ret = atomic_dec(mem); \
+  TYPE ret2 = atomic_dec(&mem[(id+1)*2]); \
+  mem[(id+1)*2+1] = ret2; \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_dec-global.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_dec-global.cl
new file mode 100644
index 000..c0570d5
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_dec-global.cl
@@ -0,0 +1,58 @@
+/*!
+[config]
+name: atomic_dec global, no usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[1] -5
+arg_in:  0 buffer int[1] -4
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[1] 1
+arg_in:  0 buffer uint[1] 2
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] -8
+arg_in:  0 buffer int[1]  0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 1
+arg_in:  0 buffer uint[1] 9
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+  atomic_dec(mem); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  atomic_dec(mem); \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
-- 
2.1.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 6/8] cl: Add atomic_min global tests

2014-10-24 Thread Aaron Watry
Tests for both usage-of and non-usage-of the return value

Signed-off-by: Aaron Watry 
---
 .../builtin/atomic/atomic_min-global-return.cl | 62 ++
 .../execute/builtin/atomic/atomic_min-global.cl| 59 
 2 files changed, 121 insertions(+)
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_min-global-return.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_min-global.cl

diff --git 
a/tests/cl/program/execute/builtin/atomic/atomic_min-global-return.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_min-global-return.cl
new file mode 100644
index 000..4b6caf5
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_min-global-return.cl
@@ -0,0 +1,62 @@
+/*!
+[config]
+name: atomic_min global, with usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2] 1 5
+arg_in:  0 buffer int[2] 5 0
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 1 2
+arg_in:  0 buffer uint[2] 2 0
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] 0 0 -1 -1 1 2 2 3 3 4 4 5 5 6 6 7 7 8
+arg_in:  0 buffer int[18] 7 0 -1  0 2 0 3 0 4 0 5 0 6 0 7 0 8 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[18] 0 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8
+arg_in:  0 buffer uint[18] 7 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+  mem[1] = atomic_min(mem, 1); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE mul = mem[1]; \
+  TYPE id = get_global_id(0); \
+  TYPE ret = atomic_min(mem, id); \
+  TYPE ret2 = atomic_min(&mem[(id+1)*2], id+ret*mul); \
+  mem[(id+1)*2+1] = ret2; \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_min-global.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_min-global.cl
new file mode 100644
index 000..0aaa13f
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_min-global.cl
@@ -0,0 +1,59 @@
+/*!
+[config]
+name: atomic_min global, no usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[1] -5
+arg_in:  0 buffer int[1] -5
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[1] 1
+arg_in:  0 buffer uint[1] 2
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 0
+arg_in:  0 buffer int[1] 7
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 0
+arg_in:  0 buffer uint[1] 7
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+  atomic_min(mem, 1); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE id = get_global_id(0); \
+  atomic_min(mem, id); \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
-- 
2.1.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 7/8] cl: Add atomic_or global tests

2014-10-24 Thread Aaron Watry
Tests both usage of and no usage of return value.

Signed-off-by: Aaron Watry 
---
 .../builtin/atomic/atomic_or-global-return.cl  | 64 ++
 .../execute/builtin/atomic/atomic_or-global.cl | 61 +
 2 files changed, 125 insertions(+)
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_or-global-return.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_or-global.cl

diff --git a/tests/cl/program/execute/builtin/atomic/atomic_or-global-return.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_or-global-return.cl
new file mode 100644
index 000..addaaad
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_or-global-return.cl
@@ -0,0 +1,64 @@
+/*!
+[config]
+name: atomic_or global, with usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2] -3 5
+arg_in:  0 buffer int[2]  5 0
+arg_in:  1int-4
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 14 6
+arg_in:  0 buffer uint[2]  6 0
+arg_in:  1uint10
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] 7 0 7 7 3 2 6 4 3 0 6 2 7 2 14 8 15 8
+arg_in:  0 buffer int[18] 0 0 7 0 2 0 4 0 0 0 2 0 2 0  8 0  8 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] 7 0 7 7 3 2 6 4 3 0 6 2 7 2 14 8 15 8
+arg_in:  0 buffer int[18] 0 0 7 0 2 0 4 0 0 0 2 0 2 0  8 0  8 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem, TYPE value) { \
+  mem[1] = atomic_or(mem, value); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE mul = mem[1]; \
+  TYPE id = get_global_id(0); \
+  TYPE ret = atomic_or(mem, id); \
+  TYPE ret2 = atomic_or(&mem[(id+1)*2], id+ret*mul); \
+  mem[(id+1)*2+1] = ret2; \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_or-global.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_or-global.cl
new file mode 100644
index 000..dce5760
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_or-global.cl
@@ -0,0 +1,61 @@
+/*!
+[config]
+name: atomic_or global, no usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[1] -3
+arg_in:  0 buffer int[1]  5
+arg_in:  1int-4
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[1] 14
+arg_in:  0 buffer uint[1]  6
+arg_in:  1uint10
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 7
+arg_in:  0 buffer int[1] 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 7
+arg_in:  0 buffer uint[1] 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem, TYPE value) { \
+  atomic_or(mem, value); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE id = get_global_id(0); \
+  atomic_or(mem, id); \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
-- 
2.1.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 8/8] cl: Add atomix_xor global tests

2014-10-24 Thread Aaron Watry
Tests both usage and non-usage of return value.

Signed-off-by: Aaron Watry 
---
 .../builtin/atomic/atomic_xor-global-return.cl | 64 ++
 .../execute/builtin/atomic/atomic_xor-global.cl| 61 +
 2 files changed, 125 insertions(+)
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_xor-global-return.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_xor-global.cl

diff --git 
a/tests/cl/program/execute/builtin/atomic/atomic_xor-global-return.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_xor-global-return.cl
new file mode 100644
index 000..5121b91
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_xor-global-return.cl
@@ -0,0 +1,64 @@
+/*!
+[config]
+name: atomic_xor global, with usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2] -7 5
+arg_in:  0 buffer int[2]  5 0
+arg_in:  1int-4
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 12 6
+arg_in:  0 buffer uint[2]  6 0
+arg_in:  1uint10
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] 7 0 7 7 6 7 5 7 4 7 3 7 2 7 1 7 0 7
+arg_in:  0 buffer int[18] 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] 7 0 7 7 6 7 5 7 4 7 3 7 2 7 1 7 0 7
+arg_in:  0 buffer int[18] 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem, TYPE value) { \
+  mem[1] = atomic_xor(mem, value); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE mul = mem[1]; \
+  TYPE id = get_global_id(0); \
+  TYPE ret = atomic_xor(mem, id); \
+  TYPE ret2 = atomic_xor(&mem[(id+1)*2], id+ret*mul); \
+  mem[(id+1)*2+1] = ret2; \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_xor-global.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_xor-global.cl
new file mode 100644
index 000..3db9344
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_xor-global.cl
@@ -0,0 +1,61 @@
+/*!
+[config]
+name: atomic_xor global, no usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[1] -7
+arg_in:  0 buffer int[1]  5
+arg_in:  1int-4
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[1] 12
+arg_in:  0 buffer uint[1]  6
+arg_in:  1uint10
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] -7
+arg_in:  0 buffer int[1] -7
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 7
+arg_in:  0 buffer uint[1] 7
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem, TYPE value) { \
+  atomic_xor(mem, value); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE id = get_global_id(0); \
+  atomic_xor(mem, id); \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
-- 
2.1.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/8] cl: Add atomic_sub global tests

2014-10-24 Thread Aaron Watry
Tests both usage of return value and no-return-usage variants.

Signed-off-by: Aaron Watry 
---
 .../builtin/atomic/atomic_sub-global-return.cl | 62 ++
 .../execute/builtin/atomic/atomic_sub-global.cl| 59 
 2 files changed, 121 insertions(+)
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_sub-global-return.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_sub-global.cl

diff --git 
a/tests/cl/program/execute/builtin/atomic/atomic_sub-global-return.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_sub-global-return.cl
new file mode 100644
index 000..8d826be
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_sub-global-return.cl
@@ -0,0 +1,62 @@
+/*!
+[config]
+name: atomic_sub global, with usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2] -6 -4
+arg_in:  0 buffer int[2] -4 0
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 1 3
+arg_in:  0 buffer uint[2] 3 0
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] 0  0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8
+arg_in:  0 buffer int[18] 28 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[18] 0  0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8
+arg_in:  0 buffer uint[18] 28 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+  mem[1] = atomic_sub(mem, 2); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE mul = mem[1]; \
+  TYPE id = get_global_id(0); \
+  TYPE ret = atomic_sub(mem, id); \
+  TYPE ret2 = atomic_sub(&mem[(id+1)*2], id+ret*mul); \
+  mem[(id+1)*2+1] = ret2; \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_sub-global.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_sub-global.cl
new file mode 100644
index 000..a3dca39
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_sub-global.cl
@@ -0,0 +1,59 @@
+/*!
+[config]
+name: atomic_sub global, no usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[1] -6
+arg_in:  0 buffer int[1] -4
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[1] 1
+arg_in:  0 buffer uint[1] 3
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 0
+arg_in:  0 buffer int[1] 28
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 0
+arg_in:  0 buffer uint[1] 28
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+  atomic_sub(mem, 2); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE id = get_global_id(0); \
+  atomic_sub(mem, id); \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
-- 
2.1.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 4/8] cl: Add atomic_and global tests

2014-10-24 Thread Aaron Watry
Tests both usage of return and no usage of return variants.

Signed-off-by: Aaron Watry 
---
 .../builtin/atomic/atomic_and-global-return.cl | 64 ++
 .../execute/builtin/atomic/atomic_and-global.cl| 61 +
 2 files changed, 125 insertions(+)
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_and-global-return.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_and-global.cl

diff --git 
a/tests/cl/program/execute/builtin/atomic/atomic_and-global-return.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_and-global-return.cl
new file mode 100644
index 000..66388b7
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_and-global-return.cl
@@ -0,0 +1,64 @@
+/*!
+[config]
+name: atomic_and global, with usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2]  4 5
+arg_in:  0 buffer int[2]  5 0
+arg_in:  1int-4
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2]  2 6
+arg_in:  0 buffer uint[2]  6 0
+arg_in:  1uint10
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] 0 0 0 7 1 7 2 7 3 7 4 7 5 7 6 7 7 7
+arg_in:  0 buffer int[18] 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[18] 0 0 0 7 1 7 2 7 3 7 4 7 5 7 6 7 7 7
+arg_in:  0 buffer uint[18] 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem, TYPE value) { \
+  mem[1] = atomic_and(mem, value); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE mul = mem[1]; \
+  TYPE id = get_global_id(0); \
+  TYPE ret = atomic_and(mem, id); \
+  TYPE ret2 = atomic_and(&mem[(id+1)*2], id+ret*mul); \
+  mem[(id+1)*2+1] = ret2; \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_and-global.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_and-global.cl
new file mode 100644
index 000..dc0cb0d
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_and-global.cl
@@ -0,0 +1,61 @@
+/*!
+[config]
+name: atomic_and global, no usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[1]  4
+arg_in:  0 buffer int[1]  5
+arg_in:  1int-4
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[1]  2
+arg_in:  0 buffer uint[1]  6
+arg_in:  1uint10
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1]  0
+arg_in:  0 buffer int[1] -7
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 0
+arg_in:  0 buffer uint[1] 7
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem, TYPE value) { \
+  atomic_and(mem, value); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE id = get_global_id(0); \
+  atomic_and(mem, id); \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
-- 
2.1.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/2] cl: Add some erf builtin tests

2014-10-24 Thread Aaron Watry
Tested on Apple CL (CPU and GF9400m) down to 1 ULP precision, but
the spec says 16ULP.

Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-math-builtins.py | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index cc9b60b..2919768 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -27,7 +27,7 @@ import os
 
 from genclbuiltins import gen, NEGNAN
 from math import acos, acosh, asin, asinh, atan, atan2, atanh, cos, cosh
-from math import fabs, fmod, log1p, pi, pow, sin, sinh, sqrt, tan, tanh
+from math import erf, fabs, fmod, log1p, pi, pow, sin, sinh, sqrt, tan, tanh
 
 CLC_VERSION_MIN = {
 'acos' : 10,
@@ -43,6 +43,7 @@ CLC_VERSION_MIN = {
 'cos' : 10,
 'cosh' : 10,
 'cospi' : 10,
+'erf' : 10,
 'fabs' : 10,
 'floor' : 10,
 'fmod' : 10,
@@ -184,6 +185,15 @@ tests = {
 ],
 'tolerance' : 4
 },
+'erf' : {
+'arg_types' : [F, F],
+'function_type': 'ttt',
+'values' : [
+[0.0, 0.950004,0.990005,-0.994999475,  
0.27219439321703e-29, 1, -1], # Result
+[0.0, 1.960/sqrt(2.0), 2.576/sqrt(2.0), -2.807/sqrt(2.0), 11.1, 
float("inf"), float("-inf")]  # Arg0
+],
+'tolerance' : 16
+},
 'fabs' : {
 'arg_types' : [F, F],
 'function_type': 'ttt',
-- 
2.1.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/2] cl: Add erfc tests

2014-10-24 Thread Aaron Watry
Tested on Apple CL (10.9, CPU and GF9400m) to 1ULP.

Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-math-builtins.py | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index 2919768..7195d08 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -27,7 +27,7 @@ import os
 
 from genclbuiltins import gen, NEGNAN
 from math import acos, acosh, asin, asinh, atan, atan2, atanh, cos, cosh
-from math import erf, fabs, fmod, log1p, pi, pow, sin, sinh, sqrt, tan, tanh
+from math import erf, erfc, fabs, fmod, log1p, pi, pow, sin, sinh, sqrt, tan, 
tanh
 
 CLC_VERSION_MIN = {
 'acos' : 10,
@@ -44,6 +44,7 @@ CLC_VERSION_MIN = {
 'cosh' : 10,
 'cospi' : 10,
 'erf' : 10,
+'erfc' : 10,
 'fabs' : 10,
 'floor' : 10,
 'fmod' : 10,
@@ -194,6 +195,15 @@ tests = {
 ],
 'tolerance' : 16
 },
+'erfc' : {
+'arg_types' : [F, F],
+'function_type': 'ttt',
+'values' : [
+[1.0, 0.95, 0.009995, 1.994999, 0.0, 0.0, 2.0], # Result
+[0.0, 1.960/sqrt(2.0), 2.576/sqrt(2.0), -2.807/sqrt(2.0), 11.1, 
float("inf"), float("-inf")]  # Arg0
+],
+'tolerance' : 16
+},
 'fabs' : {
 'arg_types' : [F, F],
 'function_type': 'ttt',
-- 
2.1.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/9] cl: Add atomic_inc global tests

2014-10-17 Thread Aaron Watry
Tests both usage of return values and no usage in separate files.

Signed-off-by: Aaron Watry 
---
 .../builtin/atomic/atomic_inc-global-return.cl | 62 ++
 .../execute/builtin/atomic/atomic_inc-global.cl| 58 
 2 files changed, 120 insertions(+)
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_inc-global-return.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_inc-global.cl

diff --git 
a/tests/cl/program/execute/builtin/atomic/atomic_inc-global-return.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_inc-global-return.cl
new file mode 100644
index 000..e98e7f0
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_inc-global-return.cl
@@ -0,0 +1,62 @@
+/*!
+[config]
+name: atomic_inc global, with usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2] -4 -5
+arg_in:  0 buffer int[2] -5 0
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 1 0
+arg_in:  0 buffer uint[2] 0 0
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] -1 0  0 -1 2 1 3 2 4 3 5 4 6 5 7 6 8 7
+arg_in:  0 buffer int[18] -9 0 -1  0 1 0 2 0 3 0 4 0 5 0 6 0 7 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[18] 8 0 1 0 2 1 3 2 4 3 5 4 6 5 7 6 8 7
+arg_in:  0 buffer uint[18] 0 0 0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+  mem[1] = atomic_inc(mem); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE mul = mem[1]; \
+  TYPE id = get_global_id(0); \
+  TYPE ret = atomic_inc(mem); \
+  TYPE ret2 = atomic_inc(&mem[(id+1)*2]); \
+  mem[(id+1)*2+1] = ret2; \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_inc-global.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_inc-global.cl
new file mode 100644
index 000..e4b7315
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_inc-global.cl
@@ -0,0 +1,58 @@
+/*!
+[config]
+name: atomic_inc global, no usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[1] -4
+arg_in:  0 buffer int[1] -5
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[1] 1
+arg_in:  0 buffer uint[1] 0
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1]  0
+arg_in:  0 buffer int[1] -8
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 8
+arg_in:  0 buffer uint[1] 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+  atomic_inc(mem); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  atomic_inc(mem); \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
-- 
2.1.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 9/9] cl: Add more cospi/sinpi tests

2014-10-17 Thread Aaron Watry
Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-math-builtins.py | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index cc9b60b..f6f120d 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -179,8 +179,8 @@ tests = {
 'arg_types' : [F, F],
 'function_type': 'ttt',
 'values' : [
-[1.0, cos(pi*pi/2), cos(pi*3*pi/2), cos(2*pi*pi), 
cos(pi*1.12345)], # Result
-[0.0, pi / 2,   3 * pi / 2, 2 * pi,   1.12345] 
 # Arg0
+[1.0, cos(pi*pi/2), cos(pi*3*pi/2), cos(2*pi*pi), cos(pi*1.12345), 
cos(pi*pow(2,20)), cos(pi*pow(2,24)), cos(pi*pow(2,120)), float("nan")], # 
Result
+[0.0, pi / 2,   3 * pi / 2, 2 * pi,   1.12345, 
pow(2,20), pow(2,24), pow(2,120), float("nan")]  # Arg0
 ],
 'tolerance' : 4
 },
@@ -278,8 +278,12 @@ tests = {
 'arg_types' : [F, F],
 'function_type': 'ttt',
 'values' : [
-[0.0, 0.0, sin(pi*pi/2), sin(pi*3*pi/2), sin(2*pi*pi), 
sin(pi*1.12345)], # Result
-[0.0, 1.0, pi / 2,   3 * pi / 2, 2 * pi,   1.12345 
   ]  # Arg0
+[0.0, 0.0, sin(pi*pi/2), sin(pi*3*pi/2), sin(2*pi*pi),
+ sin(pi*1.12345), sin(pi*7), sin(pi*8), sin(pi*pow(2,20)),
+ sin(pi*pow(2,24)), sin(pi*pow(2,120)), float("nan")],#Result
+[0.0, 1.0, pi / 2,   3 * pi / 2, 2 * pi,
+ 1.12345, 7, 8, pow(2,20),
+ pow(2,24), pow(2,120), float("nan")] #Arg0
 ],
 'tolerance' : 4
 },
-- 
2.1.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 7/9] cl: Add atomic_or global tests

2014-10-17 Thread Aaron Watry
Tests both usage of and no usage of return value.

Signed-off-by: Aaron Watry 
---
 .../builtin/atomic/atomic_or-global-return.cl  | 64 ++
 .../execute/builtin/atomic/atomic_or-global.cl | 61 +
 2 files changed, 125 insertions(+)
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_or-global-return.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_or-global.cl

diff --git a/tests/cl/program/execute/builtin/atomic/atomic_or-global-return.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_or-global-return.cl
new file mode 100644
index 000..addaaad
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_or-global-return.cl
@@ -0,0 +1,64 @@
+/*!
+[config]
+name: atomic_or global, with usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2] -3 5
+arg_in:  0 buffer int[2]  5 0
+arg_in:  1int-4
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 14 6
+arg_in:  0 buffer uint[2]  6 0
+arg_in:  1uint10
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] 7 0 7 7 3 2 6 4 3 0 6 2 7 2 14 8 15 8
+arg_in:  0 buffer int[18] 0 0 7 0 2 0 4 0 0 0 2 0 2 0  8 0  8 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] 7 0 7 7 3 2 6 4 3 0 6 2 7 2 14 8 15 8
+arg_in:  0 buffer int[18] 0 0 7 0 2 0 4 0 0 0 2 0 2 0  8 0  8 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem, TYPE value) { \
+  mem[1] = atomic_or(mem, value); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE mul = mem[1]; \
+  TYPE id = get_global_id(0); \
+  TYPE ret = atomic_or(mem, id); \
+  TYPE ret2 = atomic_or(&mem[(id+1)*2], id+ret*mul); \
+  mem[(id+1)*2+1] = ret2; \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_or-global.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_or-global.cl
new file mode 100644
index 000..dce5760
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_or-global.cl
@@ -0,0 +1,61 @@
+/*!
+[config]
+name: atomic_or global, no usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[1] -3
+arg_in:  0 buffer int[1]  5
+arg_in:  1int-4
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[1] 14
+arg_in:  0 buffer uint[1]  6
+arg_in:  1uint10
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 7
+arg_in:  0 buffer int[1] 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 7
+arg_in:  0 buffer uint[1] 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem, TYPE value) { \
+  atomic_or(mem, value); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE id = get_global_id(0); \
+  atomic_or(mem, id); \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
-- 
2.1.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 4/9] cl: Add atomic_and global tests

2014-10-17 Thread Aaron Watry
Tests both usage of return and no usage of return variants.

Signed-off-by: Aaron Watry 
---
 .../builtin/atomic/atomic_and-global-return.cl | 64 ++
 .../execute/builtin/atomic/atomic_and-global.cl| 61 +
 2 files changed, 125 insertions(+)
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_and-global-return.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_and-global.cl

diff --git 
a/tests/cl/program/execute/builtin/atomic/atomic_and-global-return.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_and-global-return.cl
new file mode 100644
index 000..66388b7
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_and-global-return.cl
@@ -0,0 +1,64 @@
+/*!
+[config]
+name: atomic_and global, with usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2]  4 5
+arg_in:  0 buffer int[2]  5 0
+arg_in:  1int-4
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2]  2 6
+arg_in:  0 buffer uint[2]  6 0
+arg_in:  1uint10
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] 0 0 0 7 1 7 2 7 3 7 4 7 5 7 6 7 7 7
+arg_in:  0 buffer int[18] 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[18] 0 0 0 7 1 7 2 7 3 7 4 7 5 7 6 7 7 7
+arg_in:  0 buffer uint[18] 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem, TYPE value) { \
+  mem[1] = atomic_and(mem, value); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE mul = mem[1]; \
+  TYPE id = get_global_id(0); \
+  TYPE ret = atomic_and(mem, id); \
+  TYPE ret2 = atomic_and(&mem[(id+1)*2], id+ret*mul); \
+  mem[(id+1)*2+1] = ret2; \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_and-global.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_and-global.cl
new file mode 100644
index 000..dc0cb0d
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_and-global.cl
@@ -0,0 +1,61 @@
+/*!
+[config]
+name: atomic_and global, no usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[1]  4
+arg_in:  0 buffer int[1]  5
+arg_in:  1int-4
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[1]  2
+arg_in:  0 buffer uint[1]  6
+arg_in:  1uint10
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1]  0
+arg_in:  0 buffer int[1] -7
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 0
+arg_in:  0 buffer uint[1] 7
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem, TYPE value) { \
+  atomic_and(mem, value); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE id = get_global_id(0); \
+  atomic_and(mem, id); \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
-- 
2.1.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 3/9] cl: Add atomic_dec global tests

2014-10-17 Thread Aaron Watry
Tests both usage and non-usage of return value.

Signed-off-by: Aaron Watry 
---
 .../builtin/atomic/atomic_dec-global-return.cl | 62 ++
 .../execute/builtin/atomic/atomic_dec-global.cl| 58 
 2 files changed, 120 insertions(+)
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_dec-global-return.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_dec-global.cl

diff --git 
a/tests/cl/program/execute/builtin/atomic/atomic_dec-global-return.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_dec-global-return.cl
new file mode 100644
index 000..fc250b8
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_dec-global-return.cl
@@ -0,0 +1,62 @@
+/*!
+[config]
+name: atomic_dec global, with usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2] -5 -4
+arg_in:  0 buffer int[2] -4 0
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 1 2
+arg_in:  0 buffer uint[2] 2 0
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] -9 0 -1 0 1 2 2 3 3 4 4 5 5 6 6 7 7 8
+arg_in:  0 buffer int[18] -1 0  0 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[18] 0 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8
+arg_in:  0 buffer uint[18] 8 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+  mem[1] = atomic_dec(mem); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE mul = mem[1]; \
+  TYPE id = get_global_id(0); \
+  TYPE ret = atomic_dec(mem); \
+  TYPE ret2 = atomic_dec(&mem[(id+1)*2]); \
+  mem[(id+1)*2+1] = ret2; \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_dec-global.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_dec-global.cl
new file mode 100644
index 000..c0570d5
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_dec-global.cl
@@ -0,0 +1,58 @@
+/*!
+[config]
+name: atomic_dec global, no usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[1] -5
+arg_in:  0 buffer int[1] -4
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[1] 1
+arg_in:  0 buffer uint[1] 2
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] -8
+arg_in:  0 buffer int[1]  0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 1
+arg_in:  0 buffer uint[1] 9
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+  atomic_dec(mem); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  atomic_dec(mem); \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
-- 
2.1.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/9] cl: Add atomic_sub global tests

2014-10-17 Thread Aaron Watry
Tests both usage of return value and no-return-usage variants.

Signed-off-by: Aaron Watry 
---
 .../builtin/atomic/atomic_sub-global-return.cl | 62 ++
 .../execute/builtin/atomic/atomic_sub-global.cl| 59 
 2 files changed, 121 insertions(+)
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_sub-global-return.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_sub-global.cl

diff --git 
a/tests/cl/program/execute/builtin/atomic/atomic_sub-global-return.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_sub-global-return.cl
new file mode 100644
index 000..8d826be
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_sub-global-return.cl
@@ -0,0 +1,62 @@
+/*!
+[config]
+name: atomic_sub global, with usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2] -6 -4
+arg_in:  0 buffer int[2] -4 0
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 1 3
+arg_in:  0 buffer uint[2] 3 0
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] 0  0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8
+arg_in:  0 buffer int[18] 28 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[18] 0  0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8
+arg_in:  0 buffer uint[18] 28 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+  mem[1] = atomic_sub(mem, 2); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE mul = mem[1]; \
+  TYPE id = get_global_id(0); \
+  TYPE ret = atomic_sub(mem, id); \
+  TYPE ret2 = atomic_sub(&mem[(id+1)*2], id+ret*mul); \
+  mem[(id+1)*2+1] = ret2; \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_sub-global.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_sub-global.cl
new file mode 100644
index 000..a3dca39
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_sub-global.cl
@@ -0,0 +1,59 @@
+/*!
+[config]
+name: atomic_sub global, no usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[1] -6
+arg_in:  0 buffer int[1] -4
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[1] 1
+arg_in:  0 buffer uint[1] 3
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 0
+arg_in:  0 buffer int[1] 28
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 0
+arg_in:  0 buffer uint[1] 28
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+  atomic_sub(mem, 2); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE id = get_global_id(0); \
+  atomic_sub(mem, id); \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
-- 
2.1.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 5/9] cl: Add atomic_max global tests

2014-10-17 Thread Aaron Watry
Tests both usage of return and no usage of return.

Signed-off-by: Aaron Watry 
---
 .../builtin/atomic/atomic_max-global-return.cl | 62 ++
 .../execute/builtin/atomic/atomic_max-global.cl| 59 
 2 files changed, 121 insertions(+)
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_max-global-return.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_max-global.cl

diff --git 
a/tests/cl/program/execute/builtin/atomic/atomic_max-global-return.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_max-global-return.cl
new file mode 100644
index 000..ff82e89
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_max-global-return.cl
@@ -0,0 +1,62 @@
+/*!
+[config]
+name: atomic_max global, with usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2]  1 -5
+arg_in:  0 buffer int[2] -5  0
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 1 0
+arg_in:  0 buffer uint[2] 0 0
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] 7 0 1 1 1 0 2 1 3 2 4 3 5 4 6 5 7 6
+arg_in:  0 buffer int[18] 0 0 1 0 0 0 1 0 2 0 3 0 4 0 5 0 6 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[18] 7 0 1 1 1 0 2 1 3 2 4 3 5 4 6 5 7 6
+arg_in:  0 buffer uint[18] 0 0 1 0 0 0 1 0 2 0 3 0 4 0 5 0 6 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+  mem[1] = atomic_max(mem, 1); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE mul = mem[1]; \
+  TYPE id = get_global_id(0); \
+  TYPE ret = atomic_max(mem, id); \
+  TYPE ret2 = atomic_max(&mem[(id+1)*2], id+ret*mul); \
+  mem[(id+1)*2+1] = ret2; \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_max-global.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_max-global.cl
new file mode 100644
index 000..e9526ac
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_max-global.cl
@@ -0,0 +1,59 @@
+/*!
+[config]
+name: atomic_max global, no usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[1]  1
+arg_in:  0 buffer int[1] -5
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[1] 1
+arg_in:  0 buffer uint[1] 0
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 7
+arg_in:  0 buffer int[1] 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 7
+arg_in:  0 buffer uint[1] 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+  atomic_max(mem, 1); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE id = get_global_id(0); \
+  atomic_max(mem, id); \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
-- 
2.1.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 8/9] cl: Add atomix_xor global tests

2014-10-17 Thread Aaron Watry
Tests both usage and non-usage of return value.

Signed-off-by: Aaron Watry 
---
 .../builtin/atomic/atomic_xor-global-return.cl | 64 ++
 .../execute/builtin/atomic/atomic_xor-global.cl| 61 +
 2 files changed, 125 insertions(+)
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_xor-global-return.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_xor-global.cl

diff --git 
a/tests/cl/program/execute/builtin/atomic/atomic_xor-global-return.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_xor-global-return.cl
new file mode 100644
index 000..5121b91
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_xor-global-return.cl
@@ -0,0 +1,64 @@
+/*!
+[config]
+name: atomic_xor global, with usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2] -7 5
+arg_in:  0 buffer int[2]  5 0
+arg_in:  1int-4
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 12 6
+arg_in:  0 buffer uint[2]  6 0
+arg_in:  1uint10
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] 7 0 7 7 6 7 5 7 4 7 3 7 2 7 1 7 0 7
+arg_in:  0 buffer int[18] 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] 7 0 7 7 6 7 5 7 4 7 3 7 2 7 1 7 0 7
+arg_in:  0 buffer int[18] 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem, TYPE value) { \
+  mem[1] = atomic_xor(mem, value); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE mul = mem[1]; \
+  TYPE id = get_global_id(0); \
+  TYPE ret = atomic_xor(mem, id); \
+  TYPE ret2 = atomic_xor(&mem[(id+1)*2], id+ret*mul); \
+  mem[(id+1)*2+1] = ret2; \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_xor-global.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_xor-global.cl
new file mode 100644
index 000..3db9344
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_xor-global.cl
@@ -0,0 +1,61 @@
+/*!
+[config]
+name: atomic_xor global, no usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[1] -7
+arg_in:  0 buffer int[1]  5
+arg_in:  1int-4
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[1] 12
+arg_in:  0 buffer uint[1]  6
+arg_in:  1uint10
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] -7
+arg_in:  0 buffer int[1] -7
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 7
+arg_in:  0 buffer uint[1] 7
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem, TYPE value) { \
+  atomic_xor(mem, value); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE id = get_global_id(0); \
+  atomic_xor(mem, id); \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
-- 
2.1.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/1] cl: Add more sin/cos tests

2014-10-09 Thread Aaron Watry
On Wed, Oct 8, 2014 at 3:07 PM, Jan Vesely  wrote:
> On Wed, 2014-10-08 at 09:49 -0500, Aaron Watry wrote:
>> Reviewed-by: Aaron Watry 
>
> thanks.
> btw: do these pass on your system?

Nope, at least some of these fail on my system as well.  I haven't
tried running each individually, but at least some fail for me.

--Aaron

>
>>
>> Do you need someone to push this for you?
>
> yes pls. my access request bug is stale for some reason
>
> jan
>
>>
>> --Aaron
>>
>> On Fri, Oct 3, 2014 at 7:27 PM, Jan Vesely  wrote:
>> > Signed-off-by: Jan Vesely 
>> > ---
>> >
>> > the newly added values fail on my TURKS gpu.
>> > All tests still pass on Intel CPU.
>> >
>> >  generated_tests/generate-cl-math-builtins.py | 8 
>> >  1 file changed, 4 insertions(+), 4 deletions(-)
>> >
>> > diff --git a/generated_tests/generate-cl-math-builtins.py 
>> > b/generated_tests/generate-cl-math-builtins.py
>> > index fcdcc94..0551a89 100644
>> > --- a/generated_tests/generate-cl-math-builtins.py
>> > +++ b/generated_tests/generate-cl-math-builtins.py
>> > @@ -113,8 +113,8 @@ tests = {
>> >  'arg_types' : [F, F],
>> >  'function_type': 'ttt',
>> >  'values' : [
>> > -[1.0, 0.0,-1.0, 0.0,1.0,cos(1.12345), 
>> > -0.9258790228548379], # Result
>> > -[0.0, pi / 2, pi,   3 * pi / 2, 2 * pi, 1.12345, pow(2,120)] 
>> > # Arg0
>> > +[1.0, 0.0,-1.0, 0.0,1.0,cos(1.12345), cos(7), 
>> > cos(8), cos(pow(2,20)), cos(pow(2,24)), cos(pow(2,120)), float("nan")], # 
>> > Result
>> > +[0.0, pi / 2, pi,   3 * pi / 2, 2 * pi, 1.12345, 7, 8, 
>> > pow(2,20), pow(2,24), pow(2,120), float("nan")] # Arg0
>> >  ],
>> >  'tolerance' : 2
>> >  },
>> > @@ -185,8 +185,8 @@ tests = {
>> >  'arg_types' : [F, F],
>> >  'function_type': 'ttt',
>> >  'values' : [
>> > -[0.0, 1.0,   0.0, -1.0,   0.0,sin(2.234567)], # Result
>> > -[0.0, pi / 2, pi, 3 * pi / 2, 2 * pi, 2.234567] # Arg0
>> > +[0.0, 1.0,   0.0, -1.0,   0.0,sin(2.234567), sin(7), 
>> > sin(8), sin(pow(2,20)), sin(pow(2,24)), sin(pow(2,120)), float("nan")], # 
>> > Result
>> > +[0.0, pi / 2, pi, 3 * pi / 2, 2 * pi, 2.234567, 7, 8, 
>> > pow(2,20), pow(2,24), pow(2,120), float("nan")] # Arg0
>> >  ],
>> >  'tolerance': 2
>> >  },
>> > --
>> > 1.9.3
>> >
>
> --
> Jan Vesely 
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/1] cl: Add more sin/cos tests

2014-10-08 Thread Aaron Watry
Reviewed-by: Aaron Watry 

Do you need someone to push this for you?

--Aaron

On Fri, Oct 3, 2014 at 7:27 PM, Jan Vesely  wrote:
> Signed-off-by: Jan Vesely 
> ---
>
> the newly added values fail on my TURKS gpu.
> All tests still pass on Intel CPU.
>
>  generated_tests/generate-cl-math-builtins.py | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/generated_tests/generate-cl-math-builtins.py 
> b/generated_tests/generate-cl-math-builtins.py
> index fcdcc94..0551a89 100644
> --- a/generated_tests/generate-cl-math-builtins.py
> +++ b/generated_tests/generate-cl-math-builtins.py
> @@ -113,8 +113,8 @@ tests = {
>  'arg_types' : [F, F],
>  'function_type': 'ttt',
>  'values' : [
> -[1.0, 0.0,-1.0, 0.0,1.0,cos(1.12345), 
> -0.9258790228548379], # Result
> -[0.0, pi / 2, pi,   3 * pi / 2, 2 * pi, 1.12345, pow(2,120)] # 
> Arg0
> +[1.0, 0.0,-1.0, 0.0,1.0,cos(1.12345), cos(7), 
> cos(8), cos(pow(2,20)), cos(pow(2,24)), cos(pow(2,120)), float("nan")], # 
> Result
> +[0.0, pi / 2, pi,   3 * pi / 2, 2 * pi, 1.12345, 7, 8, 
> pow(2,20), pow(2,24), pow(2,120), float("nan")] # Arg0
>  ],
>  'tolerance' : 2
>  },
> @@ -185,8 +185,8 @@ tests = {
>  'arg_types' : [F, F],
>  'function_type': 'ttt',
>  'values' : [
> -[0.0, 1.0,   0.0, -1.0,   0.0,sin(2.234567)], # Result
> -[0.0, pi / 2, pi, 3 * pi / 2, 2 * pi, 2.234567] # Arg0
> +[0.0, 1.0,   0.0, -1.0,   0.0,sin(2.234567), sin(7), 
> sin(8), sin(pow(2,20)), sin(pow(2,24)), sin(pow(2,120)), float("nan")], # 
> Result
> +[0.0, pi / 2, pi, 3 * pi / 2, 2 * pi, 2.234567, 7, 8, pow(2,20), 
> pow(2,24), pow(2,120), float("nan")] # Arg0
>  ],
>  'tolerance': 2
>  },
> --
> 1.9.3
>
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/2] cl: Add cospi tests

2014-10-02 Thread Aaron Watry
On Wed, Oct 1, 2014 at 2:39 PM, Tom Stellard  wrote:
> On Mon, Sep 29, 2014 at 10:01:06AM -0500, Aaron Watry wrote:
>> v2: Remove stray ', pi' in Arg0 list
>>
> Reviewed-by: Tom Stellard 

Thanks, Tom.

Was this for this one patch, or have you had a change to look at the
rest of the series as well (v2 of cospi/sinpi, v1 of the 7 others)?

--Aaron

>> CC: Bruno Jiménez 
>> Signed-off-by: Aaron Watry 
>> ---
>>  generated_tests/generate-cl-math-builtins.py | 10 ++
>>  1 file changed, 10 insertions(+)
>>
>> diff --git a/generated_tests/generate-cl-math-builtins.py 
>> b/generated_tests/generate-cl-math-builtins.py
>> index 531106d..6677c1f 100644
>> --- a/generated_tests/generate-cl-math-builtins.py
>> +++ b/generated_tests/generate-cl-math-builtins.py
>> @@ -42,6 +42,7 @@ CLC_VERSION_MIN = {
>>  'copysign' : 10,
>>  'cos' : 10,
>>  'cosh' : 10,
>> +'cospi' : 10,
>>  'fabs' : 10,
>>  'floor' : 10,
>>  'fmod' : 10,
>> @@ -172,6 +173,15 @@ tests = {
>>  ],
>>  'tolerance' : 4
>>  },
>> +'cospi' : {
>> +'arg_types' : [F, F],
>> +'function_type': 'ttt',
>> +'values' : [
>> +[1.0, cos(pi*pi/2), cos(pi*3*pi/2), cos(2*pi*pi), 
>> cos(pi*1.12345)], # Result
>> +[0.0, pi / 2,   3 * pi / 2, 2 * pi,   1.12345   
>>  ]  # Arg0
>> +],
>> +'tolerance' : 4
>> +},
>>  'fabs' : {
>>  'arg_types' : [F, F],
>>  'function_type': 'ttt',
>> --
>> 1.9.1
>>
>> ___
>> Piglit mailing list
>> Piglit@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/2] cl: Add cospi tests

2014-09-29 Thread Aaron Watry
v2: Remove stray ', pi' in Arg0 list

CC: Bruno Jiménez 
Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-math-builtins.py | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index 531106d..6677c1f 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -42,6 +42,7 @@ CLC_VERSION_MIN = {
 'copysign' : 10,
 'cos' : 10,
 'cosh' : 10,
+'cospi' : 10,
 'fabs' : 10,
 'floor' : 10,
 'fmod' : 10,
@@ -172,6 +173,15 @@ tests = {
 ],
 'tolerance' : 4
 },
+'cospi' : {
+'arg_types' : [F, F],
+'function_type': 'ttt',
+'values' : [
+[1.0, cos(pi*pi/2), cos(pi*3*pi/2), cos(2*pi*pi), 
cos(pi*1.12345)], # Result
+[0.0, pi / 2,   3 * pi / 2, 2 * pi,   1.12345] 
 # Arg0
+],
+'tolerance' : 4
+},
 'fabs' : {
 'arg_types' : [F, F],
 'function_type': 'ttt',
-- 
1.9.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/2] cl: Add sinpi tests

2014-09-29 Thread Aaron Watry
v2: Remove stray ', pi' in Arg0 list

CC: Bruno Jiménez 
Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-math-builtins.py | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index 6677c1f..1642e05 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -52,6 +52,7 @@ CLC_VERSION_MIN = {
 'sign' : 10,
 'sin' : 10,
 'sinh' : 10,
+'sinpi' : 10,
 'tan' : 10,
 'tanh' : 10,
 'sqrt' : 10,
@@ -263,6 +264,15 @@ tests = {
 ],
 'tolerance': 4
 },
+'sinpi' : {
+'arg_types' : [F, F],
+'function_type': 'ttt',
+'values' : [
+[0.0, 0.0, sin(pi*pi/2), sin(pi*3*pi/2), sin(2*pi*pi), 
sin(pi*1.12345)], # Result
+[0.0, 1.0, pi / 2,   3 * pi / 2, 2 * pi,   1.12345 
   ]  # Arg0
+],
+'tolerance' : 4
+},
 'sqrt' : {
 'arg_types': [F, F],
 'function_type': 'ttt',
-- 
1.9.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 8/9] cl: Add cospi tests

2014-09-29 Thread Aaron Watry
Yup, looks like I messed that up.

I Could've sworn that I had run the generated tests for all of the
built-ins in this series, but that must not be the case.

I'll send a v2 of the last 2 tests.

--Aaron

On Sun, Sep 28, 2014 at 11:46 AM, Bruno Jimenez  wrote:
> On Thu, 2014-09-25 at 15:01 -0500, Aaron Watry wrote:
>> Signed-off-by: Aaron Watry 
>> ---
>>  generated_tests/generate-cl-math-builtins.py | 10 ++
>>  1 file changed, 10 insertions(+)
>>
>> diff --git a/generated_tests/generate-cl-math-builtins.py 
>> b/generated_tests/generate-cl-math-builtins.py
>> index 531106d..9f5d75c 100644
>> --- a/generated_tests/generate-cl-math-builtins.py
>> +++ b/generated_tests/generate-cl-math-builtins.py
>> @@ -42,6 +42,7 @@ CLC_VERSION_MIN = {
>>  'copysign' : 10,
>>  'cos' : 10,
>>  'cosh' : 10,
>> +'cospi' : 10,
>>  'fabs' : 10,
>>  'floor' : 10,
>>  'fmod' : 10,
>> @@ -172,6 +173,15 @@ tests = {
>>  ],
>>  'tolerance' : 4
>>  },
>> +'cospi' : {
>> +'arg_types' : [F, F],
>> +'function_type': 'ttt',
>> +'values' : [
>> +[1.0, cos(pi*pi/2), cos(pi*3*pi/2), cos(2*pi*pi), 
>> cos(pi*1.12345)], # Result
>> +[0.0, pi / 2, pi,   3 * pi / 2, 2 * pi,   1.12345   
>>  ]  # Arg0
>
> Hi,
>
> I think that you have a stray 'pi' here. (And in the following patch
> too)
>
> -Bruno
>
>> +],
>> +'tolerance' : 4
>> +},
>>  'fabs' : {
>>  'arg_types' : [F, F],
>>  'function_type': 'ttt',
>
>
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] cl: Add log1p tests

2014-09-26 Thread Aaron Watry
Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-math-builtins.py | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index dfc1d1d..48b4507 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -27,7 +27,7 @@ import os
 
 from genclbuiltins import gen, NEGNAN
 from math import acos, acosh, asin, asinh, atan, atan2, atanh, cos, cosh
-from math import fabs, fmod, pi, pow, sin, sinh, sqrt, tan, tanh
+from math import fabs, fmod, log1p, pi, pow, sin, sinh, sqrt, tan, tanh
 
 CLC_VERSION_MIN = {
 'acos' : 10,
@@ -46,6 +46,7 @@ CLC_VERSION_MIN = {
 'fabs' : 10,
 'floor' : 10,
 'fmod' : 10,
+'log1p' : 10,
 'mix' : 10,
 'nextafter' : 10,
 'round' : 10,
@@ -210,6 +211,15 @@ tests = {
 ],
 'tolerance' : 0
 },
+'log1p' : {
+'arg_types': [F, F],
+'function_type': 'ttt',
+'values': [
+[log1p(0.5), float("-inf"), log1p(1.e-15), float("nan")],
+[0.5,-1.0,  1.e-15,float("nan")]
+],
+'tolerance' : 2
+},
 'mix' : { #x + (y - x) * a
 'arg_types': [F, F, F, F],
 'function_type': 'tts',
-- 
2.1.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] cl/atomic: Fix duplicate names for threaded int/uint tests

2014-09-25 Thread Aaron Watry
Signed-off-by: Aaron Watry 
CC: Jan Vesely 
---
 tests/cl/program/execute/builtin/atomic/atomic_add-local.cl | 4 ++--
 tests/cl/program/execute/builtin/atomic/atomic_and-local.cl | 4 ++--
 tests/cl/program/execute/builtin/atomic/atomic_cmpxchg-local.cl | 4 ++--
 tests/cl/program/execute/builtin/atomic/atomic_dec-local.cl | 4 ++--
 tests/cl/program/execute/builtin/atomic/atomic_inc-local.cl | 4 ++--
 tests/cl/program/execute/builtin/atomic/atomic_max-local.cl | 4 ++--
 tests/cl/program/execute/builtin/atomic/atomic_min-local.cl | 4 ++--
 tests/cl/program/execute/builtin/atomic/atomic_or-local.cl  | 4 ++--
 tests/cl/program/execute/builtin/atomic/atomic_sub-local.cl | 4 ++--
 tests/cl/program/execute/builtin/atomic/atomic_xchg-local.cl| 4 ++--
 tests/cl/program/execute/builtin/atomic/atomic_xor-local.cl | 4 ++--
 11 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/tests/cl/program/execute/builtin/atomic/atomic_add-local.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_add-local.cl
index c155fbb..197b9e9 100644
--- a/tests/cl/program/execute/builtin/atomic/atomic_add-local.cl
+++ b/tests/cl/program/execute/builtin/atomic/atomic_add-local.cl
@@ -26,7 +26,7 @@ arg_in:  2 uint   4
 arg_in:  3 uint   5
 
 [test]
-name: threads
+name: threads int
 kernel_name: threads_int
 dimensions: 1
 global_size: 8 0 0
@@ -35,7 +35,7 @@ arg_out: 0 buffer int[1] 28
 arg_in:  1 buffer int[1] NULL
 
 [test]
-name: threads
+name: threads uint
 kernel_name: threads_uint
 dimensions: 1
 global_size: 8 0 0
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_and-local.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_and-local.cl
index dc5f835..ebde50e 100644
--- a/tests/cl/program/execute/builtin/atomic/atomic_and-local.cl
+++ b/tests/cl/program/execute/builtin/atomic/atomic_and-local.cl
@@ -26,7 +26,7 @@ arg_in:  2 uint   4
 arg_in:  3 uint   5
 
 [test]
-name: threads
+name: threads int
 kernel_name: threads_int
 dimensions: 1
 global_size: 8 0 0
@@ -35,7 +35,7 @@ arg_out: 0 buffer int[1] 0
 arg_in:  1 buffer int[1] NULL
 
 [test]
-name: threads
+name: threads uint
 kernel_name: threads_uint
 dimensions: 1
 global_size: 8 0 0
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_cmpxchg-local.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_cmpxchg-local.cl
index 4519b9f..2a98176 100644
--- a/tests/cl/program/execute/builtin/atomic/atomic_cmpxchg-local.cl
+++ b/tests/cl/program/execute/builtin/atomic/atomic_cmpxchg-local.cl
@@ -28,7 +28,7 @@ arg_in:  3 buffer uint[2] 4 3
 arg_in:  4 buffer uint[2] 5 5
 
 [test]
-name: threads
+name: threads int
 kernel_name: threads_int
 dimensions: 1
 global_size: 8 0 0
@@ -37,7 +37,7 @@ arg_out: 0 buffer int[1] 8
 arg_in:  1 buffer int[1] NULL
 
 [test]
-name: threads
+name: threads uint
 kernel_name: threads_uint
 dimensions: 1
 global_size: 8 0 0
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_dec-local.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_dec-local.cl
index aaa9885..900cec4 100644
--- a/tests/cl/program/execute/builtin/atomic/atomic_dec-local.cl
+++ b/tests/cl/program/execute/builtin/atomic/atomic_dec-local.cl
@@ -24,7 +24,7 @@ arg_in:  1 buffer uint[1] NULL
 arg_in:  2 uint   2
 
 [test]
-name: threads
+name: threads int
 kernel_name: threads_int
 dimensions: 1
 global_size: 8 0 0
@@ -33,7 +33,7 @@ arg_out: 0 buffer int[1] 8
 arg_in:  1 buffer int[1] NULL
 
 [test]
-name: threads
+name: threads uint
 kernel_name: threads_uint
 dimensions: 1
 global_size: 8 0 0
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_inc-local.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_inc-local.cl
index d51b4b7..4e4d0ca 100644
--- a/tests/cl/program/execute/builtin/atomic/atomic_inc-local.cl
+++ b/tests/cl/program/execute/builtin/atomic/atomic_inc-local.cl
@@ -24,7 +24,7 @@ arg_in:  1 buffer uint[1] NULL
 arg_in:  2 uint   2
 
 [test]
-name: threads
+name: threads int
 kernel_name: threads_int
 dimensions: 1
 global_size: 8 0 0
@@ -33,7 +33,7 @@ arg_out: 0 buffer int[1] 8
 arg_in:  1 buffer int[1] NULL
 
 [test]
-name: threads
+name: threads uint
 kernel_name: threads_uint
 dimensions: 1
 global_size: 8 0 0
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_max-local.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_max-local.cl
index 68b513f..89ee6c1 100644
--- a/tests/cl/program/execute/builtin/atomic/atomic_max-local.cl
+++ b/tests/cl/program/execute/builtin/atomic/atomic_max-local.cl
@@ -38,7 +38,7 @@ arg_in:  3 uint   0x
 
 
 [test]
-name: threads
+name: threads int
 kernel_name: threads_int
 dimensions: 1
 global_size: 8 0 0
@@ -47,7 +47,7 @@ arg_out: 0 buffer int[1] 7
 arg_in:  1 buffer int[1] NULL
 
 [test]
-name: threads
+name: threads uint
 kernel_name: threads_uint
 dimensions: 1
 global_size: 8 0 0
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_min-local.cl 
b/tests/cl/program/execute

Re: [Piglit] [PATCH 1/2] cl: Add atomic_max tests

2014-09-25 Thread Aaron Watry
On Thu, Sep 25, 2014 at 3:06 PM, Jan Vesely  wrote:
> On Tue, 2014-09-09 at 17:11 -0500, Aaron Watry wrote:
>> v2: Properly test signed/unsigned values
>>
>> Signed-off-by: Aaron Watry 
>> ---
>>  .../execute/builtin/atomic/atomic_max-local.cl | 81 
>> ++
>>  1 file changed, 81 insertions(+)
>>  create mode 100644 
>> tests/cl/program/execute/builtin/atomic/atomic_max-local.cl
>>
>> diff --git a/tests/cl/program/execute/builtin/atomic/atomic_max-local.cl 
>> b/tests/cl/program/execute/builtin/atomic/atomic_max-local.cl
>> new file mode 100644
>> index 000..68b513f
>> --- /dev/null
>> +++ b/tests/cl/program/execute/builtin/atomic/atomic_max-local.cl
>> @@ -0,0 +1,81 @@
>> +/*!
>> +[config]
>> +name: atomic_max local
>> +clc_version_min: 11
>> +
>> +[test]
>> +name: simple int
>> +kernel_name: simple_int
>> +dimensions: 1
>> +global_size: 1 0 0
>> +local_size: 1 0 0
>> +arg_out: 0 buffer int[2] -1 2
>> +arg_in:  1 buffer int[1] NULL
>> +arg_in:  2 int   -1
>> +arg_in:  3 int2
>> +
>> +[test]
>> +name: simple uint
>> +kernel_name: simple_uint
>> +dimensions: 1
>> +global_size: 1 0 0
>> +local_size:  1 0 0
>> +arg_out: 0 buffer uint[2] 2 3
>> +arg_in:  1 buffer uint[1] NULL
>> +arg_in:  2 uint   2
>> +arg_in:  3 uint   3
>> +
>> +[test]
>> +name: simple uint 2
>> +kernel_name: simple_uint
>> +dimensions: 1
>> +global_size: 1 0 0
>> +local_size:  1 0 0
>> +arg_out: 0 buffer uint[2] 3 4294967295
>> +arg_in:  1 buffer uint[1] NULL
>> +arg_in:  2 uint   3
>> +arg_in:  3 uint   0x
>> +
>> +
>> +[test]
>> +name: threads
>
> this name conflict with the name of the subtest below, same for the
> second patch.
>
> sorry for not noticing this earlier, only came to my attention after
> piglit started complaining.
>

Fair enough.  I'll change the names from 'threads' to 'threads
int'/uint to match the 'simple int/uint' tests

Sound good?

--Aaron

> jan
>
>> +kernel_name: threads_int
>> +dimensions: 1
>> +global_size: 8 0 0
>> +local_size:  8 0 0
>> +arg_out: 0 buffer int[1] 7
>> +arg_in:  1 buffer int[1] NULL
>> +
>> +[test]
>> +name: threads
>> +kernel_name: threads_uint
>> +dimensions: 1
>> +global_size: 8 0 0
>> +local_size:  8 0 0
>> +arg_out: 0 buffer uint[1] 7
>> +arg_in:  1 buffer uint[1] NULL
>> +
>> +!*/
>> +
>> +#define SIMPLE_TEST(TYPE) \
>> +kernel void simple_##TYPE(global TYPE *out, local TYPE *mem, TYPE initial, 
>> TYPE other) { \
>> + *mem = initial; \
>> + TYPE a = atomic_max(mem, other); \
>> + out[0] = a; \
>> + out[1] = *mem; \
>> +}
>> +
>> +#define THREADS_TEST(TYPE) \
>> +kernel void threads_##TYPE(global TYPE *out, local TYPE *mem) { \
>> + *mem = 0; \
>> + barrier(CLK_LOCAL_MEM_FENCE); \
>> + atomic_max(mem, get_global_id(0)); \
>> + barrier(CLK_LOCAL_MEM_FENCE); \
>> + *out = *mem; \
>> +}
>> +
>> +SIMPLE_TEST(int)
>> +SIMPLE_TEST(uint)
>> +
>> +THREADS_TEST(int)
>> +THREADS_TEST(uint)
>
>
> --
> Jan Vesely 
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 9/9] cl: Add sinpi tests

2014-09-25 Thread Aaron Watry
Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-math-builtins.py | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index 9f5d75c..dfc1d1d 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -52,6 +52,7 @@ CLC_VERSION_MIN = {
 'sign' : 10,
 'sin' : 10,
 'sinh' : 10,
+'sinpi' : 10,
 'tan' : 10,
 'tanh' : 10,
 'sqrt' : 10,
@@ -263,6 +264,15 @@ tests = {
 ],
 'tolerance': 4
 },
+'sinpi' : {
+'arg_types' : [F, F],
+'function_type': 'ttt',
+'values' : [
+[0.0, 0.0, sin(pi*pi/2), sin(pi*3*pi/2), sin(2*pi*pi), 
sin(pi*1.12345)], # Result
+[0.0, 1.0, pi / 2, pi,   3 * pi / 2, 2 * pi,   1.12345 
   ]  # Arg0
+],
+'tolerance' : 4
+},
 'sqrt' : {
 'arg_types': [F, F],
 'function_type': 'ttt',
-- 
2.0.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 4/9] cl: Add cbrt tests

2014-09-25 Thread Aaron Watry
Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-math-builtins.py | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index 5a1fa02..2d41837 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -37,6 +37,7 @@ CLC_VERSION_MIN = {
 'atan' : 10,
 'atan2' : 10,
 'atanh' : 10,
+'cbrt' : 10,
 'ceil' : 10,
 'copysign' : 10,
 'cos' : 10,
@@ -124,6 +125,15 @@ tests = {
 ],
 'tolerance' : 4
  },
+'cbrt' : {
+'arg_types': [F, F],
+'function_type': 'ttt',
+'values': [
+[3.0,  -1.0, float("nan"), float("inf"), 0.123456789**(1/3.0) ],
+[27.0, -1.0, float("nan"), float("inf"), 0.123456789 ]
+],
+'tolerance' : 2
+},
 'ceil' : {
 'arg_types': [F, F],
 'function_type': 'ttt',
-- 
2.0.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 3/9] cl: Add atanh tests

2014-09-25 Thread Aaron Watry
Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-math-builtins.py | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index 7d30766..5a1fa02 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -26,7 +26,7 @@
 import os
 
 from genclbuiltins import gen, NEGNAN
-from math import acos, acosh, asin, asinh, atan, atan2, cos
+from math import acos, acosh, asin, asinh, atan, atan2, atanh, cos
 from math import fabs, fmod, pi, pow, sin, sqrt, tan
 
 CLC_VERSION_MIN = {
@@ -36,6 +36,7 @@ CLC_VERSION_MIN = {
 'asinh' : 10,
 'atan' : 10,
 'atan2' : 10,
+'atanh' : 10,
 'ceil' : 10,
 'copysign' : 10,
 'cos' : 10,
@@ -114,6 +115,15 @@ tests = {
 ],
 'tolerance' : 6
  },
+'atanh' : {
+'arg_types' : [F, F],
+'function_type': 'ttt',
+'values' : [
+[0.0, float("inf"), float("-inf"), float("nan"), 
atanh(0.123456789)], #Result
+[0.0, 1.0,  -1.0,  float("nan"),   0.123456789 
]  #Arg0
+],
+'tolerance' : 4
+ },
 'ceil' : {
 'arg_types': [F, F],
 'function_type': 'ttt',
-- 
2.0.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/9] cl: Add asinh tests

2014-09-25 Thread Aaron Watry
Also re-organize math imports slightly

Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-math-builtins.py | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index 7f98d68..7d30766 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -26,13 +26,14 @@
 import os
 
 from genclbuiltins import gen, NEGNAN
-from math import acos, acosh, asin, atan, atan2, fmod, pi, sin, sqrt, cos, fabs
-from math import tan, pow
+from math import acos, acosh, asin, asinh, atan, atan2, cos
+from math import fabs, fmod, pi, pow, sin, sqrt, tan
 
 CLC_VERSION_MIN = {
 'acos' : 10,
 'acosh' : 10,
 'asin' : 10,
+'asinh' : 10,
 'atan' : 10,
 'atan2' : 10,
 'ceil' : 10,
@@ -85,6 +86,15 @@ tests = {
 ],
 'tolerance' : 4
  },
+'asinh' : {
+'arg_types' : [F, F],
+'function_type': 'ttt',
+'values' : [
+[0.0, asinh(1.0), asinh(-1.12345), float("nan"), 
asinh(123456789.01234)], #Result
+[0.0, 1.0,  -1.12345,  float("nan"),   
123456789.01234 ]  #Arg0
+],
+'tolerance' : 4
+ },
 'atan' : {
 'arg_types' : [F, F],
 'function_type': 'ttt',
-- 
2.0.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 6/9] cl: Add sinh tests

2014-09-25 Thread Aaron Watry
Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-math-builtins.py | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index ad43ffe..232f983 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -27,7 +27,7 @@ import os
 
 from genclbuiltins import gen, NEGNAN
 from math import acos, acosh, asin, asinh, atan, atan2, atanh, cos, cosh
-from math import fabs, fmod, pi, pow, sin, sqrt, tan
+from math import fabs, fmod, pi, pow, sin, sinh, sqrt, tan
 
 CLC_VERSION_MIN = {
 'acos' : 10,
@@ -50,6 +50,7 @@ CLC_VERSION_MIN = {
 'round' : 10,
 'sign' : 10,
 'sin' : 10,
+'sinh' : 10,
 'tan' : 10,
 'sqrt' : 10,
 'trunc' : 10
@@ -242,6 +243,15 @@ tests = {
 ],
 'tolerance': 2
 },
+'sinh' : {
+'arg_types' : [F, F],
+'function_type': 'ttt',
+'values' : [
+[0.0, sinh(0.123456789), float("inf"), float("-inf"), 
float("nan")],# Result
+[0.0, 0.123456789,   float("inf"), float("-inf"), 
float("nan")] # Arg0
+],
+'tolerance': 4
+},
 'sqrt' : {
 'arg_types': [F, F],
 'function_type': 'ttt',
-- 
2.0.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 5/9] cl: Add cosh tests

2014-09-25 Thread Aaron Watry
Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-math-builtins.py | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index 2d41837..ad43ffe 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -26,7 +26,7 @@
 import os
 
 from genclbuiltins import gen, NEGNAN
-from math import acos, acosh, asin, asinh, atan, atan2, atanh, cos
+from math import acos, acosh, asin, asinh, atan, atan2, atanh, cos, cosh
 from math import fabs, fmod, pi, pow, sin, sqrt, tan
 
 CLC_VERSION_MIN = {
@@ -41,6 +41,7 @@ CLC_VERSION_MIN = {
 'ceil' : 10,
 'copysign' : 10,
 'cos' : 10,
+'cosh' : 10,
 'fabs' : 10,
 'floor' : 10,
 'fmod' : 10,
@@ -160,6 +161,15 @@ tests = {
 ],
 'tolerance' : 2
 },
+'cosh' : {
+'arg_types' : [F, F],
+'function_type': 'ttt',
+'values' : [
+[1.0, cosh(0.123456789), float("inf"), float("inf"),  
float("nan")],# Result
+[0.0, 0.123456789,   float("inf"), float("-inf"), 
float("nan")] # Arg0
+],
+'tolerance' : 4
+},
 'fabs' : {
 'arg_types' : [F, F],
 'function_type': 'ttt',
-- 
2.0.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/9] cl: Add acosh tests

2014-09-25 Thread Aaron Watry
Also added myself to the file authors list

Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-math-builtins.py | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index fcdcc94..7f98d68 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -20,15 +20,18 @@
 # SOFTWARE.
 #
 # Authors: Tom Stellard 
+#  Aaron Watry  
 #
 
 import os
 
 from genclbuiltins import gen, NEGNAN
-from math import acos, asin, atan, atan2, fmod, pi, sin, sqrt, cos, fabs, tan, 
pow
+from math import acos, acosh, asin, atan, atan2, fmod, pi, sin, sqrt, cos, fabs
+from math import tan, pow
 
 CLC_VERSION_MIN = {
 'acos' : 10,
+'acosh' : 10,
 'asin' : 10,
 'atan' : 10,
 'atan2' : 10,
@@ -64,6 +67,15 @@ tests = {
 ],
 'tolerance' : 4
  },
+'acosh' : {
+'arg_types' : [F, F],
+'function_type': 'ttt',
+'values' : [
+[0.0, acosh(1.12345), float("nan"), acosh(123456789.01234)], 
#Result
+[1.0,   1.12345,  float("nan"),   123456789.01234 ]  #Arg0
+],
+'tolerance' : 4
+ },
 'asin' : {
 'arg_types' : [F, F],
 'function_type': 'ttt',
-- 
2.0.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 7/9] cl: Add tanh tests

2014-09-25 Thread Aaron Watry
Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-math-builtins.py | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index 232f983..531106d 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -27,7 +27,7 @@ import os
 
 from genclbuiltins import gen, NEGNAN
 from math import acos, acosh, asin, asinh, atan, atan2, atanh, cos, cosh
-from math import fabs, fmod, pi, pow, sin, sinh, sqrt, tan
+from math import fabs, fmod, pi, pow, sin, sinh, sqrt, tan, tanh
 
 CLC_VERSION_MIN = {
 'acos' : 10,
@@ -52,6 +52,7 @@ CLC_VERSION_MIN = {
 'sin' : 10,
 'sinh' : 10,
 'tan' : 10,
+'tanh' : 10,
 'sqrt' : 10,
 'trunc' : 10
 }
@@ -270,6 +271,15 @@ tests = {
 ],
 'tolerance': 5
 },
+'tanh' : {
+'arg_types' : [F, F],
+'function_type': 'ttt',
+'values' : [
+[0.0, tanh(0.123456789), tanh(15.123456789), 1.0,  -1.0
 , float("nan")],# Result
+[0.0, 0.123456789,   15.123456789,   float("inf"), 
float("-inf"), float("nan")] # Arg0
+],
+'tolerance': 5
+},
 'trunc' : {
 'arg_types': [F, F],
 'function_type': 'ttt',
-- 
2.0.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 8/9] cl: Add cospi tests

2014-09-25 Thread Aaron Watry
Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-math-builtins.py | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index 531106d..9f5d75c 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -42,6 +42,7 @@ CLC_VERSION_MIN = {
 'copysign' : 10,
 'cos' : 10,
 'cosh' : 10,
+'cospi' : 10,
 'fabs' : 10,
 'floor' : 10,
 'fmod' : 10,
@@ -172,6 +173,15 @@ tests = {
 ],
 'tolerance' : 4
 },
+'cospi' : {
+'arg_types' : [F, F],
+'function_type': 'ttt',
+'values' : [
+[1.0, cos(pi*pi/2), cos(pi*3*pi/2), cos(2*pi*pi), 
cos(pi*1.12345)], # Result
+[0.0, pi / 2, pi,   3 * pi / 2, 2 * pi,   1.12345] 
 # Arg0
+],
+'tolerance' : 4
+},
 'fabs' : {
 'arg_types' : [F, F],
 'function_type': 'ttt',
-- 
2.0.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] CL: Add atomic_add global tests

2014-09-23 Thread Aaron Watry
Adds two separate files, one which tests atomic_add without usage
of the return values, and another which tests with return usage.

At least the Radeon HD (EG/SI) line has two separate sets of instructions
depending on whether the return value is used or not.

v2: Only use return variant for atomic_add-global-return

Signed-off-by: Aaron Watry 
CC: Tom Stellard 
---
 .../builtin/atomic/atomic_add-global-return.cl | 62 ++
 .../execute/builtin/atomic/atomic_add-global.cl| 59 
 2 files changed, 121 insertions(+)
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_add-global-return.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_add-global.cl

diff --git 
a/tests/cl/program/execute/builtin/atomic/atomic_add-global-return.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_add-global-return.cl
new file mode 100644
index 000..e3abe6c
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_add-global-return.cl
@@ -0,0 +1,62 @@
+/*!
+[config]
+name: atomic_add global, with usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2] -4 -5
+arg_in:  0 buffer int[2] -5 0
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 1 0
+arg_in:  0 buffer uint[2] 0 0
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[18] 28 0 1 1 3 2 5 3 7 4 9 5 11 6 13 7 15 8
+arg_in:  0 buffer int[18] 0  0 1 0 2 0 3 0 4 0 5 0  6 0  7 0  8 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[18] 28 0 1 1 3 2 5 3 7 4 9 5 11 6 13 7 15 8
+arg_in:  0 buffer uint[18] 0  0 1 0 2 0 3 0 4 0 5 0  6 0  7 0  8 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+  mem[1] = atomic_add(mem, 1); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE mul = mem[1]; \
+  TYPE id = get_global_id(0); \
+  TYPE ret = atomic_add(mem, id); \
+  TYPE ret2 = atomic_add(&mem[(id+1)*2], id+ret*mul); \
+  mem[(id+1)*2+1] = ret2; \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_add-global.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_add-global.cl
new file mode 100644
index 000..bc1c311
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_add-global.cl
@@ -0,0 +1,59 @@
+/*!
+[config]
+name: atomic_add global, no usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[1] -4
+arg_in:  0 buffer int[1] -5
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[1] 1
+arg_in:  0 buffer uint[1] 0
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 28
+arg_in:  0 buffer int[1] 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 28
+arg_in:  0 buffer uint[1] 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+  atomic_add(mem, 1); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE id = get_global_id(0); \
+  atomic_add(mem, id); \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
-- 
2.1.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] CL: Add atomic_add global tests

2014-09-23 Thread Aaron Watry
Bah, Just after I sent this, I thought of something.  The threaded bit
is using both noret and ret variants.  I'm revising this to only use
the one type in a v2.

--Aaron

On Tue, Sep 23, 2014 at 8:39 AM, Aaron Watry  wrote:
> Adds two separate files, one which tests atomic_add without usage
> of the return values, and another which tests with return usage.
>
> At least the Radeon HD (EG/SI) line has two separate sets of instructions
> depending on whether the return value is used or not.
>
> Signed-off-by: Aaron Watry 
> CC: Tom Stellard 
> ---
>  .../builtin/atomic/atomic_add-global-return.cl | 61 
> ++
>  .../execute/builtin/atomic/atomic_add-global.cl| 59 +
>  2 files changed, 120 insertions(+)
>  create mode 100644 
> tests/cl/program/execute/builtin/atomic/atomic_add-global-return.cl
>  create mode 100644 
> tests/cl/program/execute/builtin/atomic/atomic_add-global.cl
>
> diff --git 
> a/tests/cl/program/execute/builtin/atomic/atomic_add-global-return.cl 
> b/tests/cl/program/execute/builtin/atomic/atomic_add-global-return.cl
> new file mode 100644
> index 000..dfa98f6
> --- /dev/null
> +++ b/tests/cl/program/execute/builtin/atomic/atomic_add-global-return.cl
> @@ -0,0 +1,61 @@
> +/*!
> +[config]
> +name: atomic_add global, with usage of return variable
> +clc_version_min: 11
> +
> +[test]
> +name: simple int
> +kernel_name: simple_int
> +dimensions: 1
> +global_size: 1 0 0
> +local_size:  1 0 0
> +arg_out: 0 buffer int[2] -4 -5
> +arg_in:  0 buffer int[2] -5 0
> +
> +[test]
> +name: simple uint
> +kernel_name: simple_uint
> +dimensions: 1
> +global_size: 1 0 0
> +local_size:  1 0 0
> +arg_out: 0 buffer uint[2] 1 0
> +arg_in:  0 buffer uint[2] 0 0
> +
> +[test]
> +name: threads int
> +kernel_name: threads_int
> +dimensions: 1
> +global_size: 8 0 0
> +local_size:  8 0 0
> +arg_out: 0 buffer int[17] 28 1 1 3 2 5 3 7 4 9 5 11 6 13 7 15 8
> +arg_in:  0 buffer int[17] 0  1 0 2 0 3 0 4 0 5 0  6 0  7 0  8 0
> +
> +[test]
> +name: threads uint
> +kernel_name: threads_uint
> +dimensions: 1
> +global_size: 8 0 0
> +local_size:  8 0 0
> +arg_out: 0 buffer uint[17] 28 1 1 3 2 5 3 7 4 9 5 11 6 13 7 15 8
> +arg_in:  0 buffer uint[17] 0  1 0 2 0 3 0 4 0 5 0  6 0  7 0  8 0
> +
> +!*/
> +
> +#define SIMPLE_TEST(TYPE) \
> +kernel void simple_##TYPE(global TYPE *mem) { \
> +  mem[1] = atomic_add(mem, 1); \
> +}
> +
> +#define THREADS_TEST(TYPE) \
> +kernel void threads_##TYPE(global TYPE *mem) { \
> +  TYPE id = get_global_id(0); \
> +  TYPE ret = atomic_add(mem, id); \
> +  TYPE ret2 = atomic_add(&mem[id*2+1], id+ret-ret); \
> +  mem[id*2+2] = ret2; \
> +}
> +
> +SIMPLE_TEST(int)
> +SIMPLE_TEST(uint)
> +
> +THREADS_TEST(int)
> +THREADS_TEST(uint)
> diff --git a/tests/cl/program/execute/builtin/atomic/atomic_add-global.cl 
> b/tests/cl/program/execute/builtin/atomic/atomic_add-global.cl
> new file mode 100644
> index 000..bc1c311
> --- /dev/null
> +++ b/tests/cl/program/execute/builtin/atomic/atomic_add-global.cl
> @@ -0,0 +1,59 @@
> +/*!
> +[config]
> +name: atomic_add global, no usage of return variable
> +clc_version_min: 11
> +
> +[test]
> +name: simple int
> +kernel_name: simple_int
> +dimensions: 1
> +global_size: 1 0 0
> +local_size:  1 0 0
> +arg_out: 0 buffer int[1] -4
> +arg_in:  0 buffer int[1] -5
> +
> +[test]
> +name: simple uint
> +kernel_name: simple_uint
> +dimensions: 1
> +global_size: 1 0 0
> +local_size:  1 0 0
> +arg_out: 0 buffer uint[1] 1
> +arg_in:  0 buffer uint[1] 0
> +
> +[test]
> +name: threads int
> +kernel_name: threads_int
> +dimensions: 1
> +global_size: 8 0 0
> +local_size:  8 0 0
> +arg_out: 0 buffer int[1] 28
> +arg_in:  0 buffer int[1] 0
> +
> +[test]
> +name: threads uint
> +kernel_name: threads_uint
> +dimensions: 1
> +global_size: 8 0 0
> +local_size:  8 0 0
> +arg_out: 0 buffer uint[1] 28
> +arg_in:  0 buffer uint[1] 0
> +
> +!*/
> +
> +#define SIMPLE_TEST(TYPE) \
> +kernel void simple_##TYPE(global TYPE *mem) { \
> +  atomic_add(mem, 1); \
> +}
> +
> +#define THREADS_TEST(TYPE) \
> +kernel void threads_##TYPE(global TYPE *mem) { \
> +  TYPE id = get_global_id(0); \
> +  atomic_add(mem, id); \
> +}
> +
> +SIMPLE_TEST(int)
> +SIMPLE_TEST(uint)
> +
> +THREADS_TEST(int)
> +THREADS_TEST(uint)
> --
> 2.1.0
>
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] CL: Add atomic_add global tests

2014-09-23 Thread Aaron Watry
Adds two separate files, one which tests atomic_add without usage
of the return values, and another which tests with return usage.

At least the Radeon HD (EG/SI) line has two separate sets of instructions
depending on whether the return value is used or not.

Signed-off-by: Aaron Watry 
CC: Tom Stellard 
---
 .../builtin/atomic/atomic_add-global-return.cl | 61 ++
 .../execute/builtin/atomic/atomic_add-global.cl| 59 +
 2 files changed, 120 insertions(+)
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_add-global-return.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_add-global.cl

diff --git 
a/tests/cl/program/execute/builtin/atomic/atomic_add-global-return.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_add-global-return.cl
new file mode 100644
index 000..dfa98f6
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_add-global-return.cl
@@ -0,0 +1,61 @@
+/*!
+[config]
+name: atomic_add global, with usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2] -4 -5
+arg_in:  0 buffer int[2] -5 0
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 1 0
+arg_in:  0 buffer uint[2] 0 0
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[17] 28 1 1 3 2 5 3 7 4 9 5 11 6 13 7 15 8
+arg_in:  0 buffer int[17] 0  1 0 2 0 3 0 4 0 5 0  6 0  7 0  8 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[17] 28 1 1 3 2 5 3 7 4 9 5 11 6 13 7 15 8
+arg_in:  0 buffer uint[17] 0  1 0 2 0 3 0 4 0 5 0  6 0  7 0  8 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+  mem[1] = atomic_add(mem, 1); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE id = get_global_id(0); \
+  TYPE ret = atomic_add(mem, id); \
+  TYPE ret2 = atomic_add(&mem[id*2+1], id+ret-ret); \
+  mem[id*2+2] = ret2; \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_add-global.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_add-global.cl
new file mode 100644
index 000..bc1c311
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_add-global.cl
@@ -0,0 +1,59 @@
+/*!
+[config]
+name: atomic_add global, no usage of return variable
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[1] -4
+arg_in:  0 buffer int[1] -5
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[1] 1
+arg_in:  0 buffer uint[1] 0
+
+[test]
+name: threads int
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 28
+arg_in:  0 buffer int[1] 0
+
+[test]
+name: threads uint
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 28
+arg_in:  0 buffer uint[1] 0
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *mem) { \
+  atomic_add(mem, 1); \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *mem) { \
+  TYPE id = get_global_id(0); \
+  atomic_add(mem, id); \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
-- 
2.1.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cl: Add tests for global atomc_add()

2014-09-22 Thread Aaron Watry

On Sep 19, 2014 1:23 PM, Tom Stellard  wrote:
>
> --- 
> .../builtin/atomic/atomic_add-global.program_test  | 46 ++ 
> .../execute/builtin/atomic/atomic_add-local.cl | 70 
> -- 
> .../builtin/atomic/atomic_add-local.program_test   | 46 ++ 
> .../program/execute/builtin/atomic/atomic_add.inc  | 23 +++ 
> 4 files changed, 115 insertions(+), 70 deletions(-) 
> create mode 100644 
> tests/cl/program/execute/builtin/atomic/atomic_add-global.program_test 
> delete mode 100644 
> tests/cl/program/execute/builtin/atomic/atomic_add-local.cl 
> create mode 100644 
> tests/cl/program/execute/builtin/atomic/atomic_add-local.program_test 
> create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_add.inc 
>
> diff --git 
> a/tests/cl/program/execute/builtin/atomic/atomic_add-global.program_test 
> b/tests/cl/program/execute/builtin/atomic/atomic_add-global.program_test 
> new file mode 100644 
> index 000..26c6752 
> --- /dev/null 
> +++ b/tests/cl/program/execute/builtin/atomic/atomic_add-global.program_test 
> @@ -0,0 +1,46 @@ 
> +[config] 
> +name: Scalar Data Type Load (int) 
> + 
> +program_source_file: atomic_add.inc 
> +build_options: -D ATOMIC_ADDRSPACE=global 
> +clc_version_min: 11 
> + 
> +[test] 
> +name: simple int 
> +kernel_name: simple_int 
> +dimensions: 1 
> +global_size: 1 0 0 
> +local_size:  1 0 0 
> +arg_out: 0 buffer int[2] -4 1 
> +arg_in:  1 buffer int[1] 0 
> +arg_in:  2 int   -4 
> +arg_in:  3 int   5 
> + 
> +[test] 
> +name: simple uint 
> +kernel_name: simple_uint 
> +dimensions: 1 
> +global_size: 1 0 0 
> +local_size:  1 0 0 
> +arg_out: 0 buffer uint[2] 4 9 
> +arg_in:  1 buffer uint[1] 0 
> +arg_in:  2 uint   4 
> +arg_in:  3 uint   5 
> + 
> +[test] 
> +name: threads 
> +kernel_name: threads_int 
> +dimensions: 1 
> +global_size: 8 0 0 
> +local_size:  8 0 0 
> +arg_out: 0 buffer int[1] 28 
> +arg_in:  1 buffer int[1] 0 
> + 
> +[test] 
> +name: threads 
> +kernel_name: threads_uint 
> +dimensions: 1 
> +global_size: 8 0 0 
> +local_size:  8 0 0 
> +arg_out: 0 buffer uint[1] 28 
> +arg_in:  1 buffer uint[1] 0 
> diff --git a/tests/cl/program/execute/builtin/atomic/atomic_add-local.cl 
> b/tests/cl/program/execute/builtin/atomic/atomic_add-local.cl 
> deleted file mode 100644 
> index c155fbb..000 
> --- a/tests/cl/program/execute/builtin/atomic/atomic_add-local.cl 
> +++ /dev/null 
> @@ -1,70 +0,0 @@ 
> -/*! 
> -[config] 
> -name: atomic_add local 
> -clc_version_min: 11 
> - 
> -[test] 
> -name: simple int 
> -kernel_name: simple_int 
> -dimensions: 1 
> -global_size: 1 0 0 
> -local_size:  1 0 0 
> -arg_out: 0 buffer int[2] -4 1 
> -arg_in:  1 buffer int[1] NULL 
> -arg_in:  2 int   -4 
> -arg_in:  3 int   5 
> - 
> -[test] 
> -name: simple uint 
> -kernel_name: simple_uint 
> -dimensions: 1 
> -global_size: 1 0 0 
> -local_size:  1 0 0 
> -arg_out: 0 buffer uint[2] 4 9 
> -arg_in:  1 buffer uint[1] NULL 
> -arg_in:  2 uint   4 
> -arg_in:  3 uint   5 
> - 
> -[test] 
> -name: threads 
> -kernel_name: threads_int 
> -dimensions: 1 
> -global_size: 8 0 0 
> -local_size:  8 0 0 
> -arg_out: 0 buffer int[1] 28 
> -arg_in:  1 buffer int[1] NULL 
> - 
> -[test] 
> -name: threads 
> -kernel_name: threads_uint 
> -dimensions: 1 
> -global_size: 8 0 0 
> -local_size:  8 0 0 
> -arg_out: 0 buffer uint[1] 28 
> -arg_in:  1 buffer uint[1] NULL 
> - 
> -!*/ 
> - 
> -#define SIMPLE_TEST(TYPE) \ 
> -kernel void simple_##TYPE(global TYPE *out, local TYPE *mem, TYPE initial, 
> TYPE value) { \ 
> - *mem = initial; \ 
> - TYPE a = atomic_add(mem, value); \ 
> - out[0] = a; \ 
> - out[1] = *mem; \ 
> -} 
> - 
> -#define THREADS_TEST(TYPE) \ 
> -kernel void threads_##TYPE(global TYPE *out, local TYPE *mem) { \ 
> - *mem = 0; \ 
> - barrier(CLK_LOCAL_MEM_FENCE); \

This can be done entirely without barriers or local memory.  I already have a 
version at home which I can send after I get back from a long weekend.

--Aaron

> - TYPE id = get_local_id(0); \ 
> - atomic_add(mem, id); \ 
> - barrier(CLK_LOCAL_MEM_FENCE); \ 
> - *out = *mem; \ 
> -} 
> - 
> -SIMPLE_TEST(int) 
> -SIMPLE_TEST(uint) 
> - 
> -THREADS_TEST(int) 
> -THREADS_TEST(uint) 
> diff --git 
> a/tests/cl/program/execute/builtin/atomic/atomic_add-local.program_test 
> b/tests/cl/program/execute/builtin/atomic/atomic_add-local.program_test 
> new file mode 100644 
> index 000..75479d1 
> --- /dev/null 
> +++ b/tests/cl/program/execute/builtin/atomic/atomic_add-local.program_test 
> @@ -0,0 +1,46 @@ 
> +[config] 
> +name: Scalar Data Type Load (int) 
> + 
> +program_source_file: atomic_add.inc 
> +build_options: -D ATOMIC_ADDRSPACE=local 
> +clc_version_min: 11 
> + 
> +[test] 
> +name: simple int 
> +kernel_name: simple_int 
> +dimensions: 1 
> +global_size: 1 0 0 
> +local_size:  1 0 0 
> +arg_out: 0 buffer int[2] -4 1 
> +arg_in:  1 buffer int[1] NULL 
> +arg_in:  2 int   -4 
> +arg_in:  3 int   

[Piglit] [PATCH] cl: Add popcount tests for CL 1.2

2014-09-19 Thread Aaron Watry
Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-int-builtins.py | 17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/generated_tests/generate-cl-int-builtins.py 
b/generated_tests/generate-cl-int-builtins.py
index 61fc93e..6a12171 100644
--- a/generated_tests/generate-cl-int-builtins.py
+++ b/generated_tests/generate-cl-int-builtins.py
@@ -46,6 +46,7 @@ CLC_VERSION_MIN = {
 'max': 11,  # max/min are only same-size in CL1.0, but TSS in CL1.1
 'min': 11,
 'mul_hi': 10,
+'popcount': 12,
 'rotate': 10,
 'sub_sat': 10,
 'upsample': 10,
@@ -103,10 +104,10 @@ def mul_hi(x, y, type):
 res = (x*y) >> DATA_SIZES[type]
 return res
 
-# def pop(val,type):
-# # TODO: Calculate number of non-zero bits in value (CLC 1.2)
-# return 0
-
+def pop(val, type):
+# Calculate number of non-zero bits in value
+width = DATA_SIZES[type]
+return bin(val & (2**width-1))[2:].zfill(width).count('1')
 
 def pow(val, pow):
 return val ** pow
@@ -257,6 +258,14 @@ generic_tests = {
 [0,  2,   1, MAX, MIN,  1,   2, MAX]
 ]
 },
+'popcount': {
+'arg_types': [T, T],
+'function_type': 'ttt',
+'values': [
+[0, 1, 1, 1,  2, [pop, MAX, TYPE], [pop, MIN, TYPE]],
+[0, 1, 2, 32, 3, MAX,  MIN ]
+]
+},
 'rhadd': {
 'arg_types': [T, T, T],
 'function_type': 'ttt',
-- 
1.9.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH v3 1/1] cl: Add copysign tests

2014-09-09 Thread Aaron Watry
I gave this a spin on libclc + evergreen/si and also checked against a
geforce 9400m in my macbook.  Tests pass on all 3 systems tested.

Reviewed-by: Aaron Watry 

On Tue, Sep 9, 2014 at 6:34 PM, Jan Vesely  wrote:
> v2: Fix -NaN test
> v3: Rebase
>
> Signed-off-by: Jan Vesely 
> ---
>  generated_tests/generate-cl-math-builtins.py | 12 +++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/generated_tests/generate-cl-math-builtins.py 
> b/generated_tests/generate-cl-math-builtins.py
> index 11105a5..fcdcc94 100644
> --- a/generated_tests/generate-cl-math-builtins.py
> +++ b/generated_tests/generate-cl-math-builtins.py
> @@ -24,7 +24,7 @@
>
>  import os
>
> -from genclbuiltins import gen
> +from genclbuiltins import gen, NEGNAN
>  from math import acos, asin, atan, atan2, fmod, pi, sin, sqrt, cos, fabs, 
> tan, pow
>
>  CLC_VERSION_MIN = {
> @@ -33,6 +33,7 @@ CLC_VERSION_MIN = {
>  'atan' : 10,
>  'atan2' : 10,
>  'ceil' : 10,
> +'copysign' : 10,
>  'cos' : 10,
>  'fabs' : 10,
>  'floor' : 10,
> @@ -99,6 +100,15 @@ tests = {
>  [0.5, -0.5, 0.0, -0.0, float("nan"), -3.99]
>  ]
>  },
> +'copysign' : {
> +'arg_types': [F, F, F],
> +'function_type': 'ttt',
> +'values': [
> +[0.0, -0.0, 1.0, -1.0, float("nan"), float("nan"), NEGNAN,   
> float("-inf"), float("inf") ], # Result
> +[0.0,  0.0, 1.0, -1.0, float("nan"), -4.0, float("nan"), 
> float("inf"),  float("-inf") ], # Arg0
> +[1.0, -1.0, 2.0, -2.0, float("nan"), float("nan"), -4.0, 
> -3.0,  float("inf") ], # Arg1
> +]
> +},
>  'cos' : {
>  'arg_types' : [F, F],
>  'function_type': 'ttt',
> --
> 1.9.3
>
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/2] cl: Add tests for additional atomic functions

2014-09-09 Thread Aaron Watry
Signed-off-by: Aaron Watry 
---
 .../execute/builtin/atomic/atomic_and-local.cl | 70 
 .../execute/builtin/atomic/atomic_cmpxchg-local.cl | 81 ++
 .../execute/builtin/atomic/atomic_min-local.cl | 81 ++
 .../execute/builtin/atomic/atomic_or-local.cl  | 70 
 .../execute/builtin/atomic/atomic_xchg-local.cl| 97 ++
 .../execute/builtin/atomic/atomic_xor-local.cl | 71 
 6 files changed, 470 insertions(+)
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_and-local.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_cmpxchg-local.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_min-local.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_or-local.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_xchg-local.cl
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_xor-local.cl

diff --git a/tests/cl/program/execute/builtin/atomic/atomic_and-local.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_and-local.cl
new file mode 100644
index 000..dc5f835
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_and-local.cl
@@ -0,0 +1,70 @@
+/*!
+[config]
+name: atomic_and local
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2] -4 4
+arg_in:  1 buffer int[1] NULL
+arg_in:  2 int   -4
+arg_in:  3 int   5
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 4 4
+arg_in:  1 buffer uint[1] NULL
+arg_in:  2 uint   4
+arg_in:  3 uint   5
+
+[test]
+name: threads
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 0
+arg_in:  1 buffer int[1] NULL
+
+[test]
+name: threads
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 0
+arg_in:  1 buffer uint[1] NULL
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *out, local TYPE *mem, TYPE initial, 
TYPE value) { \
+   *mem = initial; \
+   TYPE a = atomic_and(mem, value); \
+   out[0] = a; \
+   out[1] = *mem; \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *out, local TYPE *mem) { \
+   *mem = 7; \
+   barrier(CLK_LOCAL_MEM_FENCE); \
+   TYPE id = get_local_id(0); \
+   atomic_and(mem, id); \
+   barrier(CLK_LOCAL_MEM_FENCE); \
+   *out = *mem; \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_cmpxchg-local.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_cmpxchg-local.cl
new file mode 100644
index 000..4519b9f
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_cmpxchg-local.cl
@@ -0,0 +1,81 @@
+/*!
+[config]
+name: atomic_cmpxchg local
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[4] -4 5 -4 -4
+arg_in:  1 buffer int[2] NULL
+arg_in:  2 buffer int[2] -4 -4
+arg_in:  3 buffer int[2] -4 3
+arg_in:  4 buffer int[2]  5 5
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[4] 4 5 4 4
+arg_in:  1 buffer uint[2] NULL
+arg_in:  2 buffer uint[2] 4 4
+arg_in:  3 buffer uint[2] 4 3
+arg_in:  4 buffer uint[2] 5 5
+
+[test]
+name: threads
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 8
+arg_in:  1 buffer int[1] NULL
+
+[test]
+name: threads
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 8
+arg_in:  1 buffer uint[1] NULL
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *out, local TYPE *mem, global TYPE 
*initial, global TYPE *compare, global TYPE *value) { \
+   mem[0] = initial[0]; \
+   mem[1] = initial[1]; \
+   TYPE a = atomic_cmpxchg(mem, compare[0], value[0]); \
+   out[0] = a; \
+   out[1] = *mem; \
+   a = atomic_cmpxchg(mem+1, compare[1], value[1]); \
+   out[2] = a; \
+   out[3] = mem[1]; \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *out, local TYPE *mem) { \
+   int i; \
+   *mem = 0; \
+   barrier(CLK_LOCAL_MEM_FENCE); \
+   TYPE id = get_local_id(0); \
+   for(i = 0; i < get_local_size(0); i++){ \
+   if (i == id){ \
+   atomic_cmpxchg(mem, id, id+1); \
+   } \
+   barrier(CLK_LOCAL_MEM_FENCE); \
+   } \
+   *out = *mem; \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
diff --git a/tests

[Piglit] [PATCH 1/2] cl: Add atomic_max tests

2014-09-09 Thread Aaron Watry
v2: Properly test signed/unsigned values

Signed-off-by: Aaron Watry 
---
 .../execute/builtin/atomic/atomic_max-local.cl | 81 ++
 1 file changed, 81 insertions(+)
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_max-local.cl

diff --git a/tests/cl/program/execute/builtin/atomic/atomic_max-local.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_max-local.cl
new file mode 100644
index 000..68b513f
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_max-local.cl
@@ -0,0 +1,81 @@
+/*!
+[config]
+name: atomic_max local
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer int[2] -1 2
+arg_in:  1 buffer int[1] NULL
+arg_in:  2 int   -1
+arg_in:  3 int2
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 2 3
+arg_in:  1 buffer uint[1] NULL
+arg_in:  2 uint   2
+arg_in:  3 uint   3
+
+[test]
+name: simple uint 2
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 3 4294967295
+arg_in:  1 buffer uint[1] NULL
+arg_in:  2 uint   3
+arg_in:  3 uint   0x
+
+
+[test]
+name: threads
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 7
+arg_in:  1 buffer int[1] NULL
+
+[test]
+name: threads
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 7
+arg_in:  1 buffer uint[1] NULL
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *out, local TYPE *mem, TYPE initial, 
TYPE other) { \
+   *mem = initial; \
+   TYPE a = atomic_max(mem, other); \
+   out[0] = a; \
+   out[1] = *mem; \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *out, local TYPE *mem) { \
+   *mem = 0; \
+   barrier(CLK_LOCAL_MEM_FENCE); \
+   atomic_max(mem, get_global_id(0)); \
+   barrier(CLK_LOCAL_MEM_FENCE); \
+   *out = *mem; \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
-- 
1.9.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] cl: Add fmod tests

2014-09-08 Thread Aaron Watry
Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-math-builtins.py | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index 394207a..66ea755 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -25,7 +25,7 @@
 import os
 
 from genclbuiltins import gen
-from math import acos, asin, atan, atan2, pi, sin, sqrt, cos, fabs, tan, pow
+from math import acos, asin, atan, atan2, fmod, pi, sin, sqrt, cos, fabs, tan, 
pow
 
 CLC_VERSION_MIN = {
 'acos' : 10,
@@ -37,6 +37,7 @@ CLC_VERSION_MIN = {
 'cos' : 10,
 'fabs' : 10,
 'floor' : 10,
+'fmod' : 10,
 'mix' : 10,
 'nextafter' : 10,
 'round' : 10,
@@ -134,6 +135,16 @@ tests = {
 [0.5, -0.5, 0.0, -0.0, float("nan"), -3.99, 1.5]
 ]
 },
+'fmod' : {
+'arg_types': [F, F, F],
+'function_type': 'ttt',
+'values': [
+[float.fromhex("0x1.8p-4"),  float("nan"), 
float.fromhex("-0x1.47aep-7"),   1.0, float("-nan"), float("nan")],
+[float.fromhex("0x1.46p+2"), 0.0,  
float.fromhex("-0x1p+2"),1.0, 5.1,   3.0 ],
+[float.fromhex("0x1p-1"),float("nan"), 
float.fromhex("-0x1.feb852p+1"), 1.5, 0.0,   float("inf")]
+],
+'tolerance' : 0
+},
 'mix' : { #x + (y - x) * a
 'arg_types': [F, F, F, F],
 'function_type': 'tts',
-- 
1.9.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] cl: Add atomic_max local tests

2014-09-08 Thread Aaron Watry
Passes on radeonsi (Pitcairn), fails on r600g (CEDAR).

Signed-off-by: Aaron Watry 
---
 .../execute/builtin/atomic/atomic_max-local.cl | 69 ++
 1 file changed, 69 insertions(+)
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_max-local.cl

diff --git a/tests/cl/program/execute/builtin/atomic/atomic_max-local.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_max-local.cl
new file mode 100644
index 000..353b90e
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_max-local.cl
@@ -0,0 +1,69 @@
+/*!
+[config]
+name: atomic_max local
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size: 1 0 0
+arg_out: 0 buffer int[2] -2 -1
+arg_in:  1 buffer int[1] NULL
+arg_in:  2 int   -2
+arg_in:  3 int   -1
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 2 3
+arg_in:  1 buffer uint[1] NULL
+arg_in:  2 uint   2
+arg_in:  3 uint   3
+
+[test]
+name: threads
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 7
+arg_in:  1 buffer int[1] NULL
+
+[test]
+name: threads
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 7
+arg_in:  1 buffer uint[1] NULL
+
+!*/
+
+#define SIMPLE_TEST(TYPE) \
+kernel void simple_##TYPE(global TYPE *out, local TYPE *mem, TYPE initial, 
TYPE other) { \
+   *mem = initial; \
+   TYPE a = atomic_max(mem, other); \
+   out[0] = a; \
+   out[1] = *mem; \
+}
+
+#define THREADS_TEST(TYPE) \
+kernel void threads_##TYPE(global TYPE *out, local TYPE *mem) { \
+   *mem = 0; \
+   barrier(CLK_LOCAL_MEM_FENCE); \
+   atomic_max(mem, get_global_id(0)); \
+   barrier(CLK_LOCAL_MEM_FENCE); \
+   *out = *mem; \
+}
+
+SIMPLE_TEST(int)
+SIMPLE_TEST(uint)
+
+THREADS_TEST(int)
+THREADS_TEST(uint)
-- 
1.9.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/4] cl: Add asin tests

2014-09-04 Thread Aaron Watry
Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-math-builtins.py | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index 1c6add4..124acf6 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -25,10 +25,11 @@
 import os
 
 from genclbuiltins import gen
-from math import acos, atan, atan2, pi, sin, sqrt, cos
+from math import acos, asin, atan, atan2, pi, sin, sqrt, cos
 
 CLC_VERSION_MIN = {
 'acos' : 10,
+'asin' : 10,
 'atan' : 10,
 'atan2' : 10,
 'ceil' : 10,
@@ -60,6 +61,15 @@ tests = {
 ],
 'tolerance' : 4
  },
+'asin' : {
+'arg_types' : [F, F],
+'function_type': 'ttt',
+'values' : [
+[-pi/2, 0.0, pi/2, asin(0.12345), float("nan")], # Result
+[-1.0,  0.0,  1.0,  0.12345,  float("nan")]  # Arg0
+],
+'tolerance' : 4
+ },
 'atan' : {
 'arg_types' : [F, F],
 'function_type': 'ttt',
-- 
1.9.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 4/4] cl: Add tan tests

2014-09-04 Thread Aaron Watry
Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-math-builtins.py | 16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index 0677569..394207a 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -25,7 +25,7 @@
 import os
 
 from genclbuiltins import gen
-from math import acos, asin, atan, atan2, pi, sin, sqrt, cos, fabs
+from math import acos, asin, atan, atan2, pi, sin, sqrt, cos, fabs, tan, pow
 
 CLC_VERSION_MIN = {
 'acos' : 10,
@@ -42,6 +42,7 @@ CLC_VERSION_MIN = {
 'round' : 10,
 'sign' : 10,
 'sin' : 10,
+'tan' : 10,
 'sqrt' : 10,
 'trunc' : 10
 }
@@ -111,8 +112,8 @@ tests = {
 'arg_types' : [F, F],
 'function_type': 'ttt',
 'values' : [
-[1.0, 0.0,-1.0, 0.0,1.0,cos(1.12345)], # Result
-[0.0, pi / 2, pi,   3 * pi / 2, 2 * pi, 1.12345] # Arg0
+[1.0, 0.0,-1.0, 0.0,1.0,cos(1.12345), 
-0.9258790228548379], # Result
+[0.0, pi / 2, pi,   3 * pi / 2, 2 * pi, 1.12345, pow(2,120)] # Arg0
 ],
 'tolerance' : 2
 },
@@ -187,6 +188,15 @@ tests = {
 ],
 'tolerance': 3
 },
+'tan' : {
+'arg_types': [F, F],
+'function_type': 'ttt',
+'values': [
+[0.0, 1.0,  0.0, sqrt(3), -1.0,   tan(2.234567), float("nan") ], # 
Result
+[0.0, pi/4, pi,  pi/3,3*pi/4, 2.234567 , float("nan") ], # 
Arg1
+],
+'tolerance': 5
+},
 'trunc' : {
 'arg_types': [F, F],
 'function_type': 'ttt',
-- 
1.9.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 3/4] cl: Add fabs tests

2014-09-04 Thread Aaron Watry
Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-math-builtins.py | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index 124acf6..0677569 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -25,7 +25,7 @@
 import os
 
 from genclbuiltins import gen
-from math import acos, asin, atan, atan2, pi, sin, sqrt, cos
+from math import acos, asin, atan, atan2, pi, sin, sqrt, cos, fabs
 
 CLC_VERSION_MIN = {
 'acos' : 10,
@@ -35,6 +35,7 @@ CLC_VERSION_MIN = {
 'ceil' : 10,
 'copysign' : 10,
 'cos' : 10,
+'fabs' : 10,
 'floor' : 10,
 'mix' : 10,
 'nextafter' : 10,
@@ -115,6 +116,15 @@ tests = {
 ],
 'tolerance' : 2
 },
+'fabs' : {
+'arg_types' : [F, F],
+'function_type': 'ttt',
+'values' : [
+[0.0, pi/2,  pi,  0.0, float("inf"),  float("inf"), 1.12345 ], # 
Result
+[0.0, -pi/2, pi, -0.0, float("-inf"), float("inf"), -1.12345] # 
Arg0
+],
+'tolerance' : 0
+},
 'floor' : {
 'arg_types': [F, F],
 'function_type': 'ttt',
-- 
1.9.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/4] cl: Add atan2 tests

2014-09-04 Thread Aaron Watry
Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-math-builtins.py | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index 414e397..1c6add4 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -25,11 +25,12 @@
 import os
 
 from genclbuiltins import gen
-from math import acos, atan, pi, sin, sqrt, cos
+from math import acos, atan, atan2, pi, sin, sqrt, cos
 
 CLC_VERSION_MIN = {
 'acos' : 10,
 'atan' : 10,
+'atan2' : 10,
 'ceil' : 10,
 'copysign' : 10,
 'cos' : 10,
@@ -68,6 +69,16 @@ tests = {
 ],
 'tolerance' : 2
  },
+'atan2' : {
+'arg_types' : [F, F, F],
+'function_type': 'ttt',
+'values' : [
+[atan2(0.0, 0.0), atan2(1.2345, 10.0), atan2(35671470.0, 0.1)], # 
Result
+[0.0, 1.2345,  35671470.0], # 
Arg0
+[0.0, 10.0,0.1   ]  # 
Arg1
+],
+'tolerance' : 6
+ },
 'ceil' : {
 'arg_types': [F, F],
 'function_type': 'ttt',
-- 
1.9.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/1] cl: Add copysign tests

2014-09-02 Thread Aaron Watry
On Tue, Sep 2, 2014 at 4:58 PM, Jan Vesely  wrote:
> Signed-off-by: Jan Vesely 
> ---
>
> This patch applies on top of Aaron's series.
>
>  generated_tests/generate-cl-math-builtins.py | 10 ++
>  1 file changed, 10 insertions(+)
>
> diff --git a/generated_tests/generate-cl-math-builtins.py 
> b/generated_tests/generate-cl-math-builtins.py
> index a20f921..414e397 100644
> --- a/generated_tests/generate-cl-math-builtins.py
> +++ b/generated_tests/generate-cl-math-builtins.py
> @@ -31,6 +31,7 @@ CLC_VERSION_MIN = {
>  'acos' : 10,
>  'atan' : 10,
>  'ceil' : 10,
> +'copysign' : 10,
>  'cos' : 10,
>  'floor' : 10,
>  'mix' : 10,
> @@ -75,6 +76,15 @@ tests = {
>  [0.5, -0.5, 0.0, -0.0, float("nan"), -3.99]
>  ]
>  },
> +'copysign' : {
> +'arg_types': [F, F, F],
> +'function_type': 'ttt',
> +'values': [
> +[0.0, -0.0, 1.0, -1.0, float("nan"), float("-nan"), 
> float("nan"), float("-inf"), float("inf")  ], # Result
> +[0.0,  0.0, 1.0, -1.0, float("nan"), -4.0, float("-nan"), 
> float("inf"), float("-inf") ], # Arg0
> +[1.0, -1.0, 2.0, -2.0, float("nan"), float("nan"), 4.0, -3.0, 
> float("inf")  ], # Arg1

This has a slight quirk to it:
The 6th test in: copysign(-4.0, float("nan")) is expected to return
float("-nan") according to this, which would be seem to be
incorrect...  but due to python fun, float("-nan") is turned into
float("nan") in the generated test which passes because copysign(-4.0,
nan) == nan

Did you mean to test for: copysign(float("nan"), -4.0) == -NaN ?


If you want to use -nan in any of these tests, use NEGNAN from
genclbuiltins (you'll need to add an import for it) for the
input/return value instead. The test printer turns NEGNAN into the
string "-nan" for us instead of asking python for the value.

--Aaron

> +]
> +},
>  'cos' : {
>  'arg_types' : [F, F],
>  'function_type': 'ttt',
> --
> 1.9.3
>
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] CL: Silence uninitialized use warning in switch(main_argument_type)

2014-09-01 Thread Aaron Watry
Signed-off-by: Aaron Watry 
---
 tests/cl/program/program-tester.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/cl/program/program-tester.c 
b/tests/cl/program/program-tester.c
index 0e35826..4798e59 100644
--- a/tests/cl/program/program-tester.c
+++ b/tests/cl/program/program-tester.c
@@ -1546,6 +1546,7 @@ init(const int argc,
config_file = piglit_cl_get_arg_value(argc, argv, "config");
config_str = piglit_load_text_file(config_file, 
&config_str_size);
} else {
+   main_argument_type = ARG_BINARY;
fprintf(stderr, "Ops, this should not happen!\n");
exit_report_result(PIGLIT_WARN);
}
-- 
2.0.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/3] cl: Add floating point rounding tests

2014-08-29 Thread Aaron Watry
Adds tests for ceil, floor, round, trunc

Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-math-builtins.py | 38 +++-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index 9739f90..dfcad50 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -29,11 +29,15 @@ from math import atan, pi, sin, cos
 
 CLC_VERSION_MIN = {
 'atan' : 10,
+'ceil' : 10,
 'cos' : 10,
+'floor' : 10,
 'mix' : 10,
 'nextafter' : 10,
+'round' : 10,
 'sign' : 10,
-'sin' : 10
+'sin' : 10,
+'trunc' : 10
 }
 
 DATA_TYPES = ['float']
@@ -52,6 +56,14 @@ tests = {
 ],
 'tolerance' : 2
  },
+'ceil' : {
+'arg_types': [F, F],
+'function_type': 'ttt',
+'values': [
+[1.0,  0.0, 0.0, -0.0, float("nan"), -3.0],
+[0.5, -0.5, 0.0, -0.0, float("nan"), -3.99]
+]
+},
 'cos' : {
 'arg_types' : [F, F],
 'function_type': 'ttt',
@@ -61,6 +73,14 @@ tests = {
 ],
 'tolerance' : 2
 },
+'floor' : {
+'arg_types': [F, F],
+'function_type': 'ttt',
+'values': [
+[0.0, -1.0, 0.0, -0.0, float("nan"), -4.0,  1.0],
+[0.5, -0.5, 0.0, -0.0, float("nan"), -3.99, 1.5]
+]
+},
 'mix' : { #x + (y - x) * a
 'arg_types': [F, F, F, F],
 'function_type': 'tts',
@@ -80,6 +100,14 @@ tests = {
 [1.0,  -1.0 , 2.0, 0.0, 3.4, float("nan"), 5.0], # 
Arg1
 ]
 },
+'round' : {
+'arg_types': [F, F],
+'function_type': 'ttt',
+'values': [
+[1.0, -1.0, 0.0, -0.0, float("nan"), -4.0,  2.0, 0.0, 1.0],
+[0.5, -0.5, 0.0, -0.0, float("nan"), -3.99, 1.5, 0.4, 0.6]
+]
+},
 'sign' : { # This is really a Common function but it uses the same types
# as a lot of the math functions.
 'arg_types': [F, F],
@@ -97,6 +125,14 @@ tests = {
 [0.0, pi / 2, pi, 3 * pi / 2, 2 * pi, 2.234567] # Arg0
 ],
 'tolerance': 2
+},
+'trunc' : {
+'arg_types': [F, F],
+'function_type': 'ttt',
+'values': [
+[0.0, -0.0, 0.0, -0.0, float("nan"), -3.0,  1.0],
+[0.5, -0.5, 0.0, -0.0, float("nan"), -3.99, 1.5]
+]
 }
 }
 
-- 
1.9.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 3/3] cl: Add acos tests

2014-08-29 Thread Aaron Watry
Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-math-builtins.py | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index 11882d4..a20f921 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -25,9 +25,10 @@
 import os
 
 from genclbuiltins import gen
-from math import atan, pi, sin, sqrt, cos
+from math import acos, atan, pi, sin, sqrt, cos
 
 CLC_VERSION_MIN = {
+'acos' : 10,
 'atan' : 10,
 'ceil' : 10,
 'cos' : 10,
@@ -48,6 +49,15 @@ F = {
 }
 
 tests = {
+'acos' : {
+'arg_types' : [F, F],
+'function_type': 'ttt',
+'values' : [
+[ pi,  pi/2, 0.0, acos(0.12345), float("nan")], # Result
+[-1.0, 0.0,  1.0,  0.12345,  float("nan")]  # Arg0
+],
+'tolerance' : 4
+ },
 'atan' : {
 'arg_types' : [F, F],
 'function_type': 'ttt',
-- 
1.9.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/3] cl: Add sqrt tests

2014-08-29 Thread Aaron Watry
Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-math-builtins.py | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index dfcad50..11882d4 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -25,7 +25,7 @@
 import os
 
 from genclbuiltins import gen
-from math import atan, pi, sin, cos
+from math import atan, pi, sin, sqrt, cos
 
 CLC_VERSION_MIN = {
 'atan' : 10,
@@ -37,6 +37,7 @@ CLC_VERSION_MIN = {
 'round' : 10,
 'sign' : 10,
 'sin' : 10,
+'sqrt' : 10,
 'trunc' : 10
 }
 
@@ -126,6 +127,15 @@ tests = {
 ],
 'tolerance': 2
 },
+'sqrt' : {
+'arg_types': [F, F],
+'function_type': 'ttt',
+'values': [
+[1.0, 2.0,  6.0, 2.5 , float("nan"), 4.0,  sqrt(0.0), sqrt(7.0), 
sqrt(pi)], # Result
+[1.0, 4.0, 36.0, 6.25, float("nan"), 16.0, 0.0, 7.0, pi], # Arg1
+],
+'tolerance': 3
+},
 'trunc' : {
 'arg_types': [F, F],
 'function_type': 'ttt',
-- 
1.9.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] cl: Add floating point rounding tests

2014-08-26 Thread Aaron Watry
Adds tests for ceil, floor, round, trunc

Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-math-builtins.py | 38 +++-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index 9739f90..dfcad50 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -29,11 +29,15 @@ from math import atan, pi, sin, cos
 
 CLC_VERSION_MIN = {
 'atan' : 10,
+'ceil' : 10,
 'cos' : 10,
+'floor' : 10,
 'mix' : 10,
 'nextafter' : 10,
+'round' : 10,
 'sign' : 10,
-'sin' : 10
+'sin' : 10,
+'trunc' : 10
 }
 
 DATA_TYPES = ['float']
@@ -52,6 +56,14 @@ tests = {
 ],
 'tolerance' : 2
  },
+'ceil' : {
+'arg_types': [F, F],
+'function_type': 'ttt',
+'values': [
+[1.0,  0.0, 0.0, -0.0, float("nan"), -3.0],
+[0.5, -0.5, 0.0, -0.0, float("nan"), -3.99]
+]
+},
 'cos' : {
 'arg_types' : [F, F],
 'function_type': 'ttt',
@@ -61,6 +73,14 @@ tests = {
 ],
 'tolerance' : 2
 },
+'floor' : {
+'arg_types': [F, F],
+'function_type': 'ttt',
+'values': [
+[0.0, -1.0, 0.0, -0.0, float("nan"), -4.0,  1.0],
+[0.5, -0.5, 0.0, -0.0, float("nan"), -3.99, 1.5]
+]
+},
 'mix' : { #x + (y - x) * a
 'arg_types': [F, F, F, F],
 'function_type': 'tts',
@@ -80,6 +100,14 @@ tests = {
 [1.0,  -1.0 , 2.0, 0.0, 3.4, float("nan"), 5.0], # 
Arg1
 ]
 },
+'round' : {
+'arg_types': [F, F],
+'function_type': 'ttt',
+'values': [
+[1.0, -1.0, 0.0, -0.0, float("nan"), -4.0,  2.0, 0.0, 1.0],
+[0.5, -0.5, 0.0, -0.0, float("nan"), -3.99, 1.5, 0.4, 0.6]
+]
+},
 'sign' : { # This is really a Common function but it uses the same types
# as a lot of the math functions.
 'arg_types': [F, F],
@@ -97,6 +125,14 @@ tests = {
 [0.0, pi / 2, pi, 3 * pi / 2, 2 * pi, 2.234567] # Arg0
 ],
 'tolerance': 2
+},
+'trunc' : {
+'arg_types': [F, F],
+'function_type': 'ttt',
+'values': [
+[0.0, -0.0, 0.0, -0.0, float("nan"), -3.0,  1.0],
+[0.5, -0.5, 0.0, -0.0, float("nan"), -3.99, 1.5]
+]
 }
 }
 
-- 
1.9.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] glsl-1.10/glsl-1.20: Rename tests to make case-insensitive filesystems work

2014-07-16 Thread Aaron Watry
MacOS, and likely Windows, doesn't like the fact that we have 2 files
each with the following names when the filesystem is case insensitive:
glsl-1.10/compiler/literals/invalid-float-suffix-f.vert
glsl-1.10/compiler/literals/valid-float-exponent-E.vert
glsl-1.20/compiler/literals/valid-float-suffix-F.vert

Symptoms...
1) Working tree only contains 1 file for each name.
2) Unable to pull/rebase/push any commits because git thinks there's outstanding
   changes.

Signed-off-by: Aaron Watry 
---
 .../glsl-1.10/compiler/literals/invalid-float-suffix-F.vert| 10 --
 .../compiler/literals/invalid-float-suffix-capital-f.vert  | 10 ++
 .../glsl-1.10/compiler/literals/valid-float-exponent-E.vert|  9 -
 .../compiler/literals/valid-float-exponent-capital-e.vert  |  9 +
 .../spec/glsl-1.20/compiler/literals/valid-float-suffix-F.vert |  9 -
 .../compiler/literals/valid-float-suffix-capital-f.vert|  9 +
 6 files changed, 28 insertions(+), 28 deletions(-)
 delete mode 100644 
tests/spec/glsl-1.10/compiler/literals/invalid-float-suffix-F.vert
 create mode 100644 
tests/spec/glsl-1.10/compiler/literals/invalid-float-suffix-capital-f.vert
 delete mode 100644 
tests/spec/glsl-1.10/compiler/literals/valid-float-exponent-E.vert
 create mode 100644 
tests/spec/glsl-1.10/compiler/literals/valid-float-exponent-capital-e.vert
 delete mode 100644 
tests/spec/glsl-1.20/compiler/literals/valid-float-suffix-F.vert
 create mode 100644 
tests/spec/glsl-1.20/compiler/literals/valid-float-suffix-capital-f.vert

diff --git a/tests/spec/glsl-1.10/compiler/literals/invalid-float-suffix-F.vert 
b/tests/spec/glsl-1.10/compiler/literals/invalid-float-suffix-F.vert
deleted file mode 100644
index 2022cdb..000
--- a/tests/spec/glsl-1.10/compiler/literals/invalid-float-suffix-F.vert
+++ /dev/null
@@ -1,10 +0,0 @@
-// [config]
-// expect_result: fail
-// glsl_version: 1.10
-// [end config]
-
-void main() {
-   // Float-suffixes are not in GLSL 1.10
-   float f = 1.0F;
-   gl_Position = vec4(1.0);
-}
diff --git 
a/tests/spec/glsl-1.10/compiler/literals/invalid-float-suffix-capital-f.vert 
b/tests/spec/glsl-1.10/compiler/literals/invalid-float-suffix-capital-f.vert
new file mode 100644
index 000..2022cdb
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/literals/invalid-float-suffix-capital-f.vert
@@ -0,0 +1,10 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+
+void main() {
+   // Float-suffixes are not in GLSL 1.10
+   float f = 1.0F;
+   gl_Position = vec4(1.0);
+}
diff --git a/tests/spec/glsl-1.10/compiler/literals/valid-float-exponent-E.vert 
b/tests/spec/glsl-1.10/compiler/literals/valid-float-exponent-E.vert
deleted file mode 100644
index 7678e8e..000
--- a/tests/spec/glsl-1.10/compiler/literals/valid-float-exponent-E.vert
+++ /dev/null
@@ -1,9 +0,0 @@
-// [config]
-// expect_result: pass
-// glsl_version: 1.10
-// [end config]
-
-void main() {
-   vec4 f = vec4(1E5, -1E5, 1E-5, -1E-5);
-   gl_Position = vec4(1.0);
-}
diff --git 
a/tests/spec/glsl-1.10/compiler/literals/valid-float-exponent-capital-e.vert 
b/tests/spec/glsl-1.10/compiler/literals/valid-float-exponent-capital-e.vert
new file mode 100644
index 000..7678e8e
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/literals/valid-float-exponent-capital-e.vert
@@ -0,0 +1,9 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.10
+// [end config]
+
+void main() {
+   vec4 f = vec4(1E5, -1E5, 1E-5, -1E-5);
+   gl_Position = vec4(1.0);
+}
diff --git a/tests/spec/glsl-1.20/compiler/literals/valid-float-suffix-F.vert 
b/tests/spec/glsl-1.20/compiler/literals/valid-float-suffix-F.vert
deleted file mode 100644
index 1173e3e..000
--- a/tests/spec/glsl-1.20/compiler/literals/valid-float-suffix-F.vert
+++ /dev/null
@@ -1,9 +0,0 @@
-// [config]
-// expect_result: pass
-// glsl_version: 1.20
-// [end config]
-
-void main() {
-   float f = 1.0F;
-   gl_Position = vec4(1.0);
-}
diff --git 
a/tests/spec/glsl-1.20/compiler/literals/valid-float-suffix-capital-f.vert 
b/tests/spec/glsl-1.20/compiler/literals/valid-float-suffix-capital-f.vert
new file mode 100644
index 000..1173e3e
--- /dev/null
+++ b/tests/spec/glsl-1.20/compiler/literals/valid-float-suffix-capital-f.vert
@@ -0,0 +1,9 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.20
+// [end config]
+
+void main() {
+   float f = 1.0F;
+   gl_Position = vec4(1.0);
+}
-- 
2.0.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 6/9] cl/relational: Add isinf tests

2014-07-11 Thread Aaron Watry
Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-relational-builtins.py | 9 +
 1 file changed, 9 insertions(+)

diff --git a/generated_tests/generate-cl-relational-builtins.py 
b/generated_tests/generate-cl-relational-builtins.py
index bf598e3..9d47d72 100644
--- a/generated_tests/generate-cl-relational-builtins.py
+++ b/generated_tests/generate-cl-relational-builtins.py
@@ -33,6 +33,7 @@ CLC_VERSION_MIN = {
 'isfinite' : 10,
 'isgreater' : 10,
 'isgreaterequal' : 10,
+'isinf' : 10,
 'isless' : 10,
 'islessequal' : 10,
 'islessgreater' : 10,
@@ -94,6 +95,14 @@ tests = {
 [0.0,  float("nan"), 1.0,  float("nan"), 1,
float("inf"), 0.5,  1.0 ]  # Arg1
 ]
 },
+'isinf' : {
+'arg_types': [I, F],
+'function_type': 'ttt',
+'values': [
+[0,   0,0,   0,TRUE, TRUE,  0 ],   
   # Result
+[0.0, float("nan"), 1.0, 1.0,  float("inf"), float("-inf"), -123.0 
], # Arg0
+]
+},
 'isless' : {
 'arg_types': [I, F, F],
 'function_type': 'ttt',
-- 
1.9.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/9] cl/relational: Add islessequal tests

2014-07-11 Thread Aaron Watry
Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-relational-builtins.py | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/generated_tests/generate-cl-relational-builtins.py 
b/generated_tests/generate-cl-relational-builtins.py
index bc98aaa..e4e8f0c 100644
--- a/generated_tests/generate-cl-relational-builtins.py
+++ b/generated_tests/generate-cl-relational-builtins.py
@@ -33,6 +33,7 @@ CLC_VERSION_MIN = {
 'isgreater' : 10,
 'isgreaterequal' : 10,
 'isless' : 10,
+'islessequal' : 10,
 'isnotequal' : 10,
 'signbit' : 10
 }
@@ -92,6 +93,15 @@ tests = {
 [0.0, float("nan"), 1.0, float("nan"), 1.0,  1.0,  
0.5,  1.0 ]  # Arg1
 ]
 },
+'islessequal' : {
+'arg_types': [I, F, F],
+'function_type': 'ttt',
+'values': [
+[TRUE, 0,   TRUE, 0,0,0,   
   0,  TRUE], # Result
+[0.0,  float("nan"), 1.0, 1.0,  float("nan"), 
float("inf"), 1.0,  0.5 ], # Arg0
+[0.0,  float("nan"), 1.0, float("nan"), 1.0,  1.0, 
 0.5,  1.0 ]  # Arg1
+]
+},
 'isnotequal' : {
 'arg_types': [I, F, F],
 'function_type': 'ttt',
-- 
1.9.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 3/9] cl/relational: Add islessgreater tests

2014-07-11 Thread Aaron Watry
Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-relational-builtins.py | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/generated_tests/generate-cl-relational-builtins.py 
b/generated_tests/generate-cl-relational-builtins.py
index e4e8f0c..1c3a88e 100644
--- a/generated_tests/generate-cl-relational-builtins.py
+++ b/generated_tests/generate-cl-relational-builtins.py
@@ -34,6 +34,7 @@ CLC_VERSION_MIN = {
 'isgreaterequal' : 10,
 'isless' : 10,
 'islessequal' : 10,
+'islessgreater' : 10,
 'isnotequal' : 10,
 'signbit' : 10
 }
@@ -102,6 +103,15 @@ tests = {
 [0.0,  float("nan"), 1.0, float("nan"), 1.0,  1.0, 
 0.5,  1.0 ]  # Arg1
 ]
 },
+'islessgreater' : {
+'arg_types': [I, F, F],
+'function_type': 'ttt',
+'values': [
+[0,   0,  0, 0,0,TRUE,
TRUE,  TRUE], # Result
+[0.0, float("nan"), 1.0, 1.0,  float("nan"), float("inf"), 
1.0,  0.5 ], # Arg0
+[0.0, float("nan"), 1.0, float("nan"), 1.0,  1.0,  
0.5,  1.0 ]  # Arg1
+]
+},
 'isnotequal' : {
 'arg_types': [I, F, F],
 'function_type': 'ttt',
-- 
1.9.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 4/9] cl/relational: Add isfinite tests

2014-07-11 Thread Aaron Watry
Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-relational-builtins.py | 9 +
 1 file changed, 9 insertions(+)

diff --git a/generated_tests/generate-cl-relational-builtins.py 
b/generated_tests/generate-cl-relational-builtins.py
index 1c3a88e..de1db76 100644
--- a/generated_tests/generate-cl-relational-builtins.py
+++ b/generated_tests/generate-cl-relational-builtins.py
@@ -30,6 +30,7 @@ from genclbuiltins import gen, TRUE, NEGNAN
 CLC_VERSION_MIN = {
 'isnan' : 10,
 'isequal' : 10,
+'isfinite' : 10,
 'isgreater' : 10,
 'isgreaterequal' : 10,
 'isless' : 10,
@@ -67,6 +68,14 @@ tests = {
 [0.0,  float("nan"), 1.0,  float("nan"), 1,
float("inf"), 0.5,  123.0 ]  # Arg1
 ]
 },
+'isfinite' : {
+'arg_types': [I, F],
+'function_type': 'ttt',
+'values': [
+[TRUE, 0,TRUE, TRUE, 0,0, TRUE 
],# Result
+[0.0,  float("nan"), 1.0,  1.0,  float("inf"), float("-inf"), 
-123.0 ], # Arg0
+]
+},
 'isgreater' : {
 'arg_types': [I, F, F],
 'function_type': 'ttt',
-- 
1.9.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 7/9] cl/relational: Add isnormal tests

2014-07-11 Thread Aaron Watry
I believe that this is right, but the documentation is pretty sparse.

Tests pass on OSX 10.9 on my GF9400m with Apple's runtime.

Signed-off-by: Aaron Watry 
---
 generated_tests/generate-cl-relational-builtins.py | 9 +
 1 file changed, 9 insertions(+)

diff --git a/generated_tests/generate-cl-relational-builtins.py 
b/generated_tests/generate-cl-relational-builtins.py
index 9d47d72..3991764 100644
--- a/generated_tests/generate-cl-relational-builtins.py
+++ b/generated_tests/generate-cl-relational-builtins.py
@@ -37,6 +37,7 @@ CLC_VERSION_MIN = {
 'isless' : 10,
 'islessequal' : 10,
 'islessgreater' : 10,
+'isnormal' : 10,
 'isnotequal' : 10,
 'signbit' : 10
 }
@@ -130,6 +131,14 @@ tests = {
 [0.0, float("nan"), 1.0, float("nan"), 1.0,  1.0,  
0.5,  1.0 ]  # Arg1
 ]
 },
+   'isnormal' : {
+'arg_types': [I, F],
+'function_type': 'ttt',
+'values': [
+[0,   0,TRUE, TRUE, 0,0, TRUE, 
  0],  # Result
+[0.0, float("nan"), 1.0,  1.0,  float("inf"), float("-inf"), 
-123.0, 1e-126], # Arg0
+]
+},
 'isnotequal' : {
 'arg_types': [I, F, F],
 'function_type': 'ttt',
-- 
1.9.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


  1   2   3   >