[Piglit] [PATCH 1/2] travis: Schedule cmake build job first

2019-08-18 Thread Jan Vesely
This way it can overlap the other jobs better.
Signed-off-by: Jan Vesely 
---
 .travis.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index 3043cd4cad7..b20a200c97d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -17,6 +17,7 @@ env:
 
 matrix:
   include:
+- env: BUILD=cmake
 - python: 2.7
   env: TOX_ENV="py27-{generator,noaccel,accel-nix,streams}"
 - python: 3.4
@@ -27,7 +28,6 @@ matrix:
   env: TOX_ENV="py36-{generator,noaccel,accel-nix,streams}"
 - python: 3.7
   env: TOX_ENV="py37-{generator,noaccel,accel-nix,streams}"
-- env: BUILD=cmake
 
 install:
   - |
-- 
2.21.0

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

[Piglit] [PATCH 2/2] travis: Drop python3.4

2019-08-18 Thread Jan Vesely
Python 3.4 was EOLed in March 2019
Signed-off-by: Jan Vesely 
---
 .travis.yml | 2 --
 1 file changed, 2 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index b20a200c97d..f0faa0c394f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -20,8 +20,6 @@ matrix:
 - env: BUILD=cmake
 - python: 2.7
   env: TOX_ENV="py27-{generator,noaccel,accel-nix,streams}"
-- python: 3.4
-  env: TOX_ENV="py34-{generator,noaccel,accel-nix,streams}"
 - python: 3.5
   env: TOX_ENV="py35-{generator,noaccel,accel-nix,streams}"
 - python: 3.6
-- 
2.21.0

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

Re: [Piglit] [PATCH] framework/cl: Don't override timeout setting from cmdline

2019-06-28 Thread Jan Vesely
On Fri, Jun 28, 2019 at 7:46 PM Dylan Baker  wrote:
>
> Quoting Jan Vesely (2019-06-28 13:01:36)
> > From: Jan Vesely 
> >
> > Signed-off-by: Jan Vesely 
> > ---
> >  framework/test/piglit_test.py | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/framework/test/piglit_test.py b/framework/test/piglit_test.py
> > index b4e6eb444e0..0881f00a6d6 100644
> > --- a/framework/test/piglit_test.py
> > +++ b/framework/test/piglit_test.py
> > @@ -215,7 +215,8 @@ class PiglitCLTest(PiglitBaseTest):  # pylint: 
> > disable=too-few-public-methods
> >
> >  """
> >  def __init__(self, command, run_concurrent=CL_CONCURRENT, **kwargs):
> > -self.timeout = 60
> > +if self.timeout is None:
> > +self.timeout = 60
>
> Sorry I wont have time to look closer at this till Monday. I think if you put
> the timeout at the class level it will just work. At least, that's how I seem 
> to
> remember designing it to work, but it's been a while.

There's time, the current limit should be enough for most users.
I tried setting a class timeout attribute in PigliTCLTest, but it didn't work.
iiuc, the cmdline value updates the parent class timeout (base.Test.timeout)
However, when accessing self.timeout the child value
(PiglitCLTest.timeout) is used and takes precedence, thus always
overriding the cmline value.

Jan

>
> Dylan
>
> >  super(PiglitCLTest, self).__init__(command, run_concurrent, 
> > **kwargs)
> >
> >
> > --
> > 2.21.0
> >
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit

Re: [Piglit] [PATCH] cl: Add tests for some cases that were broken with function calls

2019-06-28 Thread Jan Vesely
On Fri, Jun 21, 2019 at 4:12 PM Matt Arsenault  wrote:
>
>
>
> On Jun 20, 2019, at 2:38 PM, Jan Vesely  wrote:
>
> sorry, I'm running against deadlines and traveling this week.
> Does the timeout patch work as expected in failure path?
>
>
> It seems to not work. I’m able to manually interrupt it still, but the 
> timeout never triggers

Can you check running:
python3 ./piglit run tests/cl.py -t clobbers results/foo
?

Other than that, LGTM.

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

[Piglit] [PATCH] framework/cl: Don't override timeout setting from cmdline

2019-06-28 Thread Jan Vesely
From: Jan Vesely 

Signed-off-by: Jan Vesely 
---
 framework/test/piglit_test.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/framework/test/piglit_test.py b/framework/test/piglit_test.py
index b4e6eb444e0..0881f00a6d6 100644
--- a/framework/test/piglit_test.py
+++ b/framework/test/piglit_test.py
@@ -215,7 +215,8 @@ class PiglitCLTest(PiglitBaseTest):  # pylint: 
disable=too-few-public-methods
 
 """
 def __init__(self, command, run_concurrent=CL_CONCURRENT, **kwargs):
-self.timeout = 60
+if self.timeout is None:
+self.timeout = 60
 super(PiglitCLTest, self).__init__(command, run_concurrent, **kwargs)
 
 
-- 
2.21.0

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

Re: [Piglit] [PATCH] framework/test: Add default 1min timeout to all OpenCL tests

2019-06-22 Thread Jan Vesely
On Wed, Jun 5, 2019 at 11:47 PM Jan Vesely  wrote:
>
> From: Jan Vesely 
>
> Signed-off-by: Jan Vesely 
> ---
>  framework/test/piglit_test.py | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/framework/test/piglit_test.py b/framework/test/piglit_test.py
> index 166c2f792ca..b4e6eb444e0 100644
> --- a/framework/test/piglit_test.py
> +++ b/framework/test/piglit_test.py
> @@ -215,6 +215,7 @@ class PiglitCLTest(PiglitBaseTest):  # pylint: 
> disable=too-few-public-methods
>
>  """
>  def __init__(self, command, run_concurrent=CL_CONCURRENT, **kwargs):
> +self.timeout = 60
>  super(PiglitCLTest, self).__init__(command, run_concurrent, **kwargs)
>

ping (+fix Dylan's email)

Jan

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

Re: [Piglit] [PATCH] cl: Add tests for some cases that were broken with function calls

2019-06-21 Thread Jan Vesely
On Fri, Jun 21, 2019 at 4:12 PM Matt Arsenault  wrote:
>
>
>
> On Jun 20, 2019, at 2:38 PM, Jan Vesely  wrote:
>
> sorry, I'm running against deadlines and traveling this week.
> Does the timeout patch work as expected in failure path?
>
>
> It seems to not work. I’m able to manually interrupt it still, but the 
> timeout never triggers

are you using python2 or python3 to run piglit?
does the timeout work when you run with --timeout option?

Jan

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

Re: [Piglit] [PATCH] cl: Add tests for some cases that were broken with function calls

2019-06-20 Thread Jan Vesely
On Tue, Jun 18, 2019 at 12:36 PM Matt Arsenault  wrote:
>
>
>
> > On Jun 5, 2019, at 10:05 PM, Jan Vesely  wrote:
> >
> > On Wed, 2019-06-05 at 17:48 -0400, Matt Arsenault wrote:
> >>> On Jun 3, 2019, at 12:46 PM, Jan Vesely  wrote:
> >>>
> >>> Does rocm do anything special other than using compute rings?
> >>> What was the HW you tested?
> >> I don’t think so. This is on gfx900
> >>
> >>
> >>> I checked that raven can reboot after gpu hangs/crashes (not suspend,
> >>> but that's probably one of many raven problems). I'd like to check
> >>> carrizo/iceland too, as that's the machine that get accessed remotely.
> >>>
> >>> Other than that I think it's OK to just put default 30s timeout on all
> >>> CL tests, even debug build of LLVM shouldn't need more than that.
> >>
> >> Do you know where this goes?
> >
> > The test base class has a timeout attribute, and the invocation uses
> > self.timoute. I think just adding self.timeout = 30 to PiglitCLTest
> > constructor should suffice, adding a timeout attribute to the
> > PiglitCLTest class might work as well.
> >
> > Dylan, is there a preferred way to do this? will the commandline --
> > timeout take precedence?
> >
> > Jan
> >
> > --
> > Jan Vesely 
>
> ping

sorry, I'm running against deadlines and traveling this week.
Does the timeout patch work as expected in failure path?

Jan

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

[Piglit] [PATCH] framework/test: Add default 1min timeout to all OpenCL tests

2019-06-05 Thread Jan Vesely
From: Jan Vesely 

Signed-off-by: Jan Vesely 
---
 framework/test/piglit_test.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/framework/test/piglit_test.py b/framework/test/piglit_test.py
index 166c2f792ca..b4e6eb444e0 100644
--- a/framework/test/piglit_test.py
+++ b/framework/test/piglit_test.py
@@ -215,6 +215,7 @@ class PiglitCLTest(PiglitBaseTest):  # pylint: 
disable=too-few-public-methods
 
 """
 def __init__(self, command, run_concurrent=CL_CONCURRENT, **kwargs):
+self.timeout = 60
 super(PiglitCLTest, self).__init__(command, run_concurrent, **kwargs)
 
 
-- 
2.21.0

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

Re: [Piglit] [PATCH] cl: Add tests for some cases that were broken with function calls

2019-06-05 Thread Jan Vesely
On Wed, 2019-06-05 at 17:48 -0400, Matt Arsenault wrote:
> > On Jun 3, 2019, at 12:46 PM, Jan Vesely  wrote:
> > 
> > Does rocm do anything special other than using compute rings?
> > What was the HW you tested?
> I don’t think so. This is on gfx900
> 
> 
> > I checked that raven can reboot after gpu hangs/crashes (not suspend,
> > but that's probably one of many raven problems). I'd like to check
> > carrizo/iceland too, as that's the machine that get accessed remotely.
> > 
> > Other than that I think it's OK to just put default 30s timeout on all
> > CL tests, even debug build of LLVM shouldn't need more than that.
> 
> Do you know where this goes?

The test base class has a timeout attribute, and the invocation uses
self.timoute. I think just adding self.timeout = 30 to PiglitCLTest
constructor should suffice, adding a timeout attribute to the
PiglitCLTest class might work as well.

Dylan, is there a preferred way to do this? will the commandline --
timeout take precedence?

Jan

-- 
Jan Vesely 


signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit

Re: [Piglit] [PATCH] cl: Add tests for some cases that were broken with function calls

2019-06-03 Thread Jan Vesely
On Mon, 2019-06-03 at 10:31 -0400, Matt Arsenault wrote:
> > On Jun 2, 2019, at 2:36 PM, Jan Vesely  wrote:
> > 
> > he other problem is that even with killed process hung GPU usually
> > makes the machine unable to suspend or reboot on its own, which kills
> > remote testing.
> > I'd need to recheck if that's still the case with linux-5.1.
> 
> I was able to interrupt the process normally and everything worked
> OK with rocm (which due to the device name regex, its the only
> platform this runs) without my fix applied.

Does rocm do anything special other than using compute rings?
What was the HW you tested?
I checked that raven can reboot after gpu hangs/crashes (not suspend,
but that's probably one of many raven problems). I'd like to check
carrizo/iceland too, as that's the machine that get accessed remotely.

Other than that I think it's OK to just put default 30s timeout on all
CL tests, even debug build of LLVM shouldn't need more than that.

Jan

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

-- 
Jan Vesely 


signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit

Re: [Piglit] [PATCH] cl: Add tests for some cases that were broken with function calls

2019-06-02 Thread Jan Vesely
On Sun, 2019-06-02 at 09:49 -0400, Matt Arsenault wrote:
> > On Jun 1, 2019, at 10:57 PM, Jan Vesely  wrote:
> > 
> > On Thu, 2019-05-30 at 08:40 -0400, Matt Arsenault wrote:
> > > Ping
> > > 
> > > > On May 23, 2019, at 7:59 PM, arse...@gmail.com wrote:
> > > > 
> > > > From: Matt Arsenault 
> > > > 
> > > > ---
> > > > .../program/execute/call-clobbers-amdgcn.cl   | 102 ++
> > > > 1 file changed, 102 insertions(+)
> > > > 
> > > > diff --git a/tests/cl/program/execute/call-clobbers-amdgcn.cl 
> > > > b/tests/cl/program/execute/call-clobbers-amdgcn.cl
> > > > index 18e657ce3..b0a1f8c70 100644
> > > > --- a/tests/cl/program/execute/call-clobbers-amdgcn.cl
> > > > +++ b/tests/cl/program/execute/call-clobbers-amdgcn.cl
> > > > @@ -19,6 +19,49 @@ dimensions: 1
> > > > global_size: 1 0 0
> > > > arg_out: 0 buffer int[1] 0xabcd1234
> > > > 
> > > > +[test]
> > > > +name: Conditional call
> > > > +kernel_name: conditional_call
> > > > +dimensions: 1
> > > > +local_size: 64 0 0
> > > > +global_size: 64 0 0
> > > > +arg_out: 0 buffer int[64] \
> > > > +  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 
> > > > 0xabcd1234 0xabcd1234 \
> > > > +  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 
> > > > 0xabcd1234 0xabcd1234 \
> > > > +  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 
> > > > 0xabcd1234 0xabcd1234 \
> > > > +  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 
> > > > 0xabcd1234 0xabcd1234 \
> > > > +  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 
> > > > 0xabcd1234 0xabcd1234 \
> > > > +  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 
> > > > 0xabcd1234 0xabcd1234 \
> > > > +  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 
> > > > 0xabcd1234 0xabcd1234 \
> > > > +  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 
> > > > 0xabcd1234 0xabcd1234
> > > > +
> > > > +[test]
> > > > +name: Conditional call partial dispatch
> > > > +kernel_name: conditional_call
> > > > +dimensions: 1
> > > > +local_size: 16 0 0
> > > > +global_size: 16 0 0
> > > > +arg_out: 0 buffer int[16] \
> > > > +  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 
> > > > 0xabcd1234 0xabcd1234 \
> > > > +  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 
> > > > 0xabcd1234 0xabcd1234
> > > > +
> > > > +
> > > > +[test]
> > > > +name: Skip call no lanes
> > > > +kernel_name: skip_call_no_lanes
> > > > +dimensions: 1
> > > > +local_size: 64 0 0
> > > > +global_size: 64 0 0
> > > > +arg_out: 0 buffer int[64] \
> > > > +  123 123 123 123 123 123 123 123 \
> > > > +  123 123 123 123 123 123 123 123 \
> > > > +  123 123 123 123 123 123 123 123 \
> > > > +  123 123 123 123 123 123 123 123 \
> > > > +  123 123 123 123 123 123 123 123 \
> > > > +  123 123 123 123 123 123 123 123 \
> > > > +  123 123 123 123 123 123 123 123 \
> > > > +  123 123 123 123 123 123 123 123
> > > > +
> > > > !*/
> > > > 
> > > > #ifndef __AMDGCN__
> > > > @@ -65,3 +108,62 @@ kernel void call_clobber_v40(__global int* ret)
> > > >  : "v40");
> > > >*ret = tmp;
> > > > }
> > > > +
> > > > +__attribute__((noinline))
> > > > +void spill_sgpr_to_csr_vgpr()
> > > > +{
> > > > +__asm volatile(
> > > > +"s_nop 1" :::
> > > > +"v0","v1","v2","v3","v4","v5","v6","v7",
> > > > +"v8","v9","v10","v11","v12","v13","v14","v15",
> > > > +"v16","v17","v18","v19","v20","v21","v22","v23",
> > > > +"v24","v25","v26","v27","v28","v29","v30"

Re: [Piglit] [PATCH] cl: Add tests for some cases that were broken with function calls

2019-06-01 Thread Jan Vesely
On Thu, 2019-05-30 at 08:40 -0400, Matt Arsenault wrote:
> Ping
> 
> > On May 23, 2019, at 7:59 PM, arse...@gmail.com wrote:
> > 
> > From: Matt Arsenault 
> > 
> > ---
> > .../program/execute/call-clobbers-amdgcn.cl   | 102 ++
> > 1 file changed, 102 insertions(+)
> > 
> > diff --git a/tests/cl/program/execute/call-clobbers-amdgcn.cl 
> > b/tests/cl/program/execute/call-clobbers-amdgcn.cl
> > index 18e657ce3..b0a1f8c70 100644
> > --- a/tests/cl/program/execute/call-clobbers-amdgcn.cl
> > +++ b/tests/cl/program/execute/call-clobbers-amdgcn.cl
> > @@ -19,6 +19,49 @@ dimensions: 1
> > global_size: 1 0 0
> > arg_out: 0 buffer int[1] 0xabcd1234
> > 
> > +[test]
> > +name: Conditional call
> > +kernel_name: conditional_call
> > +dimensions: 1
> > +local_size: 64 0 0
> > +global_size: 64 0 0
> > +arg_out: 0 buffer int[64] \
> > +  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 
> > 0xabcd1234 0xabcd1234 \
> > +  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 
> > 0xabcd1234 0xabcd1234 \
> > +  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 
> > 0xabcd1234 0xabcd1234 \
> > +  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 
> > 0xabcd1234 0xabcd1234 \
> > +  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 
> > 0xabcd1234 0xabcd1234 \
> > +  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 
> > 0xabcd1234 0xabcd1234 \
> > +  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 
> > 0xabcd1234 0xabcd1234 \
> > +  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 
> > 0xabcd1234 0xabcd1234
> > +
> > +[test]
> > +name: Conditional call partial dispatch
> > +kernel_name: conditional_call
> > +dimensions: 1
> > +local_size: 16 0 0
> > +global_size: 16 0 0
> > +arg_out: 0 buffer int[16] \
> > +  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 
> > 0xabcd1234 0xabcd1234 \
> > +  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 
> > 0xabcd1234 0xabcd1234
> > +
> > +
> > +[test]
> > +name: Skip call no lanes
> > +kernel_name: skip_call_no_lanes
> > +dimensions: 1
> > +local_size: 64 0 0
> > +global_size: 64 0 0
> > +arg_out: 0 buffer int[64] \
> > +  123 123 123 123 123 123 123 123 \
> > +  123 123 123 123 123 123 123 123 \
> > +  123 123 123 123 123 123 123 123 \
> > +  123 123 123 123 123 123 123 123 \
> > +  123 123 123 123 123 123 123 123 \
> > +  123 123 123 123 123 123 123 123 \
> > +  123 123 123 123 123 123 123 123 \
> > +  123 123 123 123 123 123 123 123
> > +
> > !*/
> > 
> > #ifndef __AMDGCN__
> > @@ -65,3 +108,62 @@ kernel void call_clobber_v40(__global int* ret)
> >   : "v40");
> > *ret = tmp;
> > }
> > +
> > +__attribute__((noinline))
> > +void spill_sgpr_to_csr_vgpr()
> > +{
> > +__asm volatile(
> > +"s_nop 1" :::
> > +"v0","v1","v2","v3","v4","v5","v6","v7",
> > +"v8","v9","v10","v11","v12","v13","v14","v15",
> > +"v16","v17","v18","v19","v20","v21","v22","v23",
> > +"v24","v25","v26","v27","v28","v29","v30","v31",
> > +
> > +"s0","s1","s2","s3","s4","s5","s6","s7",
> > +"s8","s9","s10","s11","s12","s13","s14","s15",
> > +"s16","s17","s18","s19","s20","s21","s22","s23",
> > +"s24","s25","s26","s27","s28","s29","s30","s31",
> > +"s32", "s33", "s34", "s35", "s36", "s37", "s38");
> > +}
> > +
> > +// A CSR VGPR needs to be spilled/restored in the prolog/epilog, but
> > +// all lanes need to be made active to avoid clobbering lanes that did
> > +// not enter the call.
> > +kernel void conditional_call(global i

[Piglit] [PATCH 2/2] cl: Wait for kernel execution instead of flushing the queue in cl_piglit_execute kernel

2018-11-21 Thread Jan Vesely
From: Jan Vesely 

This prevents race condition when a failed kernel launch would no longer
be in the command queue by the time we call clFinish.
Signed-off-by: Jan Vesely 
---
 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 f4def259cc..42a5e72f92 100644
--- a/tests/util/piglit-util-cl.c
+++ b/tests/util/piglit-util-cl.c
@@ -1360,7 +1360,7 @@ piglit_cl_execute_ND_range_kernel(cl_command_queue 
command_queue,
return false;
}
 
-   errNo = clFinish(command_queue);
+   errNo = clWaitForEvents(1, );
if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
fprintf(stderr,
"Could not wait for kernel to finish: %s\n",
-- 
2.18.1

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


[Piglit] [PATCH 1/2] cl: Add execution event parameter to piglit_cl_enqueue_kernel

2018-11-21 Thread Jan Vesely
From: Jan Vesely 

Signed-off-by: Jan Vesely 
---
 tests/cl/api/create-program-with-binary.c| 3 ++-
 tests/cl/custom/buffer-flags.c   | 2 +-
 tests/cl/custom/flush-after-enqueue-kernel.c | 3 ++-
 tests/cl/custom/r600-create-release-buffer-bug.c | 9 ++---
 tests/cl/custom/use-sub-buffer-in-kernel.c   | 3 ++-
 tests/util/piglit-util-cl.c  | 9 ++---
 tests/util/piglit-util-cl.h  | 4 +++-
 7 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/tests/cl/api/create-program-with-binary.c 
b/tests/cl/api/create-program-with-binary.c
index 618f4ec296..3f62cd88f7 100644
--- a/tests/cl/api/create-program-with-binary.c
+++ b/tests/cl/api/create-program-with-binary.c
@@ -185,7 +185,8 @@ piglit_cl_test(const int argc,
size_t local_work_size = 1;
cl_command_queue queue = ctx->command_queues[i];
if (!piglit_cl_enqueue_ND_range_kernel(queue, kernel, 1, NULL,
-   _work_size, _work_size)) {
+   _work_size, _work_size,
+   NULL)) {
fprintf(stderr, "Failed to execute binary kernel.");
piglit_merge_result(, PIGLIT_FAIL);
}
diff --git a/tests/cl/custom/buffer-flags.c b/tests/cl/custom/buffer-flags.c
index e4466bc9d2..a46ce548be 100644
--- a/tests/cl/custom/buffer-flags.c
+++ b/tests/cl/custom/buffer-flags.c
@@ -130,7 +130,7 @@ buffer_test(piglit_cl_context *ctx,
 
printf("Running the kernel...\n");
if (!piglit_cl_enqueue_ND_range_kernel(context->command_queues[0],
-   kernel, 1, NULL, , )) {
+   kernel, 1, NULL, , , 
NULL)) {
ret = PIGLIT_FAIL;
goto cleanup;
}
diff --git a/tests/cl/custom/flush-after-enqueue-kernel.c 
b/tests/cl/custom/flush-after-enqueue-kernel.c
index 8d3fc8ccd6..f1246761e1 100644
--- a/tests/cl/custom/flush-after-enqueue-kernel.c
+++ b/tests/cl/custom/flush-after-enqueue-kernel.c
@@ -92,7 +92,8 @@ piglit_cl_test(const int argc,
}
 
if (!piglit_cl_enqueue_ND_range_kernel(context->command_queues[0],
-   kernel, 3, NULL, global_size, 
local_size)) {
+   kernel, 3, NULL, global_size, 
local_size,
+   NULL)) {
return PIGLIT_FAIL;
}
 
diff --git a/tests/cl/custom/r600-create-release-buffer-bug.c 
b/tests/cl/custom/r600-create-release-buffer-bug.c
index 535e57dbfa..262fbce7ec 100644
--- a/tests/cl/custom/r600-create-release-buffer-bug.c
+++ b/tests/cl/custom/r600-create-release-buffer-bug.c
@@ -75,7 +75,8 @@ piglit_cl_test(const int argc,
}
 
if (!piglit_cl_enqueue_ND_range_kernel(queue, kernel, 1, NULL,
-  _size, _size)) {
+  _size, _size,
+  NULL)) {
return PIGLIT_FAIL;
}
 
@@ -85,7 +86,8 @@ piglit_cl_test(const int argc,
}
 
if (!piglit_cl_enqueue_ND_range_kernel(queue, kernel, 1, NULL,
-  _size, _size)) {
+  _size, _size,
+  NULL)) {
return PIGLIT_FAIL;
}
 
@@ -99,7 +101,8 @@ piglit_cl_test(const int argc,
}
 
if (!piglit_cl_enqueue_ND_range_kernel(queue, kernel, 1, NULL,
-  _size, _size)) {
+  _size, _size,
+  NULL)) {
return PIGLIT_FAIL;
}
 
diff --git a/tests/cl/custom/use-sub-buffer-in-kernel.c 
b/tests/cl/custom/use-sub-buffer-in-kernel.c
index 74c085882e..57aed3258f 100644
--- a/tests/cl/custom/use-sub-buffer-in-kernel.c
+++ b/tests/cl/custom/use-sub-buffer-in-kernel.c
@@ -99,7 +99,8 @@ piglit_cl_test(const int argc,
}
 
if (!piglit_cl_enqueue_ND_range_kernel(queue, kernel, 1, NULL,
-  _size, _size)) {
+  _size, _size,
+  NULL)) {
return PIGLIT_FAIL;
}
clFinish(queue);
diff --git a/tests/util/piglit-util-cl.c b/tests/util/piglit-util-cl.c
index 28217724c5..f4def259cc 100644
--- a/tests/util/piglit-util-cl.c
+++ b/tests/util/piglit-util-cl.c
@@ -1322,13 +1322,14 @@ piglit_cl_enqueue_ND_range_kernel(cl_command_queue 
command_queue,
   cl_kernel kernel, cl_uint work_dim,
   const size_t* global_offset,
   c

Re: [Piglit] [PATCH 4/4] arb_tessellation_shader/tes-gs-max-output: new test for TES/GS amplification

2018-10-18 Thread Jan Vesely
On Thu, 2018-10-18 at 08:30 +, Haehnle, Nicolai wrote:
> On 17.10.18 19:57, Jan Vesely wrote:
> > This test breaks build for compilers that don't default to C++11+ for 
> > cpp sources.
> > 
> > https://travis-ci.org/jvesely/piglit/jobs/442796343
> 
> Sorry about that. I just pushed a commit that hopefully fixes this.

It does. thank you.

Jan

> 
> Cheers,
> Nicolai
> 
> 
> > 
> > Jan
> > 
> > On Thu, Sep 13, 2018 at 2:11 PM Nicolai Hähnle  > <mailto:nhaeh...@gmail.com>> wrote:
> > 
> > From: Nicolai Hähnle  > <mailto:nicolai.haeh...@amd.com>>
> > 
> > Test extremes of GS amplification under tessellation.
> > ---
> >   tests/opengl.py   |   1 +
> >   .../arb_tessellation_shader/CMakeLists.gl.txt |   1 +
> >   .../tes-gs-max-output.cpp | 817 ++
> >   3 files changed, 819 insertions(+)
> >   create mode 100644
> > tests/spec/arb_tessellation_shader/tes-gs-max-output.cpp
> > 
> > diff --git a/tests/opengl.py b/tests/opengl.py
> > index 903a95809..3cc25c99c 100644
> > --- a/tests/opengl.py
> > +++ b/tests/opengl.py
> > @@ -1524,20 +1524,21 @@ with profile.test_list.group_manager(
> >   g(['arb_tessellation_shader-immediate-mode-draw-patches'])
> >   g(['arb_tessellation_shader-invalid-get-program-params'])
> >   g(['arb_tessellation_shader-invalid-patch-vertices-range'])
> >   g(['arb_tessellation_shader-invalid-primitive'])
> >   g(['built-in-constants',
> >  os.path.join('spec', 'arb_tessellation_shader',
> > 'minimum-maximums.txt')],
> > 'built-in-constants',
> > override_class=BuiltInConstantsTest)
> >   g(['arb_tessellation_shader-large-uniforms'])
> >   g(['arb_tessellation_shader-layout-mismatch'])
> > +g(['arb_tessellation_shader-tes-gs-max-output', '-small',
> > '-scan', '1', '50'])
> > 
> >   # Group ARB_texture_multisample
> >   with profile.test_list.group_manager(
> >   PiglitGLTest, grouptools.join('spec',
> > 'ARB_texture_multisample')) as g:
> >   g(['arb_texture_multisample-large-float-texture'],
> > 'large-float-texture',
> > run_concurrent=False)
> >   g(['arb_texture_multisample-large-float-texture', '--array'],
> > 'large-float-texture-array', run_concurrent=False)
> >   g(['arb_texture_multisample-large-float-texture', '--fp16'],
> > 'large-float-texture-fp16', run_concurrent=False)
> > diff --git a/tests/spec/arb_tessellation_shader/CMakeLists.gl.txt
> > b/tests/spec/arb_tessellation_shader/CMakeLists.gl.txt
> > index d70b00f3f..058a1bc49 100644
> > --- a/tests/spec/arb_tessellation_shader/CMakeLists.gl.txt
> > +++ b/tests/spec/arb_tessellation_shader/CMakeLists.gl.txt
> > @@ -11,12 +11,13 @@ link_libraries (
> > 
> >   piglit_add_executable (arb_tessellation_shader-get-tcs-params
> > get-tcs-params.c)
> >   piglit_add_executable (arb_tessellation_shader-get-tes-params
> > get-tes-params.c)
> >   piglit_add_executable
> > (arb_tessellation_shader-immediate-mode-draw-patches
> > immediate-mode-draw-patches.c)
> >   piglit_add_executable
> > (arb_tessellation_shader-invalid-get-program-params
> > invalid-get-program-params.c)
> >   piglit_add_executable
> > (arb_tessellation_shader-invalid-patch-vertices-range
> > invalid-patch-vertices-range.c)
> >   piglit_add_executable (arb_tessellation_shader-invalid-primitive
> > invalid-primitive.c)
> >   piglit_add_executable (arb_tessellation_shader-minmax minmax.c)
> >   piglit_add_executable (arb_tessellation_shader-large-uniforms
> > large-uniforms.c)
> >   piglit_add_executable (arb_tessellation_shader-layout-mismatch
> > layout-mismatch.c)
> > +piglit_add_executable (arb_tessellation_shader-tes-gs-max-output
> > tes-gs-max-output.cpp)
> > 
> >   # vim: ft=cmake:
> > diff --git
> > a/tests/spec/arb_tessellation_shader/tes-gs-max-output.cpp
> > b/tests/spec/arb_tessellation_shader/tes-gs-max-output.cpp
> > new file mode 100644
> > index 0..de0d2daf1
> > --- /dev/null
> > +++ b/tests/spec/arb_tessellation_shader/tes-gs-max-output.cpp
> > @@ -0,0 +1,817 @@
> > +/*
> > + * Cop

Re: [Piglit] [PATCH 4/4] arb_tessellation_shader/tes-gs-max-output: new test for TES/GS amplification

2018-10-18 Thread Jan Vesely
This test breaks build for compilers that don't default to C++11+ for
cpp sources.

https://travis-ci.org/jvesely/piglit/jobs/442796343

Jan

On Thu, Sep 13, 2018 at 2:11 PM Nicolai Hähnle  wrote:

> From: Nicolai Hähnle 
>
> Test extremes of GS amplification under tessellation.
> ---
>  tests/opengl.py   |   1 +
>  .../arb_tessellation_shader/CMakeLists.gl.txt |   1 +
>  .../tes-gs-max-output.cpp | 817 ++
>  3 files changed, 819 insertions(+)
>  create mode 100644
> tests/spec/arb_tessellation_shader/tes-gs-max-output.cpp
>
> diff --git a/tests/opengl.py b/tests/opengl.py
> index 903a95809..3cc25c99c 100644
> --- a/tests/opengl.py
> +++ b/tests/opengl.py
> @@ -1524,20 +1524,21 @@ with profile.test_list.group_manager(
>  g(['arb_tessellation_shader-immediate-mode-draw-patches'])
>  g(['arb_tessellation_shader-invalid-get-program-params'])
>  g(['arb_tessellation_shader-invalid-patch-vertices-range'])
>  g(['arb_tessellation_shader-invalid-primitive'])
>  g(['built-in-constants',
> os.path.join('spec', 'arb_tessellation_shader',
> 'minimum-maximums.txt')],
>'built-in-constants',
>override_class=BuiltInConstantsTest)
>  g(['arb_tessellation_shader-large-uniforms'])
>  g(['arb_tessellation_shader-layout-mismatch'])
> +g(['arb_tessellation_shader-tes-gs-max-output', '-small', '-scan',
> '1', '50'])
>
>  # Group ARB_texture_multisample
>  with profile.test_list.group_manager(
>  PiglitGLTest, grouptools.join('spec', 'ARB_texture_multisample'))
> as g:
>  g(['arb_texture_multisample-large-float-texture'],
> 'large-float-texture',
>run_concurrent=False)
>  g(['arb_texture_multisample-large-float-texture', '--array'],
>'large-float-texture-array', run_concurrent=False)
>  g(['arb_texture_multisample-large-float-texture', '--fp16'],
>'large-float-texture-fp16', run_concurrent=False)
> diff --git a/tests/spec/arb_tessellation_shader/CMakeLists.gl.txt
> b/tests/spec/arb_tessellation_shader/CMakeLists.gl.txt
> index d70b00f3f..058a1bc49 100644
> --- a/tests/spec/arb_tessellation_shader/CMakeLists.gl.txt
> +++ b/tests/spec/arb_tessellation_shader/CMakeLists.gl.txt
> @@ -11,12 +11,13 @@ link_libraries (
>
>  piglit_add_executable (arb_tessellation_shader-get-tcs-params
> get-tcs-params.c)
>  piglit_add_executable (arb_tessellation_shader-get-tes-params
> get-tes-params.c)
>  piglit_add_executable
> (arb_tessellation_shader-immediate-mode-draw-patches
> immediate-mode-draw-patches.c)
>  piglit_add_executable (arb_tessellation_shader-invalid-get-program-params
> invalid-get-program-params.c)
>  piglit_add_executable
> (arb_tessellation_shader-invalid-patch-vertices-range
> invalid-patch-vertices-range.c)
>  piglit_add_executable (arb_tessellation_shader-invalid-primitive
> invalid-primitive.c)
>  piglit_add_executable (arb_tessellation_shader-minmax minmax.c)
>  piglit_add_executable (arb_tessellation_shader-large-uniforms
> large-uniforms.c)
>  piglit_add_executable (arb_tessellation_shader-layout-mismatch
> layout-mismatch.c)
> +piglit_add_executable (arb_tessellation_shader-tes-gs-max-output
> tes-gs-max-output.cpp)
>
>  # vim: ft=cmake:
> diff --git a/tests/spec/arb_tessellation_shader/tes-gs-max-output.cpp
> b/tests/spec/arb_tessellation_shader/tes-gs-max-output.cpp
> new file mode 100644
> index 0..de0d2daf1
> --- /dev/null
> +++ b/tests/spec/arb_tessellation_shader/tes-gs-max-output.cpp
> @@ -0,0 +1,817 @@
> +/*
> + * Copyright (c) 2018 Advanced Micro Devices
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the
> "Software"),
> + * to deal in the Software without restriction, including without
> limitation
> + * the rights to use, copy, modify, merge, publish, distribute,
> sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the
> next
> + * paragraph) shall be included in all copies or substantial portions of
> the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT
> SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> + * DEALINGS IN THE SOFTWARE.
> + */
> +
> +/**
> + * \file tes-gs-max-output.cpp
> + *
> + * Stress the limits of what tessellation + geometry shaders can output
> using
> + * generic shaders with points as input and output primitives, allowing
> + * 

Re: [Piglit] [PATCH] cl: Add test for call stack realignment

2018-09-11 Thread Jan Vesely
On Mon, 2018-09-10 at 20:36 -0700, Matt Arsenault wrote:
> v2: Use uintptr_t
> 
> v3: Formatting
> 
> v4: More uintptr_t

pushed, thanks.

Jan

> ---
>  tests/cl/program/execute/realign-stack.cl | 93 +++
>  1 file changed, 93 insertions(+)
>  create mode 100644 tests/cl/program/execute/realign-stack.cl
> 
> diff --git a/tests/cl/program/execute/realign-stack.cl 
> b/tests/cl/program/execute/realign-stack.cl
> new file mode 100644
> index 0..eb1a23f20
> --- /dev/null
> +++ b/tests/cl/program/execute/realign-stack.cl
> @@ -0,0 +1,93 @@
> +/*!
> +
> +[config]
> +name: call with stack realignment
> +
> +[test]
> +name: call stack realignment 16
> +kernel_name: kernel_call_stack_realign16_func
> +dimensions: 1
> +global_size: 1 0 0
> +
> +arg_out: 0 buffer int[1] 1
> +
> +
> +[test]
> +name: call stack realignment 32
> +kernel_name: kernel_call_stack_realign32_func
> +dimensions: 1
> +global_size: 1 0 0
> +
> +arg_out: 0 buffer int[1] 1
> +
> +[test]
> +name: call stack realignment 64
> +kernel_name: kernel_call_stack_realign64_func
> +dimensions: 1
> +global_size: 1 0 0
> +
> +arg_out: 0 buffer int[1] 1
> +
> +[test]
> +name: call stack realignment 128
> +kernel_name: kernel_call_stack_realign128_func
> +dimensions: 1
> +global_size: 1 0 0
> +
> +arg_out: 0 buffer int[1] 1
> +
> +
> +!*/
> +
> +// Make sure the absolute private address of stack objects in callee
> +// functions is properly aligned.
> +
> +#define NOINLINE __attribute__((noinline))
> +
> +NOINLINE
> +int test_stack_object_alignment16() {
> +volatile int4 requires_align16 = 0;
> +volatile uintptr_t addr = (uintptr_t)_align16;
> +return (addr & 15) == 0;
> +}
> +
> +NOINLINE
> +int test_stack_object_alignment32() {
> +volatile int8 requires_align32 = 0;
> +volatile uintptr_t addr = (uintptr_t)_align32;
> +return (addr & 31) == 0;
> +}
> +
> +NOINLINE
> +int test_stack_object_alignment64() {
> +volatile int16 requires_align64 = 0;
> +volatile uintptr_t addr = (uintptr_t)_align64;
> +return (addr & 63) == 0;
> +}
> +
> +NOINLINE
> +int test_stack_object_alignment128() {
> +volatile long16 requires_align128 = 0;
> +volatile uintptr_t addr = (uintptr_t)_align128;
> +return (addr & 127) == 0;
> +}
> +
> +kernel void kernel_call_stack_realign16_func(global int* out) {
> +volatile int misalign_stack = 0;
> +*out = test_stack_object_alignment16();
> +}
> +
> +kernel void kernel_call_stack_realign32_func(global int* out) {
> +volatile int misalign_stack = 0;
> +*out = test_stack_object_alignment32();
> +}
> +
> +kernel void kernel_call_stack_realign64_func(global int* out) {
> +volatile int misalign_stack = 0;
> +*out = test_stack_object_alignment64();
> +}
> +
> +kernel void kernel_call_stack_realign128_func(global int* out) {
> +volatile int misalign_stack = 0;
> +*out = test_stack_object_alignment128();
> +}



signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 2/2] cl: Add tests for calls with special inputs

2018-09-05 Thread Jan Vesely
On Wed, Sep 5, 2018 at 10:16 AM Matt Arsenault  wrote:

> ping
>

merged last week as a9752f23ef3531c6c44fc60cfff9811862fd594a.

Jan


>
> > On Aug 22, 2018, at 15:41, Matt Arsenault  wrote:
> >
> > Also fixes apparently missing coverage for special
> > input arguments not passed in registers.
> > ---
> > tests/cl/program/execute/calls-workitem-id.cl | 136 ++
> > 1 file changed, 136 insertions(+)
> >
> > diff --git a/tests/cl/program/execute/calls-workitem-id.cl
> b/tests/cl/program/execute/calls-workitem-id.cl
> > index 7edfad7e9..b42c85959 100644
> > --- a/tests/cl/program/execute/calls-workitem-id.cl
> > +++ b/tests/cl/program/execute/calls-workitem-id.cl
> > @@ -38,6 +38,56 @@ arg_out: 2 buffer uint[64] \
> >   1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1 \
> >   1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
> >
> > +[test]
> > +name: Callee function stack passed get_local_id
> > +kernel_name: kernel_call_too_many_argument_regs_get_local_id_012
> > +dimensions: 3
> > +global_size: 8 4 2
> > +local_size: 8 4 2
> > +
> > +arg_out: 0 buffer uint[64] \
> > +  0  1  2  3  4  5  6  7  0  1  2  3  4  5  6  7 \
> > +  0  1  2  3  4  5  6  7  0  1  2  3  4  5  6  7 \
> > +  0  1  2  3  4  5  6  7  0  1  2  3  4  5  6  7 \
> > +  0  1  2  3  4  5  6  7  0  1  2  3  4  5  6  7
> > +
> > +arg_out: 1 buffer uint[64] \
> > +  0  0  0  0  0  0  0  0  1  1  1  1  1  1  1  1 \
> > +  2  2  2  2  2  2  2  2  3  3  3  3  3  3  3  3 \
> > +  0  0  0  0  0  0  0  0  1  1  1  1  1  1  1  1 \
> > +  2  2  2  2  2  2  2  2  3  3  3  3  3  3  3  3
> > +
> > +arg_out: 2 buffer uint[64] \
> > +  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 \
> > +  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 \
> > +  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1 \
> > +  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
> > +
> > +[test]
> > +name: Callee function stack passed get_local_id with byval
> > +kernel_name: kernel_call_too_many_argument_regs_byval_get_local_id_012
> > +dimensions: 3
> > +global_size: 8 4 2
> > +local_size: 8 4 2
> > +
> > +arg_out: 0 buffer uint[64] \
> > +  45  46  47  48  49  50  51  52  45  46  47  48  49  50  51  52  \
> > +  45  46  47  48  49  50  51  52  45  46  47  48  49  50  51  52  \
> > +  45  46  47  48  49  50  51  52  45  46  47  48  49  50  51  52  \
> > +  45  46  47  48  49  50  51  52  45  46  47  48  49  50  51  52
> > +
> > +arg_out: 1 buffer uint[64] \
> > +  47  47  47  47  47  47  47  47  48  48  48  48  48  48  48  48 \
> > +  49  49  49  49  49  49  49  49  50  50  50  50  50  50  50  50 \
> > +  47  47  47  47  47  47  47  47  48  48  48  48  48  48  48  48 \
> > +  49  49  49  49  49  49  49  49  50  50  50  50  50  50  50  50
> > +
> > +arg_out: 2 buffer uint[64] \
> > +  50  50  50  50  50  50  50  50  50  50  50  50  50  50  50  50 \
> > +  50  50  50  50  50  50  50  50  50  50  50  50  50  50  50  50 \
> > +  51  51  51  51  51  51  51  51  51  51  51  51  51  51  51  51 \
> > +  51  51  51  51  51  51  51  51  51  51  51  51  51  51  51  51
> > +
> > !*/
> >
> > #define NOINLINE __attribute__((noinline))
> > @@ -75,3 +125,89 @@ kernel void
> kernel_call_pass_get_global_id_012(global uint *out0,
> > {
> > func_get_global_id_012(out0, out1, out2);
> > }
> > +
> > +// On amdgcn, this will require the workitem IDs be passed as values
> > +// on the stack after the arguments.
> > +NOINLINE
> > +uint3 too_many_argument_regs_get_local_id_012(
> > + int arg0, int arg1, int arg2, int arg3,
> > + int arg4, int arg5, int arg6, int arg7,
> > + int arg8, int arg9, int arg10, int arg11,
> > + int arg12, int arg13, int arg14, int arg15,
> > + int arg16, int arg17, int arg18, int arg19,
> > + int arg20, int arg21, int arg22, int arg23,
> > + int arg24, int arg25, int arg26, int arg27,
> > + int arg28, int arg29, int arg30, int arg31)
> > +{
> > + uint3 id;
> > + id.x = get_local_id(0);
> > + id.y = get_local_id(1);
> > + id.z = get_local_id(2);
> > + return id;
> > +}
> > +
> > +kernel void kernel_call_too_many_argument_regs_get_local_id_012(global
> uint* out0, global uint* out1, global uint* out2)
> > +{
> > + uint id0 = get_global_id(0);
> > + uint id1 = get_global_id(1);
> > + uint id2 = get_global_id(2);
> > + uint flat_id = (id2 * get_global_size(1) + id1) *
> get_global_size(0) + id0;
> > +
> > + uint3 result = too_many_argument_regs_get_local_id_012(
> > + 1234, 999, 42, , , 9009, 777, 4242,
> > + 202020, 6359, 8344, 1443, 552323, 33424, 666, 98765,
> > + , 232556, 5, 934121, 94991, 1337, 0xdead, 0xbeef,
> > + 0x, 0x, 0x666, 0x4141, 0x1234, 0x, 0x,
> 0x);
> > +
> > + out0[flat_id] = result.x;
> > + out1[flat_id] = result.y;
> > + out2[flat_id] = result.z;
> > +}
> > +
> > +
> > +typedef struct ByValStruct {
> > + long array[9];
> > +} ByValStruct;
> > +
> > +// Same as previous, with an additional 

Re: [Piglit] [PATCH 1/2] cl: Add test for respecting byval alignment in call setup

2018-09-05 Thread Jan Vesely
On Wed, Sep 5, 2018 at 10:16 AM Matt Arsenault  wrote:

> ping
>
> This one was merged last week.

Jan


> > On Aug 22, 2018, at 15:41, Matt Arsenault  wrote:
> >
> > ---
> > .../cl/program/execute/calls-large-struct.cl  | 36 +++
> > 1 file changed, 36 insertions(+)
> >
> > diff --git a/tests/cl/program/execute/calls-large-struct.cl
> b/tests/cl/program/execute/calls-large-struct.cl
> > index c10458f37..0eac4d470 100644
> > --- a/tests/cl/program/execute/calls-large-struct.cl
> > +++ b/tests/cl/program/execute/calls-large-struct.cl
> > @@ -37,6 +37,15 @@ arg_out: 0 buffer int[16]\
> > arg_in: 1 buffer int[16] \
> >  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
> >
> > +
> > +[test]
> > +name: byval struct align 8
> > +kernel_name: kernel_call_byval_struct_align8
> > +dimensions: 1
> > +global_size: 1 0 0
> > +
> > +arg_out: 0 buffer int[1]  1
> > +
> > !*/
> >
> > #define NOINLINE __attribute__((noinline))
> > @@ -154,3 +163,30 @@ kernel void call_sret_Char_IntArray_func(global
> int* output, global int* input)
> >
> > output[id] = sum;
> > }
> > +
> > +typedef struct ByVal_Struct_Align8 {
> > +long xs[9];
> > +} ByVal_Struct_Align8;
> > +
> > +__attribute__((noinline))
> > +int func(ByVal_Struct_Align8 val)
> > +{
> > +for (int i = 0; i < 9; ++i)
> > +{
> > +long ld = val.xs[i];
> > +if (ld != i)
> > +return 0;
> > +}
> > +return 1;
> > +}
> > +
> > +__kernel void kernel_call_byval_struct_align8(__global uint* result)
> > +{
> > +struct ByVal_Struct_Align8 val = { { 0x1337 } };
> > +for (int i = 0; i < 9; ++i)
> > +{
> > +val.xs[i] = i;
> > +}
> > +
> > +*result = func(val);
> > +}
> > --
> > 2.17.1
> >
>
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
>
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cl: Add test for call stack realignment

2018-09-05 Thread Jan Vesely
On Wed, 2018-09-05 at 19:15 +0500, Matt Arsenault wrote:
> > On Aug 22, 2018, at 10:57, Jan Vesely  wrote:
> > 
> > On Tue, 2018-08-21 at 21:00 +0300, Matt Arsenault wrote:
> > > ping
> > 
> > sorry. I won't have access to my machines until next week (possibly
> > September)
> 
> ping

I've merged the others, this one did not address the latest comment;
casts should be to (uintptr_t) as rather tan (uint).
 volatile uintptr_t addr = (uint)&... ->  volatile uintptr_t addr = (uintptr_t)&

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



signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cl: Add test for call stack realignment

2018-08-21 Thread Jan Vesely
On Tue, 2018-08-21 at 21:00 +0300, Matt Arsenault wrote:
> ping

sorry. I won't have access to my machines until next week (possibly
September)

> 
> > On Aug 13, 2018, at 23:33, Matt Arsenault  wrote:
> > 
> > v2: Use uintptr_t
> > 
> > v3: Formatting
> > ---
> > tests/cl/program/execute/realign-stack.cl | 93 +++
> > 1 file changed, 93 insertions(+)
> > create mode 100644 tests/cl/program/execute/realign-stack.cl
> > 
> > diff --git a/tests/cl/program/execute/realign-stack.cl 
> > b/tests/cl/program/execute/realign-stack.cl
> > new file mode 100644
> > index 0..ca83284fe
> > --- /dev/null
> > +++ b/tests/cl/program/execute/realign-stack.cl
> > @@ -0,0 +1,93 @@
> > +/*!
> > +
> > +[config]
> > +name: call with stack realignment
> > +
> > +[test]
> > +name: call stack realignment 16
> > +kernel_name: kernel_call_stack_realign16_func
> > +dimensions: 1
> > +global_size: 1 0 0
> > +
> > +arg_out: 0 buffer int[1] 1
> > +
> > +
> > +[test]
> > +name: call stack realignment 32
> > +kernel_name: kernel_call_stack_realign32_func
> > +dimensions: 1
> > +global_size: 1 0 0
> > +
> > +arg_out: 0 buffer int[1] 1
> > +
> > +[test]
> > +name: call stack realignment 64
> > +kernel_name: kernel_call_stack_realign64_func
> > +dimensions: 1
> > +global_size: 1 0 0
> > +
> > +arg_out: 0 buffer int[1] 1
> > +
> > +[test]
> > +name: call stack realignment 128
> > +kernel_name: kernel_call_stack_realign128_func
> > +dimensions: 1
> > +global_size: 1 0 0
> > +
> > +arg_out: 0 buffer int[1] 1
> > +
> > +
> > +!*/
> > +
> > +// Make sure the absolute private address of stack objects in callee
> > +// functions is properly aligned.
> > +
> > +#define NOINLINE __attribute__((noinline))
> > +
> > +NOINLINE
> > +int test_stack_object_alignment16() {
> > +volatile int4 requires_align16 = 0;
> > +volatile uintptr_t addr = (uint)_align16;

The cast should probably be (uintptr_t) as well, right?

> > +return (addr & 15) == 0;

The test would be clearer if these constants were in hex (0xf)

Jan

> > +}
> > +
> > +NOINLINE
> > +int test_stack_object_alignment32() {
> > +volatile int8 requires_align32 = 0;
> > +volatile uintptr_t addr = (uint)_align32;
> > +return (addr & 31) == 0;
> > +}
> > +
> > +NOINLINE
> > +int test_stack_object_alignment64() {
> > +volatile int16 requires_align64 = 0;
> > +volatile uintptr_t addr = (uint)_align64;
> > +return (addr & 63) == 0;
> > +}
> > +
> > +NOINLINE
> > +int test_stack_object_alignment128() {
> > +volatile long16 requires_align128 = 0;
> > +volatile uintptr_t addr = (uint)_align128;
> > +return (addr & 127) == 0;
> > +}
> > +
> > +kernel void kernel_call_stack_realign16_func(global int* out) {
> > +volatile int misalign_stack = 0;
> > +*out = test_stack_object_alignment16();
> > +}
> > +
> > +kernel void kernel_call_stack_realign32_func(global int* out) {
> > +volatile int misalign_stack = 0;
> > +*out = test_stack_object_alignment32();
> > +}
> > +
> > +kernel void kernel_call_stack_realign64_func(global int* out) {
> > +volatile int misalign_stack = 0;
> > +*out = test_stack_object_alignment64();
> > +}
> > +
> > +kernel void kernel_call_stack_realign128_func(global int* out) {
> > +volatile int misalign_stack = 0;
> > +*out = test_stack_object_alignment128();
> > +}
> > -- 
> > 2.17.1
> > 
> 
> 

-- 
Jan Vesely 

signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cl: Add test for CSR VGPRs caused by SGPR spilling

2018-08-14 Thread Jan Vesely
On Mon, 2018-08-13 at 20:06 -0400, Jan Vesely wrote:
> On Mon, 2018-08-13 at 23:29 +0300, Matt Arsenault wrote:
> > > On May 8, 2018, at 18:45, Jan Vesely  wrote:
> > > 
> > > On Tue, 2018-05-08 at 13:28 +0300, Matt Arsenault wrote:
> > > > > On Apr 8, 2018, at 19:56, Jan Vesely  wrote:
> > > > > 
> > > > > On Fri, 2018-04-06 at 00:49 -0400, Matt Arsenault wrote:
> > > > > > ping
> > > > > 
> > > > > I'll need to setup the rocm stack to test this. It will take some 
> > > > > time.
> > > > > It should work with clover as well (modulo bugs; asm parser, function
> > > > > calls, ...), right?
> > > > > 
> > > > > Jan
> > > > 
> > > > I thought calls were broken in general with clover because of the
> > > > missing link step? Besides that it should work
> > > 
> > > Linking works (both linking with libclc and cl-1.2 clLinkProgram) it
> > > just happens at IR level (if you consider that linking) so all function
> > > calls can be inlined.
> > > 
> > > The problem is that llvm backend generates relocation for function
> > > calls. This relocation is not handled by clover (you could call this
> > > 'calls are broken in general').
> > > 
> > > I see two ways to fix this;
> > > a) fix llvm to use fixup instead of relocation for internal function
> > > calls.
> > > b) fix clover to handle the function call relocation.
> > > 
> > > I tried a) but a simple
> > > "|| (GV->getLinkage() == GlobalValue::InternalLinkage)"
> > > in shouldEmitFixup() is not enough (the fixup value looks wrong)
> > > 
> > > I still think that a) is preferable, but now that 6.0 is out with the
> > > breakage we'll need to implement b) anyway.
> > > 
> > > I'll try to find some time to dig a bit more into this, but it's tricky
> > > since wrong jump leaves the GPU in unrecoverable state that needs
> > > manual power cycling on reboot.
> > > 
> > > Jan
> > > > 
> > > > -Matt
> > 
> > 
> > ping. Should this just skip the clover platform for now?
> 
> this already skips clover due to device regexp (gfx). I just want to
> see it run (pass or fail) before stamping it.
> It can be either clover (with function calls fixed and changed device
> regexp) or other OCL implementation.
> Given how user-hostile to rocm-ocl setup is and that -pro version
> segfaults, getting clover to support relocations is more likely.

I managed to get ROCm opencl running (its overall piglit situation is 
unimpressive [0]) and the test works.

LGTM.

Jan

[0] http://paul.rutgers.edu/~jv356/piglit/gcn-latest-3/problems.html
> 
> Jan

-- 
Jan Vesely 

signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cl: Add test for CSR VGPRs caused by SGPR spilling

2018-08-13 Thread Jan Vesely
On Mon, 2018-08-13 at 23:29 +0300, Matt Arsenault wrote:
> > On May 8, 2018, at 18:45, Jan Vesely  wrote:
> > 
> > On Tue, 2018-05-08 at 13:28 +0300, Matt Arsenault wrote:
> > > > On Apr 8, 2018, at 19:56, Jan Vesely  wrote:
> > > > 
> > > > On Fri, 2018-04-06 at 00:49 -0400, Matt Arsenault wrote:
> > > > > ping
> > > > 
> > > > I'll need to setup the rocm stack to test this. It will take some time.
> > > > It should work with clover as well (modulo bugs; asm parser, function
> > > > calls, ...), right?
> > > > 
> > > > Jan
> > > 
> > > I thought calls were broken in general with clover because of the
> > > missing link step? Besides that it should work
> > 
> > Linking works (both linking with libclc and cl-1.2 clLinkProgram) it
> > just happens at IR level (if you consider that linking) so all function
> > calls can be inlined.
> > 
> > The problem is that llvm backend generates relocation for function
> > calls. This relocation is not handled by clover (you could call this
> > 'calls are broken in general').
> > 
> > I see two ways to fix this;
> > a) fix llvm to use fixup instead of relocation for internal function
> > calls.
> > b) fix clover to handle the function call relocation.
> > 
> > I tried a) but a simple
> > "|| (GV->getLinkage() == GlobalValue::InternalLinkage)"
> > in shouldEmitFixup() is not enough (the fixup value looks wrong)
> > 
> > I still think that a) is preferable, but now that 6.0 is out with the
> > breakage we'll need to implement b) anyway.
> > 
> > I'll try to find some time to dig a bit more into this, but it's tricky
> > since wrong jump leaves the GPU in unrecoverable state that needs
> > manual power cycling on reboot.
> > 
> > Jan
> > > 
> > > -Matt
> 
> 
> ping. Should this just skip the clover platform for now?

this already skips clover due to device regexp (gfx). I just want to
see it run (pass or fail) before stamping it.
It can be either clover (with function calls fixed and changed device
regexp) or other OCL implementation.
Given how user-hostile to rocm-ocl setup is and that -pro version
segfaults, getting clover to support relocations is more likely.

Jan
-- 
Jan Vesely 

signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cl: Add bigger versions of calls with struct tests

2018-08-13 Thread Jan Vesely
On Mon, 2018-08-13 at 13:41 -0700, Matt Arsenault wrote:
> These are just bigger versions of the existing struct
> calls tests so that they stress using byval/sret. The
> existing call with struct tests are now passed directly
> in registers.
> 
> v2: Rename struct member

passes on POCL.
Reviewed-by: Jan Vesely 

I'd help I you cc'ed me on patches you want me to merge directly,
rather than sending a ping later. sifting through the ML requires
extra time.

Jan

> ---
>  .../cl/program/execute/calls-large-struct.cl  | 156 ++
>  tests/cl/program/execute/calls-struct.cl  |  96 +--
>  2 files changed, 204 insertions(+), 48 deletions(-)
>  create mode 100644 tests/cl/program/execute/calls-large-struct.cl
> 
> diff --git a/tests/cl/program/execute/calls-large-struct.cl 
> b/tests/cl/program/execute/calls-large-struct.cl
> new file mode 100644
> index 0..c10458f37
> --- /dev/null
> +++ b/tests/cl/program/execute/calls-large-struct.cl
> @@ -0,0 +1,156 @@
> +/*!
> +
> +[config]
> +name: calls with large structs
> +clc_version_min: 10
> +
> +[test]
> +name: byval struct
> +kernel_name: call_i32_func_byval_Char_IntArray
> +dimensions: 1
> +global_size: 16 0 0
> +
> +arg_out: 0 buffer int[16]\
> + 1021 1022 1023 1024 1025 1026 1027 1028 \
> + 1029 1030 1031 1032 1033 1034 1035 1036
> +
> +arg_out: 1 buffer int[16] \
> +  14   14   14   14 \
> +  14   14   14   14 \
> +  14   14   14   14 \
> +  14   14   14   14 \
> +
> +arg_in: 2 buffer int[16] \
> + 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
> +
> +
> +[test]
> +name: sret struct
> +kernel_name: call_sret_Char_IntArray_func
> +dimensions: 1
> +global_size: 16 0 0
> +
> +arg_out: 0 buffer int[16]\
> + 921 922 923 924 925 926 927 928 \
> + 929 930 931 932 933 934 935 936
> +
> +arg_in: 1 buffer int[16] \
> + 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
> +
> +!*/
> +
> +#define NOINLINE __attribute__((noinline))
> +
> +typedef struct ByVal_Char_IntArray {
> +char c;
> +int i32_arr[32];
> +} ByVal_Char_IntArray;
> +
> +NOINLINE
> +int i32_func_byval_Char_IntArray(ByVal_Char_IntArray st)
> +{
> +st.i32_arr[0] += 100;
> +
> +int sum = 0;
> +for (int i = 0; i < 32; ++i)
> +{
> +sum += st.i32_arr[i];
> +}
> +
> +sum += st.c;
> +return sum;
> +}
> +
> +kernel void call_i32_func_byval_Char_IntArray(global int* out0,
> +  global int* out1,
> +  global int* input)
> +{
> +ByVal_Char_IntArray st;
> +st.c = 15;
> +
> +int id = get_global_id(0);
> +
> +int val = input[id];
> +
> +
> +st.i32_arr[0] = 14;
> +st.i32_arr[1] = -8;
> +st.i32_arr[2] = val;
> +st.i32_arr[3] = 900;
> +
> +for (int i = 4; i < 32; ++i)
> +{
> +st.i32_arr[i] = 0;
> +}
> +
> +volatile int stack_object[16];
> +for (int i = 0; i < 16; ++i)
> +{
> +const int test_val = 0x07080900 | i;
> +stack_object[i] = test_val;
> +}
> +
> +int result = i32_func_byval_Char_IntArray(st);
> +
> +// Check for stack corruption
> +for (int i = 0; i < 16; ++i)
> +{
> +const int test_val = 0x07080900 | i;
> +if (stack_object[i] != test_val)
> +result = -1;
> +}
> +
> +out0[id] = result;
> +out1[id] = st.i32_arr[0];
> +}
> +
> +NOINLINE
> +ByVal_Char_IntArray sret_Char_IntArray_func(global int* input, int id)
> +{
> +ByVal_Char_IntArray st;
> +st.c = 15;
> +
> +int val = input[id];
> +st.i32_arr[0] = 14;
> +st.i32_arr[1] = -8;
> +st.i32_arr[2] = val;
> +st.i32_arr[3] = 900;
> +
> +for (int i = 4; i < 32; ++i)
> +{
> +st.i32_arr[i] = 0;
> +}
> +
> +return st;
> +}
> +
> +kernel void call_sret_Char_IntArray_func(global int* output, global int* 
> input)
> +{
> +volatile int stack_object[16];
> +for (int i = 0; i < 16; ++i)
> +{
> +const int test_val = 0x04030200 | i;
> +stack_object[i] = test_val;
> +}
> +
> +int id = get_global_id(0);
> +ByVal_Char_IntArray st = sret_Char_IntArray_func(input, id);
> +
> +int sum = 0;
> +for (int i = 0; i < 32; ++i)
> +{
> +sum += st.i32_arr[i];
> +}
> +
> +sum += st.c;
> +
> +// Check for stack corruption
> +for (int i = 0; i < 16; ++i)
> +{
> +const int test_val = 0x04030200 | i;
> +if (stack_object[i] != test_val)
>

Re: [Piglit] [PATCH] cl: Fix types to be unsigned

2018-08-13 Thread Jan Vesely
On Mon, 2018-08-13 at 23:42 +0300, Matt Arsenault wrote:
> ping

Reviewed-by: Jan Vesely 

> 
> > On Oct 27, 2017, at 13:03, Matt Arsenault  wrote:
> > 
> > Doesn't really matter.

so why change it?
still passes on clover carrizo/iceland

Jan

> > ---
> > tests/cl/program/execute/store-hi16.cl | 8 
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/tests/cl/program/execute/store-hi16.cl 
> > b/tests/cl/program/execute/store-hi16.cl
> > index b734b3766..4273d3369 100644
> > --- a/tests/cl/program/execute/store-hi16.cl
> > +++ b/tests/cl/program/execute/store-hi16.cl
> > @@ -92,7 +92,7 @@ kernel void store_hi16_global(volatile global ushort* 
> > out, volatile global uint*
> > 
> > kernel void store_hi16_local(volatile global ushort* out, volatile global 
> > uint* in)
> > {
> > -volatile local short lds[64];
> > +volatile local ushort lds[64];
> > int lid = get_local_id(0);
> > int gid = get_global_id(0);
> > 
> > @@ -104,7 +104,7 @@ kernel void store_hi16_local(volatile global ushort* 
> > out, volatile global uint*
> > kernel void store_hi16_private(volatile global ushort* out, volatile global 
> > uint* in)
> > {
> > int gid = get_global_id(0);
> > -volatile private short stack = in[gid] >> 16;
> > +volatile private ushort stack = in[gid] >> 16;
> > out[gid] = stack;
> > }
> > 
> > @@ -117,7 +117,7 @@ kernel void truncstorei8_hi16_global(volatile global 
> > uchar* out, volatile global
> > 
> > kernel void truncstorei8_hi16_local(volatile global uchar* out, volatile 
> > global uint* in)
> > {
> > -volatile local short lds[64];
> > +volatile local ushort lds[64];
> > int lid = get_local_id(0);
> > int gid = get_global_id(0);
> > 
> > @@ -129,6 +129,6 @@ kernel void truncstorei8_hi16_local(volatile global 
> > uchar* out, volatile global
> > kernel void truncstorei8_hi16_private(volatile global uchar* out, volatile 
> > global uint* in)
> > {
> > int gid = get_global_id(0);
> > -volatile private short stack = in[gid] >> 16;
> > +volatile private ushort stack = in[gid] >> 16;
> > out[gid] = (uchar)stack;
> > }
> > -- 
> > 2.11.0
> > 
> 
> 

-- 
Jan Vesely 

signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cl: Add test for CSR VGPRs caused by SGPR spilling

2018-05-08 Thread Jan Vesely
On Tue, 2018-05-08 at 13:28 +0300, Matt Arsenault wrote:
> > On Apr 8, 2018, at 19:56, Jan Vesely <jan.ves...@rutgers.edu> wrote:
> > 
> > On Fri, 2018-04-06 at 00:49 -0400, Matt Arsenault wrote:
> > > ping
> > 
> > I'll need to setup the rocm stack to test this. It will take some time.
> > It should work with clover as well (modulo bugs; asm parser, function
> > calls, ...), right?
> > 
> > Jan
> 
> I thought calls were broken in general with clover because of the
> missing link step? Besides that it should work

Linking works (both linking with libclc and cl-1.2 clLinkProgram) it
just happens at IR level (if you consider that linking) so all function
calls can be inlined.

The problem is that llvm backend generates relocation for function
calls. This relocation is not handled by clover (you could call this
'calls are broken in general').

I see two ways to fix this;
a) fix llvm to use fixup instead of relocation for internal function
calls.
b) fix clover to handle the function call relocation.

I tried a) but a simple
"|| (GV->getLinkage() == GlobalValue::InternalLinkage)"
in shouldEmitFixup() is not enough (the fixup value looks wrong)

I still think that a) is preferable, but now that 6.0 is out with the
breakage we'll need to implement b) anyway.

I'll try to find some time to dig a bit more into this, but it's tricky
since wrong jump leaves the GPU in unrecoverable state that needs
manual power cycling on reboot.

Jan
> 
> -Matt


signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cl: Add test for CSR VGPRs caused by SGPR spilling

2018-04-08 Thread Jan Vesely
On Fri, 2018-04-06 at 00:49 -0400, Matt Arsenault wrote:
> ping

I'll need to setup the rocm stack to test this. It will take some time.
It should work with clover as well (modulo bugs; asm parser, function
calls, ...), right?

Jan

> 
> > On Mar 29, 2018, at 11:29, Matt Arsenault <arse...@gmail.com> wrote:
> > 
> > Make sure if a CSR VGPR is needed for SGPR spilling, it is
> > properly saved and restored.
> > ---
> > .../execute/amdgcn-callee-saved-registers.cl   | 52 
> > ++
> > 1 file changed, 52 insertions(+)
> > create mode 100644 tests/cl/program/execute/amdgcn-callee-saved-registers.cl
> > 
> > diff --git a/tests/cl/program/execute/amdgcn-callee-saved-registers.cl 
> > b/tests/cl/program/execute/amdgcn-callee-saved-registers.cl
> > new file mode 100644
> > index 0..8b8db2783
> > --- /dev/null
> > +++ b/tests/cl/program/execute/amdgcn-callee-saved-registers.cl
> > @@ -0,0 +1,52 @@
> > +/*!
> > +
> > +[config]
> > +name: amdgcn call clobbers
> > +clc_version_min: 10
> > +device_regex: gfx[\d]*
> > +
> > +[test]
> > +name: CSR VGPR for SGPR spilling
> > +kernel_name: kernel_call_need_spill_vgpr_for_csr_sgpr_spills_no_calls
> > +dimensions: 1
> > +global_size: 1 0 0
> > +arg_out: 0 buffer int[2] \
> > +  0x1337  0xabcd1234
> > +
> > +!*/
> > +
> > +#ifndef __AMDGCN__
> > +#error This test is only for amdgcn
> > +#endif
> > +
> > +__attribute__((noinline))
> > +int need_spill_vgpr_for_csr_sgpr_spills_no_calls()
> > +{
> > +int sgpr_val;
> > +__asm volatile("s_mov_b32 %0, 0x1337" : "=s"(sgpr_val));
> > +
> > +__asm volatile(
> > +"s_nop 1" :::
> > +"v0","v1","v2","v3","v4","v5","v6","v7",
> > +"v8","v9","v10","v11","v12","v13","v14","v15",
> > +"v16","v17","v18","v19","v20","v21","v22","v23",
> > +"v24","v25","v26","v27","v28","v29","v30","v31",
> > +
> > +"s0","s1","s2","s3","s4","s5","s6","s7",
> > +"s8","s9","s10","s11","s12","s13","s14","s15",
> > +"s16","s17","s18","s19","s20","s21","s22","s23",
> > +"s24","s25","s26","s27","s28","s29","s30","s31",
> > +   "s32", "s33", "s34", "s35", "s36", "s37", "s38");
> > +
> > +return sgpr_val;
> > +}
> > +
> > +
> > +kernel void 
> > kernel_call_need_spill_vgpr_for_csr_sgpr_spills_no_calls(global int* ret)
> > +{
> > +int v32;
> > +__asm volatile("v_mov_b32 %0, 0xabcd1234" : "={v32}"(v32));
> > +ret[0] = need_spill_vgpr_for_csr_sgpr_spills_no_calls();
> > +__asm volatile ("s_nop 0" :: "{v32}"(v32));
> > +ret[1] = v32;
> > +}
> > -- 
> > 2.14.1
> > 
> 
> 

-- 
Jan Vesely <jan.ves...@rutgers.edu>

signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cl: Add test for call stack realignment

2018-04-08 Thread Jan Vesely
On Fri, 2018-04-06 at 00:28 -0400, Matt Arsenault wrote:
> > On Apr 4, 2018, at 15:52, Jan Vesely <jan.ves...@rutgers.edu> wrote:
> > 
> > redundant newline
> 
> Not sure what you mean by this. Do you mean the newline to put the
> single array element on its own line? I was trying to be consistent
> with buffer formatting as most tests do

most test don't. out of 200+ tests (not counting the generated ones,
which don't use it) only 26 put buffer initializer on a new line, 23 of
those were submitted by you.
while I didn't mind that much doing it for large arrays, using it for a
single element is ridiculous.

Jan

-- 
Jan Vesely <jan.ves...@rutgers.edu>

signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cl: Add test for call stack realignment

2018-04-04 Thread Jan Vesely
On Tue, 2018-04-03 at 18:03 -0400, Matt Arsenault wrote:
> ping
> 
> > On Mar 29, 2018, at 10:35, Matt Arsenault  wrote:
> > 
> > ---
> > tests/cl/program/execute/realign-stack.cl | 96 
> > +++
> > 1 file changed, 96 insertions(+)
> > create mode 100644 tests/cl/program/execute/realign-stack.cl
> > 
> > diff --git a/tests/cl/program/execute/realign-stack.cl 
> > b/tests/cl/program/execute/realign-stack.cl
> > new file mode 100644
> > index 0..ed62ea211
> > --- /dev/null
> > +++ b/tests/cl/program/execute/realign-stack.cl
> > @@ -0,0 +1,96 @@
> > +/*!
> > +
> > +[config]
> > +name: call with stack realignment

why does this care about call? 
CLC requires types to be aligned to next power of 2 of their size
irrespective of the location. HOw is this different from any other
__private variable declaration?

> > +
> > +[test]
> > +name: call stack realignment 16
> > +kernel_name: kernel_call_stack_realign16_func
> > +dimensions: 1
> > +global_size: 1 0 0
> > +
> > +arg_out: 0 buffer int[1] \
> > +  1

redundant newline

> > +
> > +
> > +[test]
> > +name: call stack realignment 32
> > +kernel_name: kernel_call_stack_realign32_func
> > +dimensions: 1
> > +global_size: 1 0 0
> > +
> > +arg_out: 0 buffer int[1] \
> > +  1

same here

> > +
> > +[test]
> > +name: call stack realignment 64
> > +kernel_name: kernel_call_stack_realign64_func
> > +dimensions: 1
> > +global_size: 1 0 0
> > +
> > +arg_out: 0 buffer int[1] \
> > +  1

same here

> > +
> > +[test]
> > +name: call stack realignment 128
> > +kernel_name: kernel_call_stack_realign128_func
> > +dimensions: 1
> > +global_size: 1 0 0
> > +
> > +arg_out: 0 buffer int[1] \
> > +  1

and here

> > +
> > +!*/
> > +
> > +// Make sure the absolute private address of stack objects in callee
> > +// functions is properly aligned.
> > +
> > +#define NOINLINE __attribute__((noinline))
> > +
> > +NOINLINE
> > +int test_stack_object_alignment16() {
> > +volatile int4 requires_align16 = 0;
> > +volatile uint addr = (uint)_align16;

this should use uintptr_t. why is the addr variable volatile?
same in the below tests.

Jan

> > +return (addr & 15) == 0;
> > +}
> > +
> > +NOINLINE
> > +int test_stack_object_alignment32() {
> > +volatile int8 requires_align32 = 0;
> > +volatile uint addr = (uint)_align32;
> > +return (addr & 31) == 0;
> > +}
> > +
> > +NOINLINE
> > +int test_stack_object_alignment64() {
> > +volatile int16 requires_align64 = 0;
> > +volatile uint addr = (uint)_align64;
> > +return (addr & 63) == 0;
> > +}
> > +
> > +NOINLINE
> > +int test_stack_object_alignment128() {
> > +volatile long16 requires_align128 = 0;
> > +volatile uint addr = (uint)_align128;
> > +return (addr & 127) == 0;
> > +}
> > +
> > +kernel void kernel_call_stack_realign16_func(global int* out) {
> > +volatile int misalign_stack = 0;
> > +*out = test_stack_object_alignment16();
> > +}
> > +
> > +kernel void kernel_call_stack_realign32_func(global int* out) {
> > +volatile int misalign_stack = 0;
> > +*out = test_stack_object_alignment32();
> > +}
> > +
> > +kernel void kernel_call_stack_realign64_func(global int* out) {
> > +volatile int misalign_stack = 0;
> > +*out = test_stack_object_alignment64();
> > +}
> > +
> > +kernel void kernel_call_stack_realign128_func(global int* out) {
> > +volatile int misalign_stack = 0;
> > +*out = test_stack_object_alignment128();
> > +}
> > -- 
> > 2.14.1
> > 
> 
> 


signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cl: Add bigger versions of calls with struct tests

2018-03-23 Thread Jan Vesely
rray_func(global 
> > int* input, int id)
> > return st;
> > }
> > 
> > -kernel void call_sret_Char_IntArray_func(global int* output, global int* 
> > input)
> > +kernel void call_struct_smallregs_Char_IntArray_func(global int* output, 
> > global int* input)
> > {
> > int id = get_global_id(0);
> > -ByVal_Char_IntArray st = sret_Char_IntArray_func(input, id);
> > +SmallStruct_Char_IntArray st = 
> > struct_smallregs_Char_IntArray_func(input, id);
> > 
> > int sum = 0;
> > for (int i = 0; i < 4; ++i)
> > @@ -134,7 +134,7 @@ kernel void call_sret_Char_IntArray_func(global int* 
> > output, global int* input)
> > }
> > 
> > NOINLINE
> > -ByVal_Char_IntArray 
> > sret_Char_IntArray_func_byval_Char_IntArray(ByVal_Char_IntArray st)
> > +SmallStruct_Char_IntArray 
> > struct_smallregs_Char_IntArray_func_small_struct_regs_Char_IntArray(SmallStruct_Char_IntArray
> >  st)
> > {
> > st.c += 15;
> > 
> > @@ -146,13 +146,13 @@ ByVal_Char_IntArray 
> > sret_Char_IntArray_func_byval_Char_IntArray(ByVal_Char_IntAr
> > return st;
> > }
> > 
> > -kernel void call_sret_Char_IntArray_func_byval_Char_IntArray(global int* 
> > output0,
> > - global int* 
> > output1,
> > - global int* 
> > input)
> > +kernel void 
> > call_struct_smallregs_Char_IntArray_func_small_struct_regs_Char_IntArray(global
> >  int* output0,
> > +   
> >   global int* output1,
> > +   
> >   global int* input)
> > {
> > int id = get_global_id(0);
> > 
> > -volatile ByVal_Char_IntArray st0;
> > +volatile SmallStruct_Char_IntArray st0;
> > st0.c = -20;
> > 
> > int val = input[id];
> > @@ -161,7 +161,7 @@ kernel void 
> > call_sret_Char_IntArray_func_byval_Char_IntArray(global int* output0
> > st0.i[2] = val;
> > st0.i[3] = 100;
> > 
> > -ByVal_Char_IntArray st1 = 
> > sret_Char_IntArray_func_byval_Char_IntArray(st0);
> > +SmallStruct_Char_IntArray st1 = 
> > struct_smallregs_Char_IntArray_func_small_struct_regs_Char_IntArray(st0);
> > 
> > int sum0 = 0;
> > int sum1 = 0;
> > -- 
> > 2.11.0
> > 
> 
> 

-- 
Jan Vesely <jan.ves...@rutgers.edu>

signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cl: Add test for MUBUF access with a negative vaddr

2018-01-29 Thread Jan Vesely
On Fri, 2018-01-19 at 14:43 -0500, Matt Arsenault wrote:
> > On Jan 18, 2018, at 15:02, Jan Vesely <jan.ves...@rutgers.edu> wrote:
> > 
> > Why is this necessary? can't you just pass the offset argument as a
> > kernel input?
> > 
> > Jan
> 
> It needs to specifically be in a VGPR

OK LGTM. I'll push it in the next few days.

wouldn't the same be achieved by adding get_local_id(0)?
I'm trying to make these tests more interesting for non-amd targets to
avoid adding bloat to the testing runs.
maybe the right approach would be to have a separate amd specific list
of tests that don't run by default (but still pass) on other devices.

Jan


-- 
Jan Vesely <jan.ves...@rutgers.edu>

signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] framework: Handle tests with subtests crashing in totals

2018-01-19 Thread Jan Vesely
On Fri, 2018-01-19 at 15:26 -0800, Dylan Baker wrote:
> I mean to CC Fabien as well...

I think you did, at least the email looks correct.

I'm not sure how to test this change. After reverting Fabien's patch
things got back to normal. the tests on Jan 17 and 18 ran with Fabien's
change, the rest is without [0].

thanks,
Jan


[0] http://paul.rutgers.edu/~jv356/piglit/radeon-latest-5/problems.html

> 
> Quoting Dylan Baker (2018-01-19 14:04:13)
> > Currently piglit doesn't account for a test with subtests crashing when
> > it calculates the total number of tests of each status. The result is
> > that if a test with subtests runs no tests before crashing it is handled
> > correctly (since it goes down the non-subtest path), but if one or more
> > subtests are run, and those tests return a better result than crash,
> > then the test will be marked as that status instead.
> > 
> > The real problem is that the python framework has no idea how many
> > subtests that a test binary is going to run, so if the test crashes it
> > has no idea if some subtests weren't run. To paper over that if the
> > result of a test is not the same as the worst result of it's subtests
> > we'll treat the test as a single test rather than a group, this results
> > in the summaries generating the expected results.
> > 
> > A better fix would be to have tests with subtests inform the framework
> > (preferably via JSON) that all of the subtests that it will run before
> > it starts running, so that the python framework can pre-populate the
> > subtests and generate the right result.
> > 
> > This solution is a better in the short term because it makes the results
> > consistent, if a test crashes or not it will produce the same results.
> > 
> > Signed-off-by: Dylan Baker <dylan.c.ba...@intel.com>
> > ---
> >  framework/results.py | 7 ++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/framework/results.py b/framework/results.py
> > index 99dd3735b..4c7266208 100644
> > --- a/framework/results.py
> > +++ b/framework/results.py
> > @@ -329,7 +329,12 @@ class TestrunResult(object):
> >  for name, result in six.iteritems(self.tests):
> >  # If there are subtests treat the test as if it is a group 
> > instead
> >  # of a test.
> > -if result.subtests:
> > +# FIXME: If there overall test crashed, then don't treat it as 
> > a
> > +# group, ignore all of the subtests and report that the test 
> > was
> > +# crash. This is just papering over the fact that the binaries
> > +# don't inform the python layer how many subtests (and the 
> > names)
> > +# of the subtests it wants to run.
> > +if result.subtests and result.result == 
> > max(six.itervalues(result.subtests)):
> >  for res in six.itervalues(result.subtests):
> >  res = str(res)
> >  temp = name
> > -- 
> > 2.15.1
> > 
> > ___
> > Piglit mailing list
> > Piglit@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/piglit

-- 
Jan Vesely <jan.ves...@rutgers.edu>

signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cl: Add test for MUBUF access with a negative vaddr

2018-01-18 Thread Jan Vesely
On Tue, 2017-11-28 at 14:20 -0800, Matt Arsenault wrote:
> Explanation in test comment.
> ---
>  .../program/execute/amdgcn-mubuf-negative-vaddr.cl | 62 
> ++
>  1 file changed, 62 insertions(+)
>  create mode 100644 tests/cl/program/execute/amdgcn-mubuf-negative-vaddr.cl
> 
> diff --git a/tests/cl/program/execute/amdgcn-mubuf-negative-vaddr.cl 
> b/tests/cl/program/execute/amdgcn-mubuf-negative-vaddr.cl
> new file mode 100644
> index 0..21f11bf66
> --- /dev/null
> +++ b/tests/cl/program/execute/amdgcn-mubuf-negative-vaddr.cl
> @@ -0,0 +1,62 @@
> +>/*!
> +
> +[config]
> +name: MUBUF stack addressing behavior
> +clc_version_min: 10
> +
> +[test]
> +name: MUBUF negative buffer offsets
> +kernel_name: negative_mubuf_vaddr
> +dimensions: 1
> +global_size: 16 0 0
> +
> +arg_out: 0 buffer int[16]\
> +  5 5 5 5 \
> +  5 5 5 5 \
> +  5 5 5 5 \
> +  5 5 5 5
> +
> +!*/
> +
> +// Prior to gfx9, MUBUF instructions with the vaddr offset enabled
> +// would always perform a range check. If a negative vaddr base index
> +// was used, this would fail the range check. The overall address
> +// computation would compute a valid address, but this doesn't happen
> +// due to the range check. For out-of-bounds MUBUF loads, a 0 is
> +// returned.
> +//
> +// Therefore it should be safe to fold any VGPR offset on gfx9 into
> +// the MUBUF vaddr, but not on older subtargets which can only do this
> +// if the sign bit is known 0.
> +kernel void negative_mubuf_vaddr(global int* out0)
> +{
> +volatile int array[16];
> +
> +int id = get_global_id(0);
> +for (int i = 0; i < 16; ++i)
> +{
> +array[i] = i + 1;
> +}
> +
> +// Directly addressing the same buffer address works without using vaddr:
> +//
> +// buffer_load_dword v2, off, s[0:3], s11 offset:20
> +// out0[id] = array[4];
> +
> +
> +// But having a negative computed base index would fail:
> +// v_mov_b32_e32 v0, -8
> +// v_lshlrev_b32_e32 v0, 2, v0
> +// v_add_i32_e32 v0, vcc, 4, v0
> +// buffer_load_dword v2, v0, s[0:3], s11 offen offset:48
> +
> +#ifdef __AMDGCN__
> +// Obscure the value so it can't be folded with other constant or
> +// make known bits assumptions.
> +int offset;
> +__asm volatile("v_mov_b32 %0, -8" : "=v"(offset));

Why is this necessary? can't you just pass the offset argument as a
kernel input?

Jan

> +#else
> +int offset = -8;
> +#endif
> +out0[id] = array[offset + 12];
> +}


signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cl: Add tests for load lo16 instructions

2017-11-15 Thread Jan Vesely
On Tue, 2017-11-14 at 00:58 -0800, Matt Arsenault wrote:
> ping

Reviewed-by: Jan Vesely <jan.ves...@rutgers.edu>

I've fixed few whitespace errors locally, and I will push this by the
end of the week.

Jan

> 
> > On Oct 27, 2017, at 03:02, Matt Arsenault <arse...@gmail.com> wrote:
> > 
> > ---
> > tests/cl/program/execute/load-lo16-generic.cl |  90 +
> > tests/cl/program/execute/load-lo16.cl | 275 
> > ++
> > 2 files changed, 365 insertions(+)
> > create mode 100644 tests/cl/program/execute/load-lo16-generic.cl
> > create mode 100644 tests/cl/program/execute/load-lo16.cl
> > 
> > diff --git a/tests/cl/program/execute/load-lo16-generic.cl 
> > b/tests/cl/program/execute/load-lo16-generic.cl
> > new file mode 100644
> > index 0..62660c629
> > --- /dev/null
> > +++ b/tests/cl/program/execute/load-lo16-generic.cl
> > @@ -0,0 +1,90 @@
> > +/*!
> > +
> > +[config]
> > +name: load into low 16-bits of 32-bit register with generic addressing
> > +clc_version_min: 20
> > +dimensions: 1
> > +
> > +[test]
> > +  name: load lo16 generic
> > +  kernel_name: load_lo16_generic
> > +  global_size: 4 0 0
> > +  local_size: 4 0 0
> > +
> > +  arg_out: 0 buffer uint[4] \
> > +  0xabcd  0x1234  0x 0xdeadbeef
> > +
> > +  arg_in: 1 buffer uint[4] \
> > +  0xabcdf00f   0x1234f00f   0xf00f  0xdeadf00f
> > +
> > +  arg_in: 2 buffer ushort[4] \
> > +  0x   0x   0x  0xbeef
> > +
> > +[test]
> > +  name: zextloadi8 lo16 generic
> > +  kernel_name: zextloadi8_lo16_generic
> > +  global_size: 4 0 0
> > +  local_size: 4 0 0
> > +
> > +arg_out: 0 buffer uint[4] \
> > +  0x00ab0099  0x00120033  0x00110044 0x00de00be
> > +
> > +arg_in: 1 buffer uint[4] \
> > +  0x00abf00f   0x0012f00f   0x0011f00f  0x00def00f
> > +
> > +arg_in: 2 buffer uchar[4] \
> > +  0x99   0x33   0x44  0xbe
> > +
> > +
> > +[test]
> > +  name: sextloadi8 lo16 generic
> > +  kernel_name: sextloadi8_lo16_generic
> > +  global_size: 4 0 0
> > +  local_size: 4 0 0
> > +
> > +arg_out: 0 buffer uint[4] \
> > +  0x0099ffab  0x00330012  0x00440011 0x00beffde
> > +
> > +arg_in: 1 buffer uint[4] \
> > +  0x0099f00f   0x0033f00f   0x0044f00f  0x00bef00f
> > +
> > +arg_in: 2 buffer char[4] \
> > +  0xab   0x12   0x11  0xde
> > +
> > +!*/
> > +
> > +kernel void load_lo16_generic(volatile global uint* out,
> > +  volatile global uint* in0,
> > +  volatile global ushort* in1)
> > +{
> > +volatile generic uint* generic_in0 = (volatile generic uint*)in0;
> > +volatile generic ushort* generic_in1 = (volatile generic ushort*)in1;
> > +int gid = get_global_id(0);
> > +ushort2 val = as_ushort2(in0[gid]);
> > +val.lo = generic_in1[gid];
> > +out[gid] = as_uint(val);
> > +}
> > +
> > +kernel void zextloadi8_lo16_generic(volatile global uint* out,
> > +volatile global uint* in0,
> > +volatile global uchar* in1)
> > +{
> > +volatile generic uint* generic_in0 = (volatile generic uint*)in0;
> > +volatile generic uchar* generic_in1 = (volatile generic uchar*)in1;
> > +int gid = get_global_id(0);
> > +ushort2 val = as_ushort2(in0[gid]);
> > +val.lo = (ushort)generic_in1[gid];
> > +out[gid] = as_uint(val);
> > +}
> > +
> > +kernel void sextloadi8_lo16_generic(volatile global uint* out,
> > +volatile global uint* in0,
> > +volatile global char* in1)
> > +{
> > +volatile generic uint* generic_in0 = (volatile generic uint*)in0;
> > +volatile generic char* generic_in1 = (volatile generic char*)in1;
> > +int gid = get_global_id(0);
> > +short2 val = as_short2(in0[gid]);
> > +val.lo = (short)generic_in1[gid];
> > +out[gid] = as_uint(val);
> > +}
> > diff --git a/tests/cl/program/execute/load-lo16.cl 
> > b/tests/cl/program/execute/load-lo16.cl
> > new file mode 100644
> > index 0..f8bf2c2f6
> > --- /dev/null
> > +++ b/tests/cl/program/execute/load-lo16.cl
> > @@ -0,0 +1,275 @@
> > +/*!
> > +
> > +[config]
> > +  name: load into low 16-bits of 32-bit register
> > +  clc_version_min: 10
> > +  d

[Piglit] [PATCH 5/7] cl: Adjust sincos expected values to account for fp32 rounding

2017-11-03 Thread Jan Vesely
Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
 generated_tests/gen_cl_math_builtins.py | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/generated_tests/gen_cl_math_builtins.py 
b/generated_tests/gen_cl_math_builtins.py
index bd1a859b7..149322ca6 100644
--- a/generated_tests/gen_cl_math_builtins.py
+++ b/generated_tests/gen_cl_math_builtins.py
@@ -674,8 +674,10 @@ tests = {
 'arg_types' : [F, F, F],
 'function_type': 'ttt',
 'values' : [
-[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")], # 
Result0
-[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")], # 
Result1
+[0.0, 1.0,   sin(M_PI_F), -1.0,   sin(2 * M_PI_F),
sin(2.234567), sin(7), sin(8), sin(pow(2,20)), sin(pow(2,24)), sin(pow(2,120)), 
float("nan")], # Result0
+# using libm cosf(3.0f * M_PI / 2.0f) == 0x1.99bc5cp-27
+# this is different form what python gives us
+[1.0, cos(M_PI_F / 2),-1.0, float.fromhex('0x1.99bc5cp-27'),   
 1.0,cos(2.234567), cos(7), cos(8), cos(pow(2,20)), cos(pow(2,24)), 
cos(pow(2,120)), float("nan")], # Result1
 [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': 4,
-- 
2.13.6

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


[Piglit] [PATCH 7/7] cl: Fix sinpi expected values

2017-11-03 Thread Jan Vesely
account for fp32 rounding.
sinpi(n) should return 0 for any integer n

Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
 generated_tests/gen_cl_math_builtins.py | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/generated_tests/gen_cl_math_builtins.py 
b/generated_tests/gen_cl_math_builtins.py
index a4cae5314..98950c3ac 100644
--- a/generated_tests/gen_cl_math_builtins.py
+++ b/generated_tests/gen_cl_math_builtins.py
@@ -696,12 +696,11 @@ 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), 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, 0.0, sin(pi*pi/2), sin(pi*3*pi/2), sin(2* M_PI_F * pi),
+ sin(pi*1.12345), 0.0, 0.0, 0.0, 0.0, 0.0, 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
+ 1.12345, 7.0, 8.0, pow(2,20), pow(2,24), pow(2,120),
+ float("nan")] #Arg0
 ],
 'tolerance' : 4
 },
-- 
2.13.6

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


[Piglit] [PATCH 3/7] cl: Adjust tanpi epxected results to account for fp32 rounding

2017-11-03 Thread Jan Vesely
Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
 generated_tests/gen_cl_math_builtins.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/generated_tests/gen_cl_math_builtins.py 
b/generated_tests/gen_cl_math_builtins.py
index 5bbc72a0a..e6abbf50a 100644
--- a/generated_tests/gen_cl_math_builtins.py
+++ b/generated_tests/gen_cl_math_builtins.py
@@ -734,8 +734,9 @@ tests = {
 'arg_types': [F, F],
 'function_type': 'ttt',
 'values': [
-[0.0, 1.0,  0.0, sqrt(3), -1.0,   tan(pi * 2.234567), float("nan") 
], # Result
-[0.0, 1/4, 1,  1/3,3/4, 2.234567 , float("nan") ], # Arg1
+#fp32 representation of 2.234567 is 0x1.1e064ap+1
+[0.0, 1.0,  0.0, sqrt(3), -1.0,   tan(M_PI_F * 
float.fromhex('0x1.1e064ap+1')), float("nan") ], # Result
+[0.0, 1/4, 1,  1/3,3/4, 2.234567, float("nan") ], # Arg1
 ],
 'tolerance': 6
 },
-- 
2.13.6

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


[Piglit] [PATCH 2/7] cl: Adjust tan expected values to account for fp32 rounding

2017-11-03 Thread Jan Vesely
Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
 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 726ac9652..5bbc72a0a 100644
--- a/generated_tests/gen_cl_math_builtins.py
+++ b/generated_tests/gen_cl_math_builtins.py
@@ -716,8 +716,8 @@ tests = {
 '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
+[0.0, 1.0,  tan(M_PI_F), sqrt(3), -1.0,   tan(2.234567), 
float("nan") ], # Result
+[0.0, pi/4, M_PI_F,  pi/3,3*pi/4, 2.234567 , float("nan") 
], # Arg1
 ],
 'tolerance': 5
 },
-- 
2.13.6

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


[Piglit] [PATCH 6/7] cl: Adjust cospi expected values to account for fp32 rounding

2017-11-03 Thread Jan Vesely
Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
 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 149322ca6..a4cae5314 100644
--- a/generated_tests/gen_cl_math_builtins.py
+++ b/generated_tests/gen_cl_math_builtins.py
@@ -271,7 +271,7 @@ 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), 
cos(pi*pow(2,20)), cos(pi*pow(2,24)), 1.0, float("nan")], # Result
+[1.0, cos(pi * M_PI_F / 2), cos(pi*3*pi/2), cos(2 * M_PI_F * pi), 
cos(pi*1.12345), cos(pi*pow(2,20)), cos(pi*pow(2,24)), 1.0, 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
-- 
2.13.6

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


[Piglit] [PATCH 1/7] cl: Adjust cos test expected values to account for fp32 rounding

2017-11-03 Thread Jan Vesely
using libm cosf(3.0f * M_PI / 2.0f) == 0x1.99bc5cp-27

Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
 generated_tests/gen_cl_math_builtins.py | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/generated_tests/gen_cl_math_builtins.py 
b/generated_tests/gen_cl_math_builtins.py
index 47a1a1eb5..726ac9652 100644
--- a/generated_tests/gen_cl_math_builtins.py
+++ b/generated_tests/gen_cl_math_builtins.py
@@ -114,6 +114,8 @@ U = {
 'float' : 'uint'
 }
 
+M_PI_F = float.fromhex('0x1.921fb6p+1')
+
 def quo(x, y):
 return int(round(x/y))
 
@@ -249,8 +251,10 @@ tests = {
 'arg_types' : [F, F],
 'function_type': 'ttt',
 'values' : [
-[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
+# using libm cosf(3.0f * M_PI / 2.0f) == 0x1.99bc5cp-27
+# this is different form what python gives us
+[1.0, cos(M_PI_F / 2),-1.0, float.fromhex('0x1.99bc5cp-27'),   
 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, M_PI_F / 2, pi,   3 * M_PI_F / 2, 2 * pi, 1.12345, 7, 8, 
pow(2,20), pow(2,24), pow(2,120), float("nan")] # Arg0
 ],
 'tolerance' : 4
 },
-- 
2.13.6

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


[Piglit] [PATCH 4/7] cl: Adjust sin expected values to acount for fp32 rounding

2017-11-03 Thread Jan Vesely
Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
 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 e6abbf50a..bd1a859b7 100644
--- a/generated_tests/gen_cl_math_builtins.py
+++ b/generated_tests/gen_cl_math_builtins.py
@@ -665,7 +665,7 @@ tests = {
 'arg_types' : [F, F],
 'function_type': 'ttt',
 'values' : [
-[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, 1.0,   sin(M_PI_F), -1.0,   sin(2 * M_PI_F),
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': 4
-- 
2.13.6

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


[Piglit] [PATCH v3 1/2] cl: Generate aligned vstorea tests

2017-10-22 Thread Jan Vesely
From: Jan Vesely <jan.ves...@rutgers.edu>

Add type3 vectors and bump required CLC to 1.1.
Simplify test to use only 1-2 vstore calls.
Zero the output buffer (fixes undefined values in results of some vstore
tests).

v2: Add canary after the written values
v3: Fixup canary

Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
 generated_tests/gen_cl_vstore_tests.py | 147 -
 1 file changed, 90 insertions(+), 57 deletions(-)

diff --git a/generated_tests/gen_cl_vstore_tests.py 
b/generated_tests/gen_cl_vstore_tests.py
index 93038aded..724f7a2b2 100644
--- a/generated_tests/gen_cl_vstore_tests.py
+++ b/generated_tests/gen_cl_vstore_tests.py
@@ -29,7 +29,7 @@ from six.moves import range
 from modules import utils
 
 TYPES = ['char', 'uchar', 'short', 'ushort', 'int', 'uint', 'long', 'ulong', 
'half', 'float', 'double']
-VEC_SIZES = ['2', '4', '8', '16']
+VEC_SIZES = ['2', '3', '4', '8', '16']
 
 DIR_NAME = os.path.join("cl", "vstore")
 
@@ -47,15 +47,15 @@ def ext_req(type_name):
 return ""
 
 
-def begin_test(suffix, type_name, mem_type, vec_sizes, addr_space):
+def begin_test(suffix, type_name, mem_type, vec_sizes, addr_space, aligned):
 file_name = os.path.join(DIR_NAME, "vstore{}-{}-{}.cl".format(suffix, 
type_name, addr_space))
 print(file_name)
 f = open(file_name, 'w')
 f.write(textwrap.dedent(("""\
 /*!
 [config]
-name: Vector store{suffix} {addr_space} {type_name}2,4,8,16
-clc_version_min: 10
+name: Vector store{suffix} {addr_space} {type_name}2,3,4,8,16
+clc_version_min: 11
 
 dimensions: 1
 global_size: 1 0 0
@@ -63,22 +63,34 @@ def begin_test(suffix, type_name, mem_type, vec_sizes, 
addr_space):
 .format(type_name=type_name, addr_space=addr_space, suffix=suffix)))
 for s in vec_sizes:
 size = int(s) if s != '' else 1
+modsize = 4 if size == 3 and aligned else size
+offset = modsize if aligned else 1
+canary= '0xdeadp1' if type_name in ('float', 'double') else '0xdead'
+
 ty_name = type_name + s
 f.write(textwrap.dedent("""
 [test]
 name: vector store{suffix} {addr_space} {type_name}
 kernel_name: vstore{suffix}{n}_{addr_space}
-arg_out: 0 buffer {mem_type}[{size}] 0 {gen_array}
+arg_out: 0 buffer {mem_type}[{size}] {offset_zeros}{gen_array} {canary}
+arg_in: 0 buffer {mem_type}[{size}] {offset_size_zeros} {canary}
 arg_in:  1 buffer {type_name}[1] {gen_array}
 
 [test]
 name: vector store{suffix} {addr_space} offset {type_name}
 kernel_name: vstore{suffix}{n}_{addr_space}_offset
-arg_out: 0 buffer {mem_type}[{offset_size}] {zeros} {gen_array}
-arg_in:  1 buffer {type_name}[1] {gen_array}
-""".format(type_name=ty_name, mem_type=mem_type, size=size + 1,
-   zeros=("0 " * (size + 1)), offset_size=size * 2 + 1, n=s,
-   gen_array=gen_array(size), suffix=suffix, 
addr_space=addr_space)))
+arg_out: 0 buffer {mem_type}[{offset_size}] {offset_zeros} {gen_array} 
{padd_zeros} {gen_array} {canary}
+arg_in: 0 buffer {mem_type}[{offset_size}] {offset_modsize_size_zeros} 
{canary}
+arg_in: 1 buffer {type_name}[1] {gen_array}
+""".format(type_name=ty_name, mem_type=mem_type, size=size + offset + 
1,
+   offset_zeros = ("0 " * offset),
+   offset_size_zeros = ("0 " * (offset + size)),
+   padd_zeros = ("0 " * (modsize - size)),
+   offset_modsize_size_zeros = ("0 " * (modsize + size + 
offset)),
+   offset_size=modsize + size + offset + 1, n=s,
+   gen_array=gen_array(size),
+   suffix=suffix, addr_space=addr_space,
+   canary=canary)))
 
 f.write(textwrap.dedent("""
 !*/
@@ -94,124 +106,145 @@ def begin_test(suffix, type_name, mem_type, vec_sizes, 
addr_space):
 return f
 
 
-def gen_test_global(suffix, t, mem_type, vec_sizes):
-f = begin_test(suffix, t, mem_type, vec_sizes, 'global')
+def gen_test_global(suffix, t, mem_type, vec_sizes, aligned):
+f = begin_test(suffix, t, mem_type, vec_sizes, 'global', aligned)
 for s in vec_sizes:
+offset = int(s) if aligned else 1
+offset = 4 if offset == 3 else offset
+
 type_name = t + s
 f.write(textwrap.dedent("""
 kernel void vstore{suffix}{n}_global(global {mem_type} *out,
  global {type_name} *in) {{
 {type_name} tmp = in[0];
-vstore{suffix}{n}(({type_name})0, 0, out);
-vstore{suffix}{n}(tmp, 0, out + 1);
+vstore{suffix}{n}(tmp, 0, out + {offset});
 }}
 
 kernel void vstore{suffix}{n}_gl

[Piglit] [PATCH 1/2] cl: Fix erf test

2017-10-22 Thread Jan Vesely
In python:
>>> math.erf(11.1)
1.0

Signed-off-by: Jan Vesely <jano.ves...@gmail.com>
---
These are straightforward fixes. I plan to push them I few days unless there 
are objections.

 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 7f67b7b17..38d36a302 100644
--- a/generated_tests/gen_cl_math_builtins.py
+++ b/generated_tests/gen_cl_math_builtins.py
@@ -276,7 +276,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.0, 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.13.6

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


[Piglit] [PATCH 2/2] cl: Fix erfc test

2017-10-22 Thread Jan Vesely
python:
>>> math.erfc(1.960/math.sqrt(2.0)).hex()
'0x1.9990c58859300p-5'
float rtne rounds up to 0x1.9990c6p-5

>>> math.erfc(2.576/math.sqrt(2.0)).hex()
'0x1.4784addb5643fp-7'
float rtne rounds up to 0x1.4784aep-7

Signed-off-by: Jan Vesely <jano.ves...@gmail.com>
---
 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 38d36a302..47a1a1eb5 100644
--- a/generated_tests/gen_cl_math_builtins.py
+++ b/generated_tests/gen_cl_math_builtins.py
@@ -285,7 +285,7 @@ tests = {
 'arg_types' : [F, F],
 'function_type': 'ttt',
 'values' : [
-[1.0, 0.95, 0.009995, 1.994999, 0.0, 0.0, 2.0], # Result
+[1.0, float.fromhex('0x1.9990c6p-5'), 
float.fromhex('0x1.4784aep-7'), 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.13.6

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


Re: [Piglit] [PATCH] cl: Add tests for store hi16 instructions

2017-10-06 Thread Jan Vesely
On Mon, 2017-10-02 at 10:32 -0700, Matt Arsenault wrote:
> ping

Reviewed-by: Jan Vesely <jan.ves...@rutgers.edu>

Jan

> 
> > On Sep 19, 2017, at 19:51, Matt Arsenault <arse...@gmail.com> wrote:
> > 
> > ---
> > tests/cl/program/execute/store-hi16-generic.cl |  51 ++
> > tests/cl/program/execute/store-hi16.cl | 134 
> > +
> > 2 files changed, 185 insertions(+)
> > create mode 100644 tests/cl/program/execute/store-hi16-generic.cl
> > create mode 100644 tests/cl/program/execute/store-hi16.cl
> > 
> > diff --git a/tests/cl/program/execute/store-hi16-generic.cl 
> > b/tests/cl/program/execute/store-hi16-generic.cl
> > new file mode 100644
> > index 0..807818971
> > --- /dev/null
> > +++ b/tests/cl/program/execute/store-hi16-generic.cl
> > @@ -0,0 +1,51 @@
> > +/*!
> > +
> > +[config]
> > +name: store high 16-bits of 32-bit value with generic addressing
> > +clc_version_min: 20
> > +dimensions: 1
> > +
> > +[test]
> > +name: store hi16 generic
> > +kernel_name: store_hi16_generic
> > +global_size: 4 0 0
> > +local_size: 4 0 0
> > +
> > +arg_out: 0 buffer ushort[4] \
> > +0xabcd0x   0x 0x
> > +
> > +arg_in: 1 buffer uint[4] \
> > +   0xabcd12340x0x0x
> > +
> > +
> > +[test]
> > +name: store hi16 generic trunc i8
> > +kernel_name: truncstorei8_hi16_generic
> > +global_size: 4 0 0
> > +local_size: 4 0 0
> > +
> > +arg_out: 0 buffer uchar[4] \
> > +  0xcd 0x22 0xad 0x80
> > +
> > +arg_in: 1 buffer uint[4] \
> > +   0xabcd12340x112233440xdeadbeef  0x70809024
> > +
> > +!*/
> > +
> > +kernel void store_hi16_generic(volatile global ushort* out, volatile 
> > global uint* in)
> > +{
> > +int gid = get_global_id(0);
> > +uint value = in[gid];
> > +
> > +volatile generic ushort* generic_out = (volatile generic ushort*)out;
> > +generic_out[gid] = value >> 16;
> > +}
> > +
> > +kernel void truncstorei8_hi16_generic(volatile global uchar* out, volatile 
> > global uint* in)
> > +{
> > +int gid = get_global_id(0);
> > +uint value = in[gid];
> > +
> > +volatile generic uchar* generic_out = (volatile generic ushort*)out;
> > +generic_out[gid] = (uchar)(value >> 16);
> > +}
> > diff --git a/tests/cl/program/execute/store-hi16.cl 
> > b/tests/cl/program/execute/store-hi16.cl
> > new file mode 100644
> > index 0..b734b3766
> > --- /dev/null
> > +++ b/tests/cl/program/execute/store-hi16.cl
> > @@ -0,0 +1,134 @@
> > +/*!
> > +
> > +[config]
> > +name: store high 16-bits of 32-bit value
> > +clc_version_min: 10
> > +
> > +dimensions: 1
> > +
> > +[test]
> > +name: store hi16 global
> > +kernel_name: store_hi16_global
> > +global_size: 4 0 0
> > +local_size: 4 0 0
> > +
> > +arg_out: 0 buffer ushort[4] \
> > +0xabcd0x   0x 0x
> > +
> > +arg_in: 1 buffer uint[4] \
> > +   0xabcd12340x0x0x
> > +
> > +[test]
> > +name: store hi16 local
> > +kernel_name: store_hi16_local
> > +global_size: 4 0 0
> > +local_size: 4 0 0
> > +
> > +arg_out: 0 buffer ushort[4] \
> > +  0xabcd0x   0x 0x
> > +
> > +arg_in: 1 buffer uint[4] \
> > +   0xabcd12340x0x0x
> > +
> > +[test]
> > +name: store hi16 private
> > +kernel_name: store_hi16_private
> > +global_size: 4 0 0
> > +local_size: 4 0 0
> > +
> > +arg_out: 0 buffer ushort[4] \
> > +  0xabcd0x   0x 0x
> > +
> > +arg_in: 1 buffer uint[4] \
> > +   0xabcd12340x0x0x
> > +
> > +
> > +[test]
> > +name: store hi16 global trunc i8
> > +kernel_name: truncstorei8_hi16_global
> > +global_size: 4 0 0
> > +local_size: 4 0 0
> > +
> > +arg_out: 0 buffer uchar[4] \
> > +  0xcd 0x22 0xad 0x80
> > +
> > +arg_in: 1 buffer uint[4] \
> > +   0xabcd12340x112233440xdeadbeef  0x70809024
> > +
> > +
> > +[test]
> > +name: store hi16 local trunc i8
> > +kernel_name: truncstorei8_hi16_local
> > +global_size: 4 0 0
> > +local_size: 4 0 0
> > +
> > +arg_out: 0 buffer uchar[4] \
> > +  0xcd 0x22 0xad 0x80
> > +
> > +arg_in:

Re: [Piglit] [PATCH] cl: Add tests for load hi16 instructions

2017-10-06 Thread Jan Vesely
On Tue, 2017-09-19 at 22:02 -0700, Matt Arsenault wrote:
> v2: Fix some formatting

Reviewed-by: Jan Vesely <jan.ves...@rutgers.edu>

sorry for the delay, feel free to cc me on cl piglit patches. I don't
think anyone else is interested in piglit cl.
Are these targeting specific gcn instructions as well?

Jan

> ---
>  tests/cl/program/execute/load-hi16-generic.cl |  96 +
>  tests/cl/program/execute/load-hi16.cl | 280 
> ++
>  2 files changed, 376 insertions(+)
>  create mode 100644 tests/cl/program/execute/load-hi16-generic.cl
>  create mode 100644 tests/cl/program/execute/load-hi16.cl
> 
> diff --git a/tests/cl/program/execute/load-hi16-generic.cl 
> b/tests/cl/program/execute/load-hi16-generic.cl
> new file mode 100644
> index 0..ac1cb7a4d
> --- /dev/null
> +++ b/tests/cl/program/execute/load-hi16-generic.cl
> @@ -0,0 +1,96 @@
> +/*!
> +
> +[config]
> +name: load into high 16-bits of 32-bit register with generic addressing
> +clc_version_min: 20
> +dimensions: 1
> +
> +[test]
> +name: load hi16 generic
> +kernel_name: load_hi16_generic
> +global_size: 4 0 0
> +local_size: 4 0 0
> +
> +arg_out: 0 buffer uint[4] \
> +  0xabcd  0x1234  0x 0xdeadbeef
> +
> +arg_in: 1 buffer ushort[4] \
> +   0x   0x   0x  0xbeef
> +
> +arg_in: 2 buffer ushort[4] \
> +   0xabcd   0x1234   0x  0xdead
> +
> +
> +[test]
> +name: zextloadi8 hi16 generic
> +kernel_name: zextloadi8_hi16_generic
> +global_size: 4 0 0
> +local_size: 4 0 0
> +
> +arg_out: 0 buffer uint[4] \
> +  0x00ab0099  0x00120033  0x00110044 0x00de00be
> +
> +arg_in: 1 buffer uchar[4] \
> +   0x99   0x33   0x44  0xbe
> +
> +arg_in: 2 buffer uchar[4] \
> +   0xab   0x12   0x11  0xde
> +
> +
> +[test]
> +name: sextloadi8 hi16 generic
> +kernel_name: sextloadi8_hi16_generic
> +global_size: 4 0 0
> +local_size: 4 0 0
> +
> +arg_out: 0 buffer uint[4] \
> +  0xffabff99  0x00120033  0x00110044 0xffdeffbe
> +
> +arg_in: 1 buffer char[4] \
> +   0x99   0x33   0x44  0xbe
> +
> +arg_in: 2 buffer char[4] \
> +   0xab   0x12   0x11  0xde
> +
> +!*/
> +
> +kernel void load_hi16_generic(volatile global uint* out,
> +  volatile global ushort* in0,
> +  volatile global ushort* in1)
> +{
> +volatile generic ushort* generic_in0 = (volatile generic ushort*)in0;
> +volatile generic ushort* generic_in1 = (volatile generic ushort*)in1;
> +int gid = get_global_id(0);
> +ushort lo = generic_in0[gid];
> +ushort hi = generic_in1[gid];
> +ushort2 vec = { lo, hi };
> +out[gid] = as_uint(vec);
> +}
> +
> +kernel void zextloadi8_hi16_generic(volatile global uint* out,
> +volatile global uchar* in0,
> +volatile global uchar* in1)
> +{
> +volatile generic uchar* generic_in0 = (volatile generic uchar*)in0;
> +volatile generic uchar* generic_in1 = (volatile generic uchar*)in1;
> +
> +int gid = get_global_id(0);
> +ushort lo = (ushort)generic_in0[gid];
> +ushort hi = (ushort)generic_in1[gid];
> +ushort2 vec = { lo, hi };
> +out[gid] = as_uint(vec);
> +}
> +
> +kernel void sextloadi8_hi16_generic(volatile global uint* out,
> +volatile global char* in0,
> +volatile global char* in1)
> +{
> +volatile generic char* generic_in0 = (volatile generic char*)in0;
> +volatile generic char* generic_in1 = (volatile generic char*)in1;
> +
> +int gid = get_global_id(0);
> +short lo = (short)generic_in0[gid];
> +short hi = (short)generic_in1[gid];
> +short2 vec = { lo, hi };
> +out[gid] = as_uint(vec);
> +}
> diff --git a/tests/cl/program/execute/load-hi16.cl 
> b/tests/cl/program/execute/load-hi16.cl
> new file mode 100644
> index 0..f57e0e886
> --- /dev/null
> +++ b/tests/cl/program/execute/load-hi16.cl
> @@ -0,0 +1,280 @@
> +/*!
> +
> +[config]
> +  name: load into high 16-bits of 32-bit register
> +  clc_version_min: 10
> +  dimensions: 1
> +
> +[test]
> +  name: load hi16 global
> +  kernel_name: load_hi16_global
> +  global_size: 4 0 0
> +  local_size: 4 0 0
> +
> +  arg_out: 0 buffer uint[4] \
> +  0xabcd  0x1234  0x 0xdeadbeef
> +
> +  arg_in: 1 buffer ushort[4] \
> +  0x   0x   0x  0xbeef
> +
> +  arg_in: 2 buffer ushort[4] \
> +  0xabcd   0x1234   0x  0xdead
> +
> +
> +[test]
> +  name: load hi16 local
> +  kernel_name: load_hi16_local
> +  global_size: 4 0 0
&

Re: [Piglit] [PATCH v2 1/2] cl: Generate aligned vstorea tests

2017-10-05 Thread Jan Vesely
On Thu, 2017-10-05 at 11:51 -0400, Jan Vesely wrote:
> Add type3 vectors and bump required CLC to 1.1.
> Simplify test to use only 1-2 vstore calls.
> Zero the output buffer (fixes undefined values in results of some vstore
> tests).
> 
> v2: Add canary after the written values
> 
> Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>

Hi Dylan,

do you mind taking a cursory look at the python changes when you get
time?

Jan

> ---
>  generated_tests/gen_cl_vstore_tests.py | 142 
> -
>  1 file changed, 86 insertions(+), 56 deletions(-)
> 
> diff --git a/generated_tests/gen_cl_vstore_tests.py 
> b/generated_tests/gen_cl_vstore_tests.py
> index 93038aded..22b64d94b 100644
> --- a/generated_tests/gen_cl_vstore_tests.py
> +++ b/generated_tests/gen_cl_vstore_tests.py
> @@ -29,7 +29,7 @@ from six.moves import range
>  from modules import utils
>  
>  TYPES = ['char', 'uchar', 'short', 'ushort', 'int', 'uint', 'long', 'ulong', 
> 'half', 'float', 'double']
> -VEC_SIZES = ['2', '4', '8', '16']
> +VEC_SIZES = ['2', '3', '4', '8', '16']
>  
>  DIR_NAME = os.path.join("cl", "vstore")
>  
> @@ -47,15 +47,15 @@ def ext_req(type_name):
>  return ""
>  
>  
> -def begin_test(suffix, type_name, mem_type, vec_sizes, addr_space):
> +def begin_test(suffix, type_name, mem_type, vec_sizes, addr_space, aligned):
>  file_name = os.path.join(DIR_NAME, "vstore{}-{}-{}.cl".format(suffix, 
> type_name, addr_space))
>  print(file_name)
>  f = open(file_name, 'w')
>  f.write(textwrap.dedent(("""\
>  /*!
>  [config]
> -name: Vector store{suffix} {addr_space} {type_name}2,4,8,16
> -clc_version_min: 10
> +name: Vector store{suffix} {addr_space} {type_name}2,3,4,8,16
> +clc_version_min: 11
>  
>  dimensions: 1
>  global_size: 1 0 0
> @@ -63,21 +63,30 @@ def begin_test(suffix, type_name, mem_type, vec_sizes, 
> addr_space):
>  .format(type_name=type_name, addr_space=addr_space, suffix=suffix)))
>  for s in vec_sizes:
>  size = int(s) if s != '' else 1
> +modsize = 4 if size == 3 and aligned else size
> +offset = modsize if aligned else 1
> +
>  ty_name = type_name + s
>  f.write(textwrap.dedent("""
>  [test]
>  name: vector store{suffix} {addr_space} {type_name}
>  kernel_name: vstore{suffix}{n}_{addr_space}
> -arg_out: 0 buffer {mem_type}[{size}] 0 {gen_array}
> +arg_out: 0 buffer {mem_type}[{size}] {offset_zeros}{gen_array} 
> 0x1.deadp0
> +arg_in: 0 buffer {mem_type}[{size}] {offset_size_zeros} 0x1.deadp0
>  arg_in:  1 buffer {type_name}[1] {gen_array}
>  
>  [test]
>  name: vector store{suffix} {addr_space} offset {type_name}
>  kernel_name: vstore{suffix}{n}_{addr_space}_offset
> -arg_out: 0 buffer {mem_type}[{offset_size}] {zeros} {gen_array}
> -arg_in:  1 buffer {type_name}[1] {gen_array}
> -""".format(type_name=ty_name, mem_type=mem_type, size=size + 1,
> -   zeros=("0 " * (size + 1)), offset_size=size * 2 + 1, n=s,
> +arg_out: 0 buffer {mem_type}[{offset_size}] {offset_zeros} 
> {gen_array} {padd_zeros} {gen_array} 0x1.deadp0
> +arg_in: 0 buffer {mem_type}[{offset_size}] 
> {offset_modsize_size_zeros} 0x1.deadp0
> +arg_in: 1 buffer {type_name}[1] {gen_array}
> +""".format(type_name=ty_name, mem_type=mem_type, size=size + offset 
> + 1,
> +   offset_zeros = ("0 " * offset),
> +   offset_size_zeros = ("0 " * (offset + size)),
> +   padd_zeros = ("0 " * (modsize - size)),
> +   offset_modsize_size_zeros = ("0 " * (modsize + size + 
> offset)),
> +   offset_size=modsize + size + offset + 1, n=s,
> gen_array=gen_array(size), suffix=suffix, 
> addr_space=addr_space)))
>  
>  f.write(textwrap.dedent("""
> @@ -94,124 +103,145 @@ def begin_test(suffix, type_name, mem_type, vec_sizes, 
> addr_space):
>  return f
>  
>  
> -def gen_test_global(suffix, t, mem_type, vec_sizes):
> -f = begin_test(suffix, t, mem_type, vec_sizes, 'global')
> +def gen_test_global(suffix, t, mem_type, vec_sizes, aligned):
> +f = begin_test(suffix, t, mem_type, vec_sizes, 'global', aligned)
>  for s in vec_sizes:
> +offset = int(s) if aligned else 1
> +offset = 4 if offset == 3 else offset
> +
>  type_name = t + s
>  f.write(textwrap.dedent(""

Re: [Piglit] [PATCH] cl: Add tests for mad mix

2017-10-05 Thread Jan Vesely
On Thu, 2017-10-05 at 12:17 -0700, Matt Arsenault wrote:
> > On Oct 5, 2017, at 08:09, Jan Vesely <jan.ves...@rutgers.edu> wrote:
> > 
> > On Mon, 2017-10-02 at 10:32 -0700, Matt Arsenault wrote:
> > > ping
> > > 
> > > > On Sep 19, 2017, at 19:25, Matt Arsenault <arse...@gmail.com> wrote:
> > > > 
> > > > These aren't great since they need more test
> > > > values, and generating half results is kind
> > > > of a pain from any other tool. The perfect
> > > > values used don't really stress the conversions,
> > > > but this as at least enough to make sure the
> > > > encoding is correct.
> > 
> > what is this test supposed to test? generic fp16 encoding
> > /functionality? if so, why is it better than vstore_half/vload_half
> > tests? 
> > does it test fp16 version of clamp? why is it better than generated
> > clamp tests?
> > 
> > Jan
> > 
> 
> It’s specifically testing v_mad_mix_f32, v_mad_mixlo_f16,
> v_mad_mixhi_f16 instructions added in gfx9

ah, that makes more sense. Do you mind if I add it to the commit
message? (I'll also fix the formatting nits) with that

Reviewed-by: Jan Vesely <jan.ves...@rutgers.edu>

out of curiosity what's the use of having these in piglit? supposedly
the instruction selection and encoding part is tested in llvm lit. Is
this testing whether the instruction works correctly? shouldn't the hw
design team have tests for that?

Jan

signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH v2 2/2] cl: Generate aligned vloada tests

2017-10-05 Thread Jan Vesely
Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
 generated_tests/gen_cl_vload_tests.py | 108 --
 1 file changed, 64 insertions(+), 44 deletions(-)

diff --git a/generated_tests/gen_cl_vload_tests.py 
b/generated_tests/gen_cl_vload_tests.py
index 64415c57f..46410904d 100644
--- a/generated_tests/gen_cl_vload_tests.py
+++ b/generated_tests/gen_cl_vload_tests.py
@@ -29,7 +29,7 @@ from six.moves import range
 from modules import utils
 
 TYPES = ['char', 'uchar', 'short', 'ushort', 'int', 'uint', 'long', 'ulong', 
'half', 'float', 'double']
-VEC_SIZES = ['2', '4', '8', '16']
+VEC_SIZES = ['2', '3', '4', '8', '16']
 
 DIR_NAME = os.path.join("cl", "vload")
 
@@ -47,15 +47,15 @@ def ext_req(type_name):
 return ""
 
 
-def begin_test(suffix, type_name, mem_type, vec_sizes, addr_space):
+def begin_test(suffix, type_name, mem_type, vec_sizes, addr_space, aligned):
 file_name = os.path.join(DIR_NAME, "vload{}-{}-{}.cl".format(suffix, 
type_name, addr_space))
 print(file_name)
 f = open(file_name, 'w')
 f.write(textwrap.dedent(("""\
 /*!
 [config]
-name: Vector load{suffix} {addr_space} {type_name}2,4,8,16
-clc_version_min: 10
+name: Vector load{suffix} {addr_space} {type_name}2,3,4,8,16
+clc_version_min: 11
 
 dimensions: 1
 global_size: 1 0 0
@@ -63,25 +63,30 @@ def begin_test(suffix, type_name, mem_type, vec_sizes, 
addr_space):
 .format(type_name=type_name, addr_space=addr_space, suffix=suffix)))
 for s in vec_sizes:
 size = int(s) if s != '' else 1
+modsize = 4 if (size == 3 and aligned) else size
+offset = modsize if aligned else 1
+outsize = size if aligned else 1
+
 data_array = gen_array(size)
 ty_name = type_name + s
 f.write(textwrap.dedent("""
 [test]
 name: vector load{suffix} {addr_space} {type_name}
 kernel_name: vload{suffix}{n}_{addr_space}
-arg_in:  0 buffer {mem_type}[{size}] 0 {gen_array}
+arg_in:  0 buffer {mem_type}[{size}] {zeros1}{gen_array}
 arg_out: 1 buffer {type_name}[2] {first_array} {gen_array}
 
 [test]
 name: vector load{suffix} {addr_space} offset {type_name}
 kernel_name: vload{suffix}{n}_{addr_space}_offset
-arg_in:  0 buffer {mem_type}[{offset_size}] {zeros}{gen_array}
+arg_in:  0 buffer {mem_type}[{offset_size}] {zeros2}{gen_array}
 arg_out: 1 buffer {type_name}[2] {first_array} {gen_array}
-""".format(type_name=ty_name, mem_type=mem_type, size=size + 1,
-   zeros=("0 " * (size + 1)), offset_size=size * 2 + 1, n=s,
+""".format(type_name=ty_name, mem_type=mem_type, size=size + offset,
+   zeros1 = ("0 " * offset), zeros2=("0 " * (modsize + 
offset)),
+   offset_size=size + modsize + offset, n=s,
gen_array=' '.join(data_array), suffix=suffix,
addr_space=addr_space,
-   first_array="0 " + ' '.join(data_array[:-1]
+   first_array=("0 " * outsize) + ' 
'.join(data_array[:-outsize]
 
 f.write(textwrap.dedent("""
 !*/
@@ -97,32 +102,38 @@ def begin_test(suffix, type_name, mem_type, vec_sizes, 
addr_space):
 return f
 
 
-def gen_test_constant_global(suffix, t, mem_type, vec_sizes, addr_space):
-f = begin_test(suffix, t, mem_type, vec_sizes, addr_space)
+def gen_test_constant_global(suffix, t, mem_type, vec_sizes, addr_space, 
aligned):
+f = begin_test(suffix, t, mem_type, vec_sizes, addr_space, aligned)
 for s in vec_sizes:
+offset = int(s) if aligned else 1
+offset = 4 if offset == 3 else offset
+
 type_name = t + s
 f.write(textwrap.dedent("""
 kernel void vload{suffix}{n}_{addr_space}({addr_space} {mem_type} *in,
  global {type_name} *out) {{
 out[0] = vload{suffix}{n}(0, in);
-out[1] = vload{suffix}{n}(0, in + 1);
+out[1] = vload{suffix}{n}(0, in + {offset});
 }}
 
 kernel void vload{suffix}{n}_{addr_space}_offset({addr_space} 
{mem_type} *in,
 global {type_name} *out) {{
 out[0] = vload{suffix}{n}(1, in);
-out[1] = vload{suffix}{n}(1, in + 1);
+out[1] = vload{suffix}{n}(1, in + {offset});
 }}
 """.format(type_name=type_name, mem_type=mem_type, n=s, suffix=suffix,
-   addr_space=addr_space)))
+   addr_space=addr_space, offset=offset)))
 
 f.close()
 
 
-def gen_test_local_private(suffix, t, mem_type, vec_sizes, addr_space):
-f = begin_test(suffix, t, mem_type, vec_sizes, addr_space)
+def gen_test_local_

[Piglit] [PATCH v2 1/2] cl: Generate aligned vstorea tests

2017-10-05 Thread Jan Vesely
Add type3 vectors and bump required CLC to 1.1.
Simplify test to use only 1-2 vstore calls.
Zero the output buffer (fixes undefined values in results of some vstore
tests).

v2: Add canary after the written values

Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
 generated_tests/gen_cl_vstore_tests.py | 142 -
 1 file changed, 86 insertions(+), 56 deletions(-)

diff --git a/generated_tests/gen_cl_vstore_tests.py 
b/generated_tests/gen_cl_vstore_tests.py
index 93038aded..22b64d94b 100644
--- a/generated_tests/gen_cl_vstore_tests.py
+++ b/generated_tests/gen_cl_vstore_tests.py
@@ -29,7 +29,7 @@ from six.moves import range
 from modules import utils
 
 TYPES = ['char', 'uchar', 'short', 'ushort', 'int', 'uint', 'long', 'ulong', 
'half', 'float', 'double']
-VEC_SIZES = ['2', '4', '8', '16']
+VEC_SIZES = ['2', '3', '4', '8', '16']
 
 DIR_NAME = os.path.join("cl", "vstore")
 
@@ -47,15 +47,15 @@ def ext_req(type_name):
 return ""
 
 
-def begin_test(suffix, type_name, mem_type, vec_sizes, addr_space):
+def begin_test(suffix, type_name, mem_type, vec_sizes, addr_space, aligned):
 file_name = os.path.join(DIR_NAME, "vstore{}-{}-{}.cl".format(suffix, 
type_name, addr_space))
 print(file_name)
 f = open(file_name, 'w')
 f.write(textwrap.dedent(("""\
 /*!
 [config]
-name: Vector store{suffix} {addr_space} {type_name}2,4,8,16
-clc_version_min: 10
+name: Vector store{suffix} {addr_space} {type_name}2,3,4,8,16
+clc_version_min: 11
 
 dimensions: 1
 global_size: 1 0 0
@@ -63,21 +63,30 @@ def begin_test(suffix, type_name, mem_type, vec_sizes, 
addr_space):
 .format(type_name=type_name, addr_space=addr_space, suffix=suffix)))
 for s in vec_sizes:
 size = int(s) if s != '' else 1
+modsize = 4 if size == 3 and aligned else size
+offset = modsize if aligned else 1
+
 ty_name = type_name + s
 f.write(textwrap.dedent("""
 [test]
 name: vector store{suffix} {addr_space} {type_name}
 kernel_name: vstore{suffix}{n}_{addr_space}
-arg_out: 0 buffer {mem_type}[{size}] 0 {gen_array}
+arg_out: 0 buffer {mem_type}[{size}] {offset_zeros}{gen_array} 
0x1.deadp0
+arg_in: 0 buffer {mem_type}[{size}] {offset_size_zeros} 0x1.deadp0
 arg_in:  1 buffer {type_name}[1] {gen_array}
 
 [test]
 name: vector store{suffix} {addr_space} offset {type_name}
 kernel_name: vstore{suffix}{n}_{addr_space}_offset
-arg_out: 0 buffer {mem_type}[{offset_size}] {zeros} {gen_array}
-arg_in:  1 buffer {type_name}[1] {gen_array}
-""".format(type_name=ty_name, mem_type=mem_type, size=size + 1,
-   zeros=("0 " * (size + 1)), offset_size=size * 2 + 1, n=s,
+arg_out: 0 buffer {mem_type}[{offset_size}] {offset_zeros} {gen_array} 
{padd_zeros} {gen_array} 0x1.deadp0
+arg_in: 0 buffer {mem_type}[{offset_size}] {offset_modsize_size_zeros} 
0x1.deadp0
+arg_in: 1 buffer {type_name}[1] {gen_array}
+""".format(type_name=ty_name, mem_type=mem_type, size=size + offset + 
1,
+   offset_zeros = ("0 " * offset),
+   offset_size_zeros = ("0 " * (offset + size)),
+   padd_zeros = ("0 " * (modsize - size)),
+   offset_modsize_size_zeros = ("0 " * (modsize + size + 
offset)),
+   offset_size=modsize + size + offset + 1, n=s,
gen_array=gen_array(size), suffix=suffix, 
addr_space=addr_space)))
 
 f.write(textwrap.dedent("""
@@ -94,124 +103,145 @@ def begin_test(suffix, type_name, mem_type, vec_sizes, 
addr_space):
 return f
 
 
-def gen_test_global(suffix, t, mem_type, vec_sizes):
-f = begin_test(suffix, t, mem_type, vec_sizes, 'global')
+def gen_test_global(suffix, t, mem_type, vec_sizes, aligned):
+f = begin_test(suffix, t, mem_type, vec_sizes, 'global', aligned)
 for s in vec_sizes:
+offset = int(s) if aligned else 1
+offset = 4 if offset == 3 else offset
+
 type_name = t + s
 f.write(textwrap.dedent("""
 kernel void vstore{suffix}{n}_global(global {mem_type} *out,
  global {type_name} *in) {{
 {type_name} tmp = in[0];
-vstore{suffix}{n}(({type_name})0, 0, out);
-vstore{suffix}{n}(tmp, 0, out + 1);
+vstore{suffix}{n}(tmp, 0, out + {offset});
 }}
 
 kernel void vstore{suffix}{n}_global_offset(global {mem_type} *out,
 global {type_name} *in) {{
-{type_name} tmp = ({type_name})0;
-vstore{suffix}{n}(tmp, 0, out);
-vstore{suffix}{n}(tmp, 0, out + 1);
-tmp = in[0];
-

Re: [Piglit] [PATCH] cl: Add tests for mad mix

2017-10-05 Thread Jan Vesely
On Mon, 2017-10-02 at 10:32 -0700, Matt Arsenault wrote:
> ping
> 
> > On Sep 19, 2017, at 19:25, Matt Arsenault  wrote:
> > 
> > These aren't great since they need more test
> > values, and generating half results is kind
> > of a pain from any other tool. The perfect
> > values used don't really stress the conversions,
> > but this as at least enough to make sure the
> > encoding is correct.

what is this test supposed to test? generic fp16 encoding
/functionality? if so, why is it better than vstore_half/vload_half
tests? 
does it test fp16 version of clamp? why is it better than generated
clamp tests?

Jan

> > ---
> > tests/cl/program/execute/mad-mix.cl | 283 
> > 
> > 1 file changed, 283 insertions(+)
> > create mode 100644 tests/cl/program/execute/mad-mix.cl
> > 
> > diff --git a/tests/cl/program/execute/mad-mix.cl 
> > b/tests/cl/program/execute/mad-mix.cl
> > new file mode 100644
> > index 0..dd7a5a516
> > --- /dev/null
> > +++ b/tests/cl/program/execute/mad-mix.cl
> > @@ -0,0 +1,283 @@
> > +/*!
> > +
> > +[config]
> > +name: f32 mad with conversion from f16
> > +clc_version_min: 10
> > +build_options: -cl-denorms-are-zero
> > +require_device_extensions: cl_khr_fp16
> > +
> > +dimensions: 1
> > +
> > +[test]
> > +name: mad mix f32 f16lo f16lo f16lo
> > +kernel_name: mad_mix_f32_f16lo_f16lo_f16lo
> > +global_size: 4 0 0
> > +
> > +arg_out: 0 buffer float[4] \
> > +  0.0   1.0   1.0   -1.0   \
redundant backslash. I don't see the point of this weird alignment. it
devirges from other test and if anything it makes it less readable.

> > +
> > +arg_in: 1 buffer half[4] \
> > +  0.0   1.0   0.0  -1.0
> > +
> > +arg_in: 2 buffer half[4] \
> > +  0.0   1.0   1.0   1.0\
also here

> > +
> > +arg_in: 3 buffer half[4] \
> > +  0.0   0.0   1.0   0.0
> > +
> > +
> > +[test]
> > +name: mad mix f32 fneg(f16lo) f16lo f16lo
> > +kernel_name: mad_mix_f32_negf16lo_f16lo_f16lo
> > +global_size: 4 0 0
> > +
> > +arg_out: 0 buffer float[4] \
> > +  0.0   -1.0   1.0   1.0   \
and here

> > +
> > +arg_in: 1 buffer half[4] \
> > +  0.0   1.0   0.0  -1.0
> > +
> > +arg_in: 2 buffer half[4] \
> > +  0.0   1.0   1.0   1.0\
and here

> > +
> > +arg_in: 3 buffer half[4] \
> > +  0.0   0.0   1.0   0.0
> > +
> > +
> > +[test]
> > +name: mad mix f32 f16lo f16lo f16hi
> > +kernel_name: mad_mix_f32_f16lo_f16lo_f16hi
> > +global_size: 4 0 0
> > +
> > +arg_out: 0 buffer float[4] \
> > +  0.0   \
> > +  1.0   \
> > +  1.0   \
> > + -1.0
> > +
> > +arg_in: 1 buffer half[4] \
> > +  0.0   \
> > +  1.0   \
> > +  0.0   \
> > + -1.0
> > +
> > +arg_in: 2 buffer half[4] \
> > +  0.0   \
> > +  1.0   \
> > +  1.0   \
> > +  1.0
> > +
> > +arg_in: 3 buffer half2[4] \
> > +  1000.0 0.0   \
> > +  1000.0 0.0   \
> > +  1000.0 1.0   \
> > +  1000.0 0.0
> > +
> > +
> > +[test]
> > +name: mad mix f32 f16lo f16lo neg(f16hi)
> > +kernel_name: mad_mix_f32_f16lo_f16lo_negf16hi
> > +global_size: 5 0 0
> > +
> > +arg_out: 0 buffer float[5] \
> > +  0.0   \
> > +  1.0   \
> > + -1.0   \
> > + -1.0   \
> > +  0.0
> > +
> > +arg_in: 1 buffer half[5] \
> > +  0.0   \
> > +  1.0   \
> > +  0.0   \
> > + -1.0   \
> > +  2.0
> > +
> > +arg_in: 2 buffer half[5] \
> > +  0.0   \
> > +  1.0   \
> > +  1.0   \
> > +  1.0   \
> > +  2.0
> > +
> > +arg_in: 3 buffer half2[5] \
> > +  1000.0 0.0   \
> > +  1000.0 0.0   \
> > +  1000.0 1.0   \
> > +  1000.0 0.0   \
> > +  1000.0 4.0
> > +
> > +
> > +[test]
> > +name: mad mix f16lo fneg(f16lo) f16lo f16lo
> > +kernel_name: mad_mix_f16lo_negf16lo_f16lo_f16lo
> > +global_size: 4 0 0
> > +
> > +arg_out: 0 buffer half[4] \
> > +  0.0   -1.0   1.0   1.0  \
and here

> > +
> > +arg_in: 1 buffer half[4] \
> > +  0.0   1.0   0.0  -1.0
> > +
> > +arg_in: 2 buffer half[4] \
> > +  0.0   1.0   1.0   1.0\

and here

> > +
> > +arg_in: 3 buffer half[4] \
> > +  0.0   0.0   1.0   0.0
> > +
> > +
> > +[test]
> > +name: mad mix f16hi fneg(f16lo) f16lo f16lo
> > +kernel_name: mad_mix_f16hi_negf16lo_f16lo_f16lo
> > +global_size: 4 0 0
> > +
> > +arg_out: 0 buffer half2[4] \
> > +  2.00.0   \
> > +  2.0   -1.0   \
> > +  2.01.0   \
> > +  2.01.0
> > +
> > +arg_in: 1 buffer half[4] \
> > +  0.0   1.0   0.0  -1.0
> > +
> > +arg_in: 2 buffer half[4] \
> > +  0.0   1.0   1.0   1.0\
here

> > +
> > +arg_in: 3 buffer half[4] \
> > +  0.0   0.0   1.0   0.0
> > +
> > +
> > +
> > +[test]
> > +name: mad mix f32 f16lo f16lo f16lo with clamp
> > +kernel_name: mad_mix_f32_f16lo_f16lo_f16lo_clamp
> > +global_size: 5 0 0
> > +
> > +arg_out: 0 buffer float[5] \
> > +  0.0   1.0   0.0   0.75   \
> > +  1.0
> > +
> > +arg_in: 1 buffer half[5] \
> > +  0.0   2.0  -2.0   0.5  \
> > +  0.5
> > +
> > +arg_in: 2 buffer half[5] \
> > +  0.0   1.0   1.0   0.5  \
> > +  1.0
> > +
> > +arg_in: 3 buffer half[5] \
> > +  0.0   1.0   1.0   0.5  \
> > +  0.5
> > +
> > +
> > +[test]
> > +name: mad mix f16lo f16lo f16lo f16lo with clamp
> > 

[Piglit] [PATCH 1/5] cl: Fix ulp tolerance comparison

2017-10-01 Thread Jan Vesely
This fails sin/cos/tan tests almost everywhere.

Signed-off-by: Jan Vesely <jano.ves...@gmail.com>
---
 tests/util/piglit-util-cl.c | 32 +---
 1 file changed, 21 insertions(+), 11 deletions(-)

diff --git a/tests/util/piglit-util-cl.c b/tests/util/piglit-util-cl.c
index 0211c1ff6..0cbc450ad 100644
--- a/tests/util/piglit-util-cl.c
+++ b/tests/util/piglit-util-cl.c
@@ -89,21 +89,27 @@ piglit_cl_probe_floating(float value, float expect,  
uint32_t ulp)
union {
float f;
uint32_t u;
-   } v, e, t;
+   } v, e;
 
v.f = value;
e.f = expect;
-   t.u = ulp;
-   /* Treat infinity and nan seperately */
+
+   /* Treat infinity and nan separately */
if (probe_float_check_nan_inf(value, expect)) {
return true;
}
 
+   /* expect is correctly rounded, 1 ULP is the distance to next
+* representable value */
+   float direction = signbit(expect) ?  -INFINITY : INFINITY;
+   float one_ulp = nextafterf(expect, direction) - expect;
+   float tolerance = fabsf(ulp * one_ulp);
+
diff = fabsf(value - expect);
 
-   if(diff > ulp || isnan(value)) {
+   if (diff > tolerance || 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);
+  e.f, e.u, tolerance, ulp, v.f, v.u);
return false;
}
 
@@ -117,21 +123,25 @@ piglit_cl_probe_double(double value, double expect, 
uint64_t ulp)
union {
double f;
uint64_t u;
-   } v, e, t;
+   } v, e;
 
v.f = value;
e.f = expect;
-   t.u = ulp;
-   /* Treat infinity and nan seperately */
+
+   /* Treat infinity and nan separately */
if (probe_float_check_nan_inf(value, expect)) {
return true;
}
 
-   diff = fabsl(value - expect);
+   double direction = signbit(expect) ?  -INFINITY : INFINITY;
+   double one_ulp = nextafter(expect, direction) - expect;
+   double tolerance = fabs(ulp * one_ulp);
+
+   diff = fabs(value - expect);
 
-   if(diff > ulp || isnan(value)) {
+   if(diff > tolerance || isnan(value)) {
printf("Expecting %f (0x%" PRIx64") with tolerance %f (%lu 
ulps), but got %f (0x%" PRIx64")\n",
-  e.f, e.u, t.f, t.u, v.f, v.u);
+  e.f, e.u, tolerance, ulp, v.f, v.u);
return false;
}
 
-- 
2.13.6

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


[Piglit] [PATCH 5/5] cl: Add missing math tests

2017-10-01 Thread Jan Vesely
Basic tests. All new tests, but sincos pass on beignet(SKL) (sin/cos
tests fail on beignet)

Signed-off-by: Jan Vesely <jano.ves...@gmail.com>
---
 generated_tests/gen_cl_math_builtins.py | 283 +++-
 1 file changed, 280 insertions(+), 3 deletions(-)

diff --git a/generated_tests/gen_cl_math_builtins.py 
b/generated_tests/gen_cl_math_builtins.py
index 31e0e9750..7f67b7b17 100644
--- a/generated_tests/gen_cl_math_builtins.py
+++ b/generated_tests/gen_cl_math_builtins.py
@@ -27,8 +27,8 @@ 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 fabs, fmod, log10, log1p, pi, pow, sin, sinh, sqrt, tan, tanh
+from math import acos, acosh, asin, asinh, atan, atan2, atanh, cos, cosh, exp, 
expm1
+from math import fabs, fmod, gamma, hypot, lgamma, log, log10, log1p, modf, 
pi, pow, sin, sinh, sqrt, tan, tanh
 
 CLC_VERSION_MIN = {
 'acos' : 10,
@@ -51,27 +51,52 @@ CLC_VERSION_MIN = {
 'erf' : 10,
 'erfc' : 10,
 'exp' : 10,
+'exp10' : 10,
+'exp2' : 10,
+'expm1' : 10,
 'fabs' : 10,
 'fdim' : 10,
 'floor' : 10,
+'fma' : 10,
 'fmax' : 10,
 'fmin' : 10,
 'fmod' : 10,
 'fract' : 10,
 'frexp' : 10,
+'hypot' : 10,
 'ilogb' : 10,
 'ldexp' : 10,
+'lgamma' : 10,
+'lgamma_r' : 10,
+'log' : 10,
 'log10' : 10,
 'log1p' : 10,
+'log2' : 10,
+'logb' : 10,
+'nan' : 10,
+'mad' : 10,
+'maxmag' : 11,
+'minmag' : 11,
+'modf' : 10,
 'nextafter' : 10,
+'pow' : 10,
+'pown' : 10,
+'powr' : 10,
 'remainder' : 10,
+'remquo' : 10,
+'rint' : 10,
+'rootn' : 10,
 'round' : 10,
+'rsqrt' : 10,
 'sin' : 10,
+'sincos' : 10,
 'sinh' : 10,
 'sinpi' : 10,
+'sqrt' : 10,
 'tan' : 10,
 'tanh' : 10,
-'sqrt' : 10,
+'tanpi' : 10,
+'tgamma' : 10,
 'trunc' : 10
 }
 
@@ -85,6 +110,13 @@ I = {
 'float' : 'int'
 }
 
+U = {
+'float' : 'uint'
+}
+
+def quo(x, y):
+return int(round(x/y))
+
 tests = {
 'acos' : {
 'arg_types' : [F, F],
@@ -267,6 +299,33 @@ tests = {
 ],
 'tolerance' : 3
 },
+'exp10' : {
+'arg_types' : [F, F],
+'function_type': 'ttt',
+'values' : [
+[1.0,  10 ** 0.95, 10 ** pi, 10 ** -pi, float("inf"), 
float.fromhex('0x1.4298593c335e3p+10')], # Result
+[0.0, 0.95, pi, -pi, float("inf"), float.fromhex('0x1.8e2cp+1')]  
# Arg0
+],
+'tolerance' : 3
+},
+'exp2' : {
+'arg_types' : [F, F],
+'function_type': 'ttt',
+'values' : [
+[1.0,  2 ** 0.95, 2 ** pi, 2 ** -pi, float("inf"), 
float.fromhex('0x1.146b7fd8431e3p+3')], # Result
+[0.0, 0.95, pi, -pi, float("inf"), float.fromhex('0x1.8e2cp+1')]  
# Arg0
+],
+'tolerance' : 3
+},
+'expm1' : {
+'arg_types' : [F, F],
+'function_type': 'ttt',
+'values' : [
+[0.0, expm1(0.95), expm1(pi), expm1(-pi), float("inf"), 
float.fromhex('0x1.56fe8a160893ep+4')], # Result
+[0.0, 0.95, pi, -pi, float("inf"), float.fromhex('0x1.8e2cp+1')]  
# Arg0
+],
+'tolerance' : 3
+},
 'fabs' : {
 'arg_types' : [F, F],
 'function_type': 'ttt',
@@ -293,6 +352,16 @@ tests = {
 [0.5, -0.5, 0.0, -0.0, float("nan"), -3.99, 1.5]
 ]
 },
+'fma' : {
+'arg_types': [F, F, F, F],
+'function_type': 'tss',
+'values': [
+[pi,   1.0, pi , -0.5, float("nan"), float("nan"), float("nan")], 
# Result
+[1.0,   pi, 0.0,  0.0, 1.0, float("nan"), float("nan")], # Arg0
+[pi,   0.0, pi,  -0.5, float("nan"), 1.0, float("nan")], # Arg1
+[0.0,  1.0, pi,  -0.5, float("nan"), 1.0, float("nan")]  # Arg2
+]
+},
 'fmax' : {
 'arg_types': [F, F, F],
 'function_type': 'tss',
@@ -343,6 +412,16 @@ tests = {
 ],
'num_out_args' : 2
 },
+'hypot' : {
+'arg_types': [F, F, F],
+'function_type': 'ttt',
+'values': [
+[hypot(0, 1.0), hypot(3, 10.0), hypot(1, -3.0), hypot(10, 1234.5), 
hypot(2147483647, -1.0), float("inf")], # Result
+[0,  3,1, 10, 2147483647,2147483647], # Arg0
+[1.0, 10.0, -3.0, 1234.5,   -1.0, float("-inf")] # Arg1
+],
+'tolerance' : 4
+},
 'ilogb' : {
 'arg_types': [I, F],
 'function_type': 'ttt',
@@ -362,6 +441,35 @@ tests = {
 ],
 'tolerance' : 0
 },
+'lgamma' : {
+'arg_types': [F, F],
+'function_type':

[Piglit] [PATCH 3/5] cl: Implement generating 2input 2output functions

2017-10-01 Thread Jan Vesely
Signed-off-by: Jan Vesely <jano.ves...@gmail.com>
---
 generated_tests/genclbuiltins.py | 16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/generated_tests/genclbuiltins.py b/generated_tests/genclbuiltins.py
index 338914cb9..25f2f7a9a 100644
--- a/generated_tests/genclbuiltins.py
+++ b/generated_tests/genclbuiltins.py
@@ -172,10 +172,10 @@ def gen_kernel_1_arg(f, fnName, inType, outTypes, loc = 
'private'):
 
 
 #  2 argument kernel with input types that match their vector size
-def gen_kernel_2_arg_same_size(f, fnName, inTypes, outTypes):
+def gen_kernel_2_arg_same_size(f, fnName, inTypes, outTypes, loc = 'private'):
 for vecSize in ALL_WIDTHS:
 gen_kernel(f, fnName, inTypes, outTypes, [vecSize, vecSize],
-   '')
+   '', loc)
 
 
 #  2 argument kernel with 1 vector and one scalar input argument
@@ -238,8 +238,16 @@ def generate_kernels(f, dataType, fnName, fnDef):
 return
 
 if (len(argTypes) == 4):
-gen_kernel_3_arg_same_type(f, fnName,
-   [argTypes[1], argTypes[2], argTypes[3]], [argTypes[0]])
+if (getNumOutArgs(fnDef) == 2):
+gen_kernel_2_arg_same_size(f, fnName, [argTypes[2], argTypes[3]],
+   [argTypes[0], argTypes[1]], 'private')
+gen_kernel_2_arg_same_size(f, fnName, [argTypes[2], argTypes[3]],
+   [argTypes[0], argTypes[1]], 'local')
+gen_kernel_2_arg_same_size(f, fnName, [argTypes[2], argTypes[3]],
+   [argTypes[0], argTypes[1]], 'global')
+else:
+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[2], argTypes[3]], [argTypes[0]])
-- 
2.13.6

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


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

2017-10-01 Thread Jan Vesely
From: Aaron Watry <awa...@gmail.com>

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 <awa...@gmail.com>
Reviewed-by: Jan Vesely <jan.ves...@rutgers.edu>
---
 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 4df4918e6..31e0e9750 100644
--- a/generated_tests/gen_cl_math_builtins.py
+++ b/generated_tests/gen_cl_math_builtins.py
@@ -64,6 +64,7 @@ CLC_VERSION_MIN = {
 'log10' : 10,
 'log1p' : 10,
 'nextafter' : 10,
+'remainder' : 10,
 'round' : 10,
 'sin' : 10,
 'sinh' : 10,
@@ -388,6 +389,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.13.6

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


[Piglit] [PATCH 2/5] cl: Fix cospi return value

2017-10-01 Thread Jan Vesely
cos(pi * 2k) = 1

Signed-off-by: Jan Vesely <jano.ves...@gmail.com>
---
 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 d1e0e3c24..4df4918e6 100644
--- a/generated_tests/gen_cl_math_builtins.py
+++ b/generated_tests/gen_cl_math_builtins.py
@@ -234,7 +234,7 @@ 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), 
cos(pi*pow(2,20)), cos(pi*pow(2,24)), cos(pi*pow(2,120)), float("nan")], # 
Result
+[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)), 1.0, 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
-- 
2.13.6

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


[Piglit] [PATCH 1/1] cl: Add tests for clc-1.0 integer atomics

2017-09-27 Thread Jan Vesely
Passes on intel beignet, intel CPU, CUDA OpenCL, clover(carrizo)

Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
 .../atomic/atomic_int32_add-global-return.cl   | 63 +
 .../builtin/atomic/atomic_int32_add-global.cl  | 60 
 .../builtin/atomic/atomic_int32_add-local.cl   | 71 +++
 .../atomic/atomic_int32_and-global-return.cl   | 65 +
 .../builtin/atomic/atomic_int32_and-global.cl  | 62 
 .../builtin/atomic/atomic_int32_and-local.cl   | 71 +++
 .../atomic/atomic_int32_cmpxchg-global-return.cl   | 74 +++
 .../builtin/atomic/atomic_int32_cmpxchg-global.cl  | 70 ++
 .../builtin/atomic/atomic_int32_cmpxchg-local.cl   | 82 ++
 .../atomic/atomic_int32_dec-global-return.cl   | 63 +
 .../builtin/atomic/atomic_int32_dec-global.cl  | 59 
 .../builtin/atomic/atomic_int32_dec-local.cl   | 68 ++
 .../atomic/atomic_int32_inc-global-return.cl   | 63 +
 .../builtin/atomic/atomic_int32_inc-global.cl  | 59 
 .../builtin/atomic/atomic_int32_inc-local.cl   | 68 ++
 .../atomic/atomic_int32_max-global-return.cl   | 63 +
 .../builtin/atomic/atomic_int32_max-global.cl  | 60 
 .../builtin/atomic/atomic_int32_max-local.cl   | 82 ++
 .../atomic/atomic_int32_min-global-return.cl   | 63 +
 .../builtin/atomic/atomic_int32_min-global.cl  | 60 
 .../builtin/atomic/atomic_int32_min-local.cl   | 82 ++
 .../atomic/atomic_int32_or-global-return.cl| 65 +
 .../builtin/atomic/atomic_int32_or-global.cl   | 62 
 .../builtin/atomic/atomic_int32_or-local.cl| 71 +++
 .../atomic/atomic_int32_sub-global-return.cl   | 63 +
 .../builtin/atomic/atomic_int32_sub-global.cl  | 60 
 .../builtin/atomic/atomic_int32_sub-local.cl   | 71 +++
 .../atomic/atomic_int32_xchg-global-return.cl  | 69 ++
 .../builtin/atomic/atomic_int32_xchg-global.cl | 67 ++
 .../builtin/atomic/atomic_int32_xchg-local.cl  | 76 
 .../atomic/atomic_int32_xor-global-return.cl   | 65 +
 .../builtin/atomic/atomic_int32_xor-global.cl  | 62 
 .../builtin/atomic/atomic_int32_xor-local.cl   | 72 +++
 33 files changed, 2211 insertions(+)
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int32_add-global-return.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int32_add-global.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int32_add-local.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int32_and-global-return.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int32_and-global.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int32_and-local.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int32_cmpxchg-global-return.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int32_cmpxchg-global.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int32_cmpxchg-local.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int32_dec-global-return.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int32_dec-global.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int32_dec-local.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int32_inc-global-return.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int32_inc-global.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int32_inc-local.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int32_max-global-return.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int32_max-global.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int32_max-local.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int32_min-global-return.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int32_min-global.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int32_min-local.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int32_or-global-return.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int32_or-global.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int32_or-local.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int32_sub-global-return.cl
 create mode 100644 
tests/cl/program/execute/builtin/

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

2017-09-25 Thread Jan Vesely
Hi Aaron,

looks like you never pushed this one. Did you have a reason to drop it?

Jan


On Fri, 2017-01-20 at 12:37 -0500, Jan Vesely wrote:
> On Tue, 2017-01-17 at 21:18 -0600, Aaron Watry wrote:
> > 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 <awa...@gmail.com>
> 
> Reviewed-by: Jan Vesely <jan.ves...@rutgers.edu>
> 
> Jan
> 
> > ---
> >  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',

-- 
Jan Vesely <jan.ves...@rutgers.edu>

signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/1] cl: Don't use unsigned long long

2017-09-25 Thread Jan Vesely
clc allows max long type
Fixes program@execute@calls on CUDA OpenCL
Fixes: e408ce1f2bff23121670a8206258c80bb3d9befd (cl: Add tests for function 
calls)

Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
 tests/cl/program/execute/calls.cl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/cl/program/execute/calls.cl 
b/tests/cl/program/execute/calls.cl
index f4f55be31..b1c73f7ba 100644
--- a/tests/cl/program/execute/calls.cl
+++ b/tests/cl/program/execute/calls.cl
@@ -291,7 +291,7 @@ long i64_func_void(void)
 #if USE_ASM
 __asm("v_lshlrev_b64 %0, 44, 1" : "=v"(ret));
 #else
-ret = 1ull << 44;
+ret = 1ul << 44;
 #endif
 return ret;
 }
-- 
2.13.5

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


[Piglit] [PATCH 1/2] cl: Generate aligned vstorea tests

2017-09-24 Thread Jan Vesely
Add type3 vectors and bump required CLC to 1.1.
Simplify test to use only 1-2 vstore calls.
Zero the output buffer (fixes undefined values in results of some vstore
tests).

Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
 generated_tests/gen_cl_vstore_tests.py | 141 -
 1 file changed, 86 insertions(+), 55 deletions(-)

diff --git a/generated_tests/gen_cl_vstore_tests.py 
b/generated_tests/gen_cl_vstore_tests.py
index 93038aded..5a6139365 100644
--- a/generated_tests/gen_cl_vstore_tests.py
+++ b/generated_tests/gen_cl_vstore_tests.py
@@ -29,7 +29,7 @@ from six.moves import range
 from modules import utils
 
 TYPES = ['char', 'uchar', 'short', 'ushort', 'int', 'uint', 'long', 'ulong', 
'half', 'float', 'double']
-VEC_SIZES = ['2', '4', '8', '16']
+VEC_SIZES = ['2', '3', '4', '8', '16']
 
 DIR_NAME = os.path.join("cl", "vstore")
 
@@ -47,15 +47,15 @@ def ext_req(type_name):
 return ""
 
 
-def begin_test(suffix, type_name, mem_type, vec_sizes, addr_space):
+def begin_test(suffix, type_name, mem_type, vec_sizes, addr_space, aligned):
 file_name = os.path.join(DIR_NAME, "vstore{}-{}-{}.cl".format(suffix, 
type_name, addr_space))
 print(file_name)
 f = open(file_name, 'w')
 f.write(textwrap.dedent(("""\
 /*!
 [config]
-name: Vector store{suffix} {addr_space} {type_name}2,4,8,16
-clc_version_min: 10
+name: Vector store{suffix} {addr_space} {type_name}2,3,4,8,16
+clc_version_min: 11
 
 dimensions: 1
 global_size: 1 0 0
@@ -63,21 +63,31 @@ def begin_test(suffix, type_name, mem_type, vec_sizes, 
addr_space):
 .format(type_name=type_name, addr_space=addr_space, suffix=suffix)))
 for s in vec_sizes:
 size = int(s) if s != '' else 1
+modsize = 4 if size == 3 and aligned else size
+offset = modsize if aligned else 1
+
 ty_name = type_name + s
 f.write(textwrap.dedent("""
 [test]
 name: vector store{suffix} {addr_space} {type_name}
 kernel_name: vstore{suffix}{n}_{addr_space}
-arg_out: 0 buffer {mem_type}[{size}] 0 {gen_array}
+arg_out: 0 buffer {mem_type}[{size}] {offset_zeros}{gen_array}
+arg_in: 0 buffer {mem_type}[{size}] {offset_size_zeros}
 arg_in:  1 buffer {type_name}[1] {gen_array}
 
 [test]
 name: vector store{suffix} {addr_space} offset {type_name}
 kernel_name: vstore{suffix}{n}_{addr_space}_offset
-arg_out: 0 buffer {mem_type}[{offset_size}] {zeros} {gen_array}
+arg_out: 0 buffer {mem_type}[{offset_size}] {offset_zeros} {gen_array} 
{padd_zeros} {gen_array}
+arg_in: 0 buffer {mem_type}[{offset_size}] {offset_modsize_size_zeros}
 arg_in:  1 buffer {type_name}[1] {gen_array}
-""".format(type_name=ty_name, mem_type=mem_type, size=size + 1,
-   zeros=("0 " * (size + 1)), offset_size=size * 2 + 1, n=s,
+""".format(type_name=ty_name, mem_type=mem_type, size=size + offset,
+
+   offset_zeros = ("0 " * offset),
+   offset_size_zeros = ("0 " * (offset + size)),
+   padd_zeros = ("0 " * (modsize - size)),
+   offset_modsize_size_zeros = ("0 " * (modsize + size + 
offset)),
+   offset_size=modsize + size + offset, n=s,
gen_array=gen_array(size), suffix=suffix, 
addr_space=addr_space)))
 
 f.write(textwrap.dedent("""
@@ -94,124 +104,145 @@ def begin_test(suffix, type_name, mem_type, vec_sizes, 
addr_space):
 return f
 
 
-def gen_test_global(suffix, t, mem_type, vec_sizes):
-f = begin_test(suffix, t, mem_type, vec_sizes, 'global')
+def gen_test_global(suffix, t, mem_type, vec_sizes, aligned):
+f = begin_test(suffix, t, mem_type, vec_sizes, 'global', aligned)
 for s in vec_sizes:
+offset = int(s) if aligned else 1
+offset = 4 if offset == 3 else offset
+
 type_name = t + s
 f.write(textwrap.dedent("""
 kernel void vstore{suffix}{n}_global(global {mem_type} *out,
  global {type_name} *in) {{
 {type_name} tmp = in[0];
-vstore{suffix}{n}(({type_name})0, 0, out);
-vstore{suffix}{n}(tmp, 0, out + 1);
+vstore{suffix}{n}(tmp, 0, out + {offset});
 }}
 
 kernel void vstore{suffix}{n}_global_offset(global {mem_type} *out,
 global {type_name} *in) {{
-{type_name} tmp = ({type_name})0;
-vstore{suffix}{n}(tmp, 0, out);
-vstore{suffix}{n}(tmp, 0, out + 1);
-tmp = in[0];
-vstore{suffix}{n}(tmp, 1, out + 1);
+{type_name} tmp = in[0];
+vstore{suffix}{n}(tmp, 0, out + {offset});
+v

[Piglit] [PATCH 2/2] cl: Generate aligned vloada tests

2017-09-24 Thread Jan Vesely
Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
 generated_tests/gen_cl_vload_tests.py | 108 --
 1 file changed, 64 insertions(+), 44 deletions(-)

diff --git a/generated_tests/gen_cl_vload_tests.py 
b/generated_tests/gen_cl_vload_tests.py
index 64415c57f..46410904d 100644
--- a/generated_tests/gen_cl_vload_tests.py
+++ b/generated_tests/gen_cl_vload_tests.py
@@ -29,7 +29,7 @@ from six.moves import range
 from modules import utils
 
 TYPES = ['char', 'uchar', 'short', 'ushort', 'int', 'uint', 'long', 'ulong', 
'half', 'float', 'double']
-VEC_SIZES = ['2', '4', '8', '16']
+VEC_SIZES = ['2', '3', '4', '8', '16']
 
 DIR_NAME = os.path.join("cl", "vload")
 
@@ -47,15 +47,15 @@ def ext_req(type_name):
 return ""
 
 
-def begin_test(suffix, type_name, mem_type, vec_sizes, addr_space):
+def begin_test(suffix, type_name, mem_type, vec_sizes, addr_space, aligned):
 file_name = os.path.join(DIR_NAME, "vload{}-{}-{}.cl".format(suffix, 
type_name, addr_space))
 print(file_name)
 f = open(file_name, 'w')
 f.write(textwrap.dedent(("""\
 /*!
 [config]
-name: Vector load{suffix} {addr_space} {type_name}2,4,8,16
-clc_version_min: 10
+name: Vector load{suffix} {addr_space} {type_name}2,3,4,8,16
+clc_version_min: 11
 
 dimensions: 1
 global_size: 1 0 0
@@ -63,25 +63,30 @@ def begin_test(suffix, type_name, mem_type, vec_sizes, 
addr_space):
 .format(type_name=type_name, addr_space=addr_space, suffix=suffix)))
 for s in vec_sizes:
 size = int(s) if s != '' else 1
+modsize = 4 if (size == 3 and aligned) else size
+offset = modsize if aligned else 1
+outsize = size if aligned else 1
+
 data_array = gen_array(size)
 ty_name = type_name + s
 f.write(textwrap.dedent("""
 [test]
 name: vector load{suffix} {addr_space} {type_name}
 kernel_name: vload{suffix}{n}_{addr_space}
-arg_in:  0 buffer {mem_type}[{size}] 0 {gen_array}
+arg_in:  0 buffer {mem_type}[{size}] {zeros1}{gen_array}
 arg_out: 1 buffer {type_name}[2] {first_array} {gen_array}
 
 [test]
 name: vector load{suffix} {addr_space} offset {type_name}
 kernel_name: vload{suffix}{n}_{addr_space}_offset
-arg_in:  0 buffer {mem_type}[{offset_size}] {zeros}{gen_array}
+arg_in:  0 buffer {mem_type}[{offset_size}] {zeros2}{gen_array}
 arg_out: 1 buffer {type_name}[2] {first_array} {gen_array}
-""".format(type_name=ty_name, mem_type=mem_type, size=size + 1,
-   zeros=("0 " * (size + 1)), offset_size=size * 2 + 1, n=s,
+""".format(type_name=ty_name, mem_type=mem_type, size=size + offset,
+   zeros1 = ("0 " * offset), zeros2=("0 " * (modsize + 
offset)),
+   offset_size=size + modsize + offset, n=s,
gen_array=' '.join(data_array), suffix=suffix,
addr_space=addr_space,
-   first_array="0 " + ' '.join(data_array[:-1]
+   first_array=("0 " * outsize) + ' 
'.join(data_array[:-outsize]
 
 f.write(textwrap.dedent("""
 !*/
@@ -97,32 +102,38 @@ def begin_test(suffix, type_name, mem_type, vec_sizes, 
addr_space):
 return f
 
 
-def gen_test_constant_global(suffix, t, mem_type, vec_sizes, addr_space):
-f = begin_test(suffix, t, mem_type, vec_sizes, addr_space)
+def gen_test_constant_global(suffix, t, mem_type, vec_sizes, addr_space, 
aligned):
+f = begin_test(suffix, t, mem_type, vec_sizes, addr_space, aligned)
 for s in vec_sizes:
+offset = int(s) if aligned else 1
+offset = 4 if offset == 3 else offset
+
 type_name = t + s
 f.write(textwrap.dedent("""
 kernel void vload{suffix}{n}_{addr_space}({addr_space} {mem_type} *in,
  global {type_name} *out) {{
 out[0] = vload{suffix}{n}(0, in);
-out[1] = vload{suffix}{n}(0, in + 1);
+out[1] = vload{suffix}{n}(0, in + {offset});
 }}
 
 kernel void vload{suffix}{n}_{addr_space}_offset({addr_space} 
{mem_type} *in,
 global {type_name} *out) {{
 out[0] = vload{suffix}{n}(1, in);
-out[1] = vload{suffix}{n}(1, in + 1);
+out[1] = vload{suffix}{n}(1, in + {offset});
 }}
 """.format(type_name=type_name, mem_type=mem_type, n=s, suffix=suffix,
-   addr_space=addr_space)))
+   addr_space=addr_space, offset=offset)))
 
 f.close()
 
 
-def gen_test_local_private(suffix, t, mem_type, vec_sizes, addr_space):
-f = begin_test(suffix, t, mem_type, vec_sizes, addr_space)
+def gen_test_local_

[Piglit] [PATCH 2/2] cl: Fix link program tests

2017-09-21 Thread Jan Vesely
f() is deprecated unprototyped declaration use f(void) instead.
funnction call requires a prototype.

Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
 tests/cl/api/link-program.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/cl/api/link-program.c b/tests/cl/api/link-program.c
index 48563a10c..c1734ebb1 100644
--- a/tests/cl/api/link-program.c
+++ b/tests/cl/api/link-program.c
@@ -51,10 +51,10 @@ PIGLIT_CL_API_TEST_CONFIG_END
 
 
 const char* strings[] = {
-   "int get_number() { return 42; }\n",
-   "int get_number();\n",
-   "kernel void test_kernel() { int i = get_number(); }\n",
-   "int get_number() { return 0; }\n"
+   "int get_number(void) { return 42; }\n",
+   "int get_number(void);\n",
+   "kernel void test_kernel(void) { int i = get_number(); }\n",
+   "int get_number(void) { return 0; }\n"
 };
 
 #if defined(CL_VERSION_1_2)
@@ -388,8 +388,8 @@ piglit_cl_test(const int argc,
"2nd function program");
kernel_prog = compile_program(env->context->cl_ctx,
  env->context->num_devices, 
env->context->device_ids,
- 2, [2],
- "2nd kernel program");
+ 3, [1],
+ "2nd kernel program");
 
if (!function_prog || !kernel_prog) {
result = PIGLIT_FAIL;
-- 
2.13.5

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


[Piglit] [PATCH 1/2] cl: Fix incorrect indentation

2017-09-21 Thread Jan Vesely
Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
 tests/cl/api/link-program.c | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/tests/cl/api/link-program.c b/tests/cl/api/link-program.c
index 75896d64c..48563a10c 100644
--- a/tests/cl/api/link-program.c
+++ b/tests/cl/api/link-program.c
@@ -193,7 +193,7 @@ piglit_cl_test(const int argc,
compiled_programs[0] = function_prog;
compiled_programs[1] = kernel_prog;
 
-/*** Normal usage ***/
+   /*** Normal usage ***/
test(env->context->cl_ctx,
 env->context->num_devices, env->context->device_ids,
 "-create-library",
@@ -237,7 +237,7 @@ piglit_cl_test(const int argc,
}
 
 
-/*** Errors ***/
+   /*** Errors ***/
 
/*
 * CL_INVALID_VALUE if device_list is NULL and num_devices is greater 
than
@@ -359,21 +359,21 @@ piglit_cl_test(const int argc,
cl_bool* dev_linker =
piglit_cl_get_device_info(env->context->device_ids[i],
  CL_DEVICE_LINKER_AVAILABLE);
-   if(!(*dev_linker)) {
-   test(env->context->cl_ctx,
-1, >context->device_ids[i],
-"",
-2, compiled_programs,
-NULL, NULL,
-NULL,
-CL_LINKER_NOT_AVAILABLE, ,
-"Trigger CL_LINKER_NOT_AVAILABLE if a 
linker is not available");
+   if(!(*dev_linker)) {
+   test(env->context->cl_ctx,
+1, >context->device_ids[i],
+"",
+2, compiled_programs,
+NULL, NULL,
+NULL,
+CL_LINKER_NOT_AVAILABLE, ,
+"Trigger CL_LINKER_NOT_AVAILABLE if a linker is 
not available");
}
free(dev_linker);
}
 
 
-/* Release programs */
+   /* Release programs */
clReleaseProgram(function_prog);
clReleaseProgram(kernel_prog);
clReleaseProgram(linked_prog);
@@ -407,7 +407,7 @@ piglit_cl_test(const int argc,
 "Trigger CL_LINK_PROGRAM_FAILURE if there is a failure to 
link the compiled binaries and/or libraries");
}
 
-/* Release programs */
+   /* Release programs */
clReleaseProgram(function_prog);
clReleaseProgram(kernel_prog);
 
-- 
2.13.5

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


[Piglit] [PATCH v2 1/1] cl: Add tests for 64 bit integer atomics

2017-09-19 Thread Jan Vesely
v2: Fix xor local test

Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
All test pass on clover carrizo/iceland (need libclc and mesa patches).
I haven't found any other implementation exposing int64 atomics

 .../atomic/atomic_int64_add-global-return.cl   | 63 +
 .../builtin/atomic/atomic_int64_add-global.cl  | 60 
 .../builtin/atomic/atomic_int64_add-local.cl   | 71 +++
 .../atomic/atomic_int64_and-global-return.cl   | 65 +
 .../builtin/atomic/atomic_int64_and-global.cl  | 62 
 .../builtin/atomic/atomic_int64_and-local.cl   | 71 +++
 .../atomic/atomic_int64_cmpxchg-global-return.cl   | 74 +++
 .../builtin/atomic/atomic_int64_cmpxchg-global.cl  | 70 ++
 .../builtin/atomic/atomic_int64_cmpxchg-local.cl   | 82 ++
 .../atomic/atomic_int64_dec-global-return.cl   | 63 +
 .../builtin/atomic/atomic_int64_dec-global.cl  | 59 
 .../builtin/atomic/atomic_int64_dec-local.cl   | 68 ++
 .../atomic/atomic_int64_inc-global-return.cl   | 63 +
 .../builtin/atomic/atomic_int64_inc-global.cl  | 59 
 .../builtin/atomic/atomic_int64_inc-local.cl   | 68 ++
 .../atomic/atomic_int64_max-global-return.cl   | 63 +
 .../builtin/atomic/atomic_int64_max-global.cl  | 60 
 .../builtin/atomic/atomic_int64_max-local.cl   | 82 ++
 .../atomic/atomic_int64_min-global-return.cl   | 63 +
 .../builtin/atomic/atomic_int64_min-global.cl  | 60 
 .../builtin/atomic/atomic_int64_min-local.cl   | 82 ++
 .../atomic/atomic_int64_or-global-return.cl| 65 +
 .../builtin/atomic/atomic_int64_or-global.cl   | 62 
 .../builtin/atomic/atomic_int64_or-local.cl| 71 +++
 .../atomic/atomic_int64_sub-global-return.cl   | 63 +
 .../builtin/atomic/atomic_int64_sub-global.cl  | 60 
 .../builtin/atomic/atomic_int64_sub-local.cl   | 71 +++
 .../atomic/atomic_int64_xchg-global-return.cl  | 69 ++
 .../builtin/atomic/atomic_int64_xchg-global.cl | 67 ++
 .../builtin/atomic/atomic_int64_xchg-local.cl  | 76 
 .../atomic/atomic_int64_xor-global-return.cl   | 65 +
 .../builtin/atomic/atomic_int64_xor-global.cl  | 62 
 .../builtin/atomic/atomic_int64_xor-local.cl   | 72 +++
 33 files changed, 2211 insertions(+)
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_add-global-return.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_add-global.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_add-local.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_and-global-return.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_and-global.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_and-local.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_cmpxchg-global-return.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_cmpxchg-global.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_cmpxchg-local.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_dec-global-return.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_dec-global.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_dec-local.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_inc-global-return.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_inc-global.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_inc-local.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_max-global-return.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_max-global.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_max-local.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_min-global-return.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_min-global.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_min-local.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_or-global-return.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_or-global.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_or-local.cl
 create mode 100644 
tests/cl/program/execute/builtin/

Re: [Piglit] [PATCH] cl: Add tests for function calls

2017-09-18 Thread Jan Vesely
On Mon, 2017-09-18 at 18:53 -0700, Matt Arsenault wrote:
> Passes on ROCm, I haven't tried clover recently. Last
> time I did it errored because the AsmParser wasn't properly
> initialized.
> 
> v2: Fix non-unique test names, Wrap noinline in unguarded macro,
> use prettier test names, use device_regex (effectively restricting to ROCm)

thanks.
Reviewed-by: Jan Vesely <jan.ves...@rutgers.edu>
I want to run this on my carrizo machine before pushing, should be
~wednesday.

Jan

> ---
>  tests/cl/program/execute/call-clobbers-amdgcn.cl |  68 +++
>  tests/cl/program/execute/calls-struct.cl | 179 +++
>  tests/cl/program/execute/calls-workitem-id.cl|  77 +++
>  tests/cl/program/execute/calls.cl| 607 
> +++
>  tests/cl/program/execute/tail-calls.cl   | 305 
>  5 files changed, 1236 insertions(+)
>  create mode 100644 tests/cl/program/execute/call-clobbers-amdgcn.cl
>  create mode 100644 tests/cl/program/execute/calls-struct.cl
>  create mode 100644 tests/cl/program/execute/calls-workitem-id.cl
>  create mode 100644 tests/cl/program/execute/calls.cl
>  create mode 100644 tests/cl/program/execute/tail-calls.cl
> 
> diff --git a/tests/cl/program/execute/call-clobbers-amdgcn.cl 
> b/tests/cl/program/execute/call-clobbers-amdgcn.cl
> new file mode 100644
> index 0..400771795
> --- /dev/null
> +++ b/tests/cl/program/execute/call-clobbers-amdgcn.cl
> @@ -0,0 +1,68 @@
> +/*!
> +
> +[config]
> +name: amdgcn call clobbers
> +clc_version_min: 10
> +device_regex: gfx[\d]*
> +
> +[test]
> +name: callee saved sgpr
> +kernel_name: call_clobber_s40
> +dimensions: 1
> +global_size: 1 0 0
> +arg_out: 0 buffer int[1] 0xabcd1234
> +
> +[test]
> +name: callee saved vgpr
> +kernel_name: call_clobber_v40
> +dimensions: 1
> +global_size: 1 0 0
> +arg_out: 0 buffer int[1] 0xabcd1234
> +
> +!*/
> +
> +#ifndef __AMDGCN__
> +#error This test is only for amdgcn
> +#endif
> +
> +__attribute__((noinline))
> +void clobber_s40()
> +{
> +__asm volatile("s_mov_b32 s40, 0xdead" : : : "s40");
> +}
> +
> +kernel void call_clobber_s40(__global int* ret)
> +{
> +__asm volatile("s_mov_b32 s40, 0xabcd1234" : : : "s40");
> +
> +clobber_s40();
> +
> +int tmp;
> +
> +__asm volatile("v_mov_b32 %0, s40"
> +  : "=v"(tmp)
> +  :
> +  : "s40");
> +*ret = tmp;
> +}
> +
> +__attribute__((noinline))
> +void clobber_v40()
> +{
> +__asm volatile("v_mov_b32 v40, 0xdead" : : : "v40");
> +}
> +
> +kernel void call_clobber_v40(__global int* ret)
> +{
> +__asm volatile("v_mov_b32 v40, 0xabcd1234" : : : "v40");
> +
> +clobber_v40();
> +
> +int tmp;
> +__asm volatile("v_mov_b32 %0, v40"
> +  : "=v"(tmp)
> +  :
> +  : "v40");
> +*ret = tmp;
> +}
> +
> diff --git a/tests/cl/program/execute/calls-struct.cl 
> b/tests/cl/program/execute/calls-struct.cl
> new file mode 100644
> index 0..04f769dac
> --- /dev/null
> +++ b/tests/cl/program/execute/calls-struct.cl
> @@ -0,0 +1,179 @@
> +/*!
> +
> +[config]
> +name: calls with structs
> +clc_version_min: 10
> +
> +[test]
> +name: byval struct
> +kernel_name: call_i32_func_byval_Char_IntArray
> +dimensions: 1
> +global_size: 16 0 0
> +
> +arg_out: 0 buffer int[16]\
> + 1021 1022 1023 1024 1025 1026 1027 1028 \
> + 1029 1030 1031 1032 1033 1034 1035 1036
> +
> +arg_out: 1 buffer int[16] \
> +  14   14   14   14 \
> +  14   14   14   14 \
> +  14   14   14   14 \
> +  14   14   14   14 \
> +
> +arg_in: 2 buffer int[16] \
> + 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
> +
> +
> +[test]
> +name: sret struct
> +kernel_name: call_sret_Char_IntArray_func
> +dimensions: 1
> +global_size: 16 0 0
> +
> +arg_out: 0 buffer int[16]\
> + 921 922 923 924 925 926 927 928 \
> + 929 930 931 932 933 934 935 936
> +
> +arg_in: 1 buffer int[16] \
> + 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
> +
> +
> +[test]
> +name: byval struct and sret struct
> +kernel_name: call_sret_Char_IntArray_func_byval_Char_IntArray
> +dimensions: 1
> +global_size: 16 0 0
> +
> +arg_out: 0 buffer int[16]\
> +  86 87 88 89   \
> +  90 91 92 93   \
> +  94 95 96 97   \
> +  98 99 100 101
> +
> +arg_out: 1 buffer int[16]\
> +  134  135  136  137  \
> +  138  139  140  141  

Re: [Piglit] [PATCH] cl: Fix device_regex feature

2017-09-18 Thread Jan Vesely
On Mon, 2017-09-18 at 18:29 -0700, Matt Arsenault wrote:
> ---
>  tests/cl/program/program-tester.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/cl/program/program-tester.c 
> b/tests/cl/program/program-tester.c
> index 1a876101d..a4abed9ee 100644
> --- a/tests/cl/program/program-tester.c
> +++ b/tests/cl/program/program-tester.c
> @@ -1703,7 +1703,7 @@ parse_config(const char* config_str,
>   } else if(regex_match(key, "^platform_regex$")) 
> {
>   config->platform_regex = 
> add_dynamic_str_copy(value);
>   } else if(regex_match(key, "^device_regex$")) {
> - config->platform_regex = 
> add_dynamic_str_copy(value);
> + config->device_regex = 
> add_dynamic_str_copy(value);
>   } else if(regex_match(key, 
> "^require_platform_extensions$")) {
>   config->require_platform_extensions =
>           add_dynamic_str_copy(value);
nice catch.

Reviewed-by: Jan Vesely <jan.ves...@rutgers.edu>

-- 
Jan Vesely <jan.ves...@rutgers.edu>

signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/1] cl: Add tests for 64 bit integer atomics

2017-09-18 Thread Jan Vesely
Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
 .../atomic/atomic_int64_add-global-return.cl   | 63 +
 .../builtin/atomic/atomic_int64_add-global.cl  | 60 
 .../builtin/atomic/atomic_int64_add-local.cl   | 71 +++
 .../atomic/atomic_int64_and-global-return.cl   | 65 +
 .../builtin/atomic/atomic_int64_and-global.cl  | 62 
 .../builtin/atomic/atomic_int64_and-local.cl   | 71 +++
 .../atomic/atomic_int64_cmpxchg-global-return.cl   | 74 +++
 .../builtin/atomic/atomic_int64_cmpxchg-global.cl  | 70 ++
 .../builtin/atomic/atomic_int64_cmpxchg-local.cl   | 82 ++
 .../atomic/atomic_int64_dec-global-return.cl   | 63 +
 .../builtin/atomic/atomic_int64_dec-global.cl  | 59 
 .../builtin/atomic/atomic_int64_dec-local.cl   | 68 ++
 .../atomic/atomic_int64_inc-global-return.cl   | 63 +
 .../builtin/atomic/atomic_int64_inc-global.cl  | 59 
 .../builtin/atomic/atomic_int64_inc-local.cl   | 68 ++
 .../atomic/atomic_int64_max-global-return.cl   | 63 +
 .../builtin/atomic/atomic_int64_max-global.cl  | 60 
 .../builtin/atomic/atomic_int64_max-local.cl   | 82 ++
 .../atomic/atomic_int64_min-global-return.cl   | 63 +
 .../builtin/atomic/atomic_int64_min-global.cl  | 60 
 .../builtin/atomic/atomic_int64_min-local.cl   | 82 ++
 .../atomic/atomic_int64_or-global-return.cl| 65 +
 .../builtin/atomic/atomic_int64_or-global.cl   | 62 
 .../builtin/atomic/atomic_int64_or-local.cl| 71 +++
 .../atomic/atomic_int64_sub-global-return.cl   | 63 +
 .../builtin/atomic/atomic_int64_sub-global.cl  | 60 
 .../builtin/atomic/atomic_int64_sub-local.cl   | 71 +++
 .../atomic/atomic_int64_xchg-global-return.cl  | 69 ++
 .../builtin/atomic/atomic_int64_xchg-global.cl | 67 ++
 .../builtin/atomic/atomic_int64_xchg-local.cl  | 76 
 .../atomic/atomic_int64_xor-global-return.cl   | 65 +
 .../builtin/atomic/atomic_int64_xor-global.cl  | 62 
 .../builtin/atomic/atomic_int64_xor-local.cl   | 72 +++
 33 files changed, 2211 insertions(+)
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_add-global-return.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_add-global.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_add-local.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_and-global-return.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_and-global.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_and-local.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_cmpxchg-global-return.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_cmpxchg-global.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_cmpxchg-local.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_dec-global-return.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_dec-global.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_dec-local.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_inc-global-return.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_inc-global.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_inc-local.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_max-global-return.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_max-global.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_max-local.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_min-global-return.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_min-global.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_min-local.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_or-global-return.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_or-global.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_or-local.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_sub-global-return.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_int64_sub-global.cl
 create mode 100644 
tests/cl/program/e

Re: [Piglit] [PATCH] Add tests for function calls

2017-09-17 Thread Jan Vesely
On Sun, 2017-09-17 at 17:02 -0700, Matt Arsenault wrote:
> > On Sep 16, 2017, at 20:15, Jan Vesely <jan.ves...@rutgers.edu> wrote:
> > 
> > afaik, noinline is not defined in CLC, so it should be ifdefed on
> > __clang__
> > 
> 
> It’s not, but my reading of the standard is that it’s required to
> parse any unknown attributes and ignore them. ifdef clang would be
> too restrictive (e.g. it wouldn’t work with the old EDG frontend)

OK, if it helps. ignoring/warning is sensible compiler behaviour.

I haven't found anything about unknown attributes in the specs (CLC or
GCC), so technically it should be UB.

Jan

-- 
Jan Vesely <jan.ves...@rutgers.edu>

signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] Add tests for function calls

2017-09-16 Thread Jan Vesely
] \
> +  0   100  1234  -912
> +
> +arg_in: 2 buffer int[4] \
> +  14  245
> +
> +arg_in: 3 buffer int[4] \
> +  38  49
> +
> +[test]
> +name: tail_call_stack_args
> +kernel_name: kernel_call_tailcall_stack_passed_args
> +dimensions: 1
> +global_size: 10 0 0
> +
> +arg_out: 0 buffer int4[10] \
> + 11440  8762 10296 13156  \
> + 19649 31311 18081 24745  \
> + 10476 11772 17766 11070  \
> + 22165 18005 28665 35945  \
> +   624   938   768   990  \
> + 30618 28791 30240 31815  \
> + 49851 47676 46806 47676  \
> +  4400  4272  3392  2632  \
> + 10582  8712  8514  7854  \
> + 19737 21199 23865 18533  \
> +
> +
> +arg_in: 1 buffer int4[10] \
> + 0137646  \
> + 4743363  \
> +26 995 7  \
> +41544729  \
> +15683839  \
> +91431495  \
> +44836970  \
> +89541445  \
> +77632121  \
> +64708070
> +
> +arg_in: 2 buffer int4[10] \
> +5322 468  \
> +76   1003624  \
> +50382792  \
> +18155781  \
> +50145985  \
> +411389 9  \
> +99968529  \
> +99214531  \
> + 8399695  \
> +766763 5
> +
> +arg_in: 3 buffer int4[10] \
> +68943852  \
> +99727665  \
> +534695 5  \
> + 3535096  \
> +59965614  \
> +16 73625  \
> +54511041  \
> +51894447  \
> +39276928  \
> +60223270
> +
> +arg_in: 4 buffer int4[10] \
> +83 3 553  \
> + 7638927  \
> +76778312  \
> +75568963  \
> +99411457  \
> +13794535  \
> +58884473  \
> +813621   100  \
> +78794228  \
> +11775355
> +
> +arg_in: 5 buffer int4[10] \
> +67 038 6  \
> +44774824  \
> + 1698763  \
> +85162172  \
> +25494697  \
> +45819465  \
> +87728071  \
> +156362 0  \
> +19 11999  \
> +59337114
> +
> +arg_in: 6 buffer int4[10] \
> +42695993  \
> +27361649  \
> +7473   10089  \
> +13 927 0  \
> +12203263  \
> +21689125  \
> +74 18953  \
> + 0787332  \
> +24821340  \
> +16498682
> +
> +arg_in: 7 buffer int4[10] \
> +8553 966  \
> +9091 691  \
> +23303551  \
> +41 27194  \
> +12656281  \
> +86475160  \
> +46 67249  \
> +42686820  \
> +60178315  \
> +56743113
> +
> +arg_in: 8 buffer int4[10] \
> +42709176  \
> +50523299  \
> +59854184  \
> +24183289  \
> +25483920  \
> +82764696  \
> +67682092  \
> +847183 9  \
> +99252310  \
> +53315952
> +
> +arg_in: 9 buffer int[10] \
> +   26  \
> +   49  \
> +   27  \
> +   65  \
> +2  \
> +   63  \
> +   87  \
> +8  \
> +   22  \
> +   43
> +
> +!*/
> +
> +__attribute__((noinline))
> +int i32_func_i32_i32(int x, int y)
> +{
> +return x / y + 4;
> +}
> +
> +__attribute__((noinline))
> +int i32_func_i32_i32_i32(int x, int y, int z)
> +{
> +return x / y + z;
> +}
> +
> +// Test a basic tail call
> +__attribute__((noinline))
> +int tailcall_i32_func_i32_i32(int x, int y)
> +{
> +x += 5;
> +y += 10;
> +return i32_func_i32_i32(x, y);
> +}
> +
> +// Test a basic tail call with more arguments in the callee than
> +// caller.
> +__attribute__((noinline))
> +int tailcall_i32_func_i32_i32_extra_arg(int x, int y)
> +{
> +int z = x + y + 1;
> +x += 5;
> +y += 10;
> +return i32_func_i32_i32_i32(x, y, z);
> +}
> +
> +// Test a basic tail call with fewere arguments in the callee than
> +// caller.
> +__attribute__((noinline))
> +int tailcall_i32_func_i32_i32_i32_fewer_args(int x, int y, int z)
> +{
> +x += 5;
> +y += 10;
> +return i32_func_i32_i32(x, y + z);
> +}
> +
> +kernel void kernel_call_tailcall(global int* output,
> + global int* input0,
> + global int* input1)
> +{
> +int id = get_global_id(0);
> +output[id] = tailcall_i32_func_i32_i32(input0[id], input1[id]);
> +}
> +
> +kernel void kernel_call_tailcall_extra_arg(global int* output,
> +   global int* input0,
> +   global int* input1)
> +{
> +int id = get_global_id(0);
> +output[id] = tailcall_i32_func_i32_i32_extra_arg(input0[id], input1[id]);
> +}
> +
> +kernel void kernel_call_tailcall_fewer_args(global int* output,
> +global int* input0,
> +global int* input1,
> +global int* input2)
> +{
> +int id = get_global_id(0);
> +output[id] = tailcall_i32_func_i32_i32_i32_fewer_args(input0[id], 
> input1[id], input2[id]);
> +}
> +__attribute__((noinline))
> +int4 v4i32_func_v4i32_v4i32_v4i32_v4i32_v4i32_v4i32_v4i32_v4i32_i32(
> +int4 arg0, int4 arg1, int4 arg2, int4 arg3,
> +int4 arg4, int4 arg5, int4 arg6, int4 arg7,
> +int arg8)
> +{
> +// Try to make sure we can't clobber the incoming stack arguments
> +// with local stack objects.
> +volatile int4 args[8] = { arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 
> };
> +volatile int scalar_arg = arg8;
> +
> +int4 total = 0;
> +for (int i = 0; i < 8; ++i)
> +{
> +total += args[i];
> +}
> +
> +return total * scalar_arg;
> +}
> +
> +// Test a basic tail call
> +__attribute__((noinline))
> +int4 tailcall_v4i32_func_v4i32_v4i32_v4i32_v4i32_v4i32_v4i32_v4i32_v4i32_i32(
> +int4 arg0, int4 arg1, int4 arg2, int4 arg3,
> +int4 arg4, int4 arg5, int4 arg6, int4 arg7,
> +int arg8)
> +{
> +arg0 *= 2;
> +return v4i32_func_v4i32_v4i32_v4i32_v4i32_v4i32_v4i32_v4i32_v4i32_i32(
> +arg0, arg1, arg2, arg3, arg4,
> +arg5, arg6, arg7, arg8);
> +}
> +
> +kernel void kernel_call_tailcall_stack_passed_args(global int4* output,
> +   global int4* input0,
> +   global int4* input1,
> +   global int4* input2,
> +   global int4* input3,
> +   global int4* input4,
> +   global int4* input5,
> +   global int4* input6,
> +   global int4* input7,
> +   global int* input8)
> +{
> +int id = get_global_id(0);
> +output[id] = 
> tailcall_v4i32_func_v4i32_v4i32_v4i32_v4i32_v4i32_v4i32_v4i32_v4i32_i32(
> +input0[id],
> +input1[id],
> +input2[id],
> +input3[id],
> +input4[id],
> +input5[id],
> +input6[id],
> +input7[id],
> +input8[id]);
> +}

-- 
Jan Vesely <jan.ves...@rutgers.edu>

signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 2/2] cl: Add generator for shuffle2 builtins

2017-09-08 Thread Jan Vesely
On Fri, 2017-09-08 at 11:32 -0700, Dylan Baker wrote:
> Quoting Jan Vesely (2017-09-01 12:30:52)
> [snip]
> > diff --git a/generated_tests/gen_cl_shuffle2_builtins.py 
> > b/generated_tests/gen_cl_shuffle2_builtins.py
> > new file mode 100644
> > index 0..677917210
> > --- /dev/null
> > +++ b/generated_tests/gen_cl_shuffle2_builtins.py
> > @@ -0,0 +1,154 @@
> > +# Copyright 2013 Advanced Micro Devices, Inc.
> 
> This also seems copy-n-pasted, probably on the other patch as well.
> 
> > +#
> > +# Permission is hereby granted, free of charge, to any person obtaining a
> > +# copy of this software and associated documentation files (the 
> > "Software"),
> > +# to deal in the Software without restriction, including without limitation
> > +# the rights to use, copy, modify, merge, publish, distribute, sublicense,
> > +# and/or sell copies of the Software, and to permit persons to whom the
> > +# Software is furnished to do so, subject to the following conditions:
> > +#
> > +# The above copyright notice and this permission notice (including the next
> > +# paragraph) shall be included in all copies or substantial portions of the
> > +# Software.
> > +#
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
> > OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> > +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 
> > OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
> > FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 
> > IN THE
> > +# SOFTWARE.
> > +#
> > +# Authors: Tom Stellard <thomas.stell...@amd.com>
> 
> same comment on this one as the other patch

I never know what the rules are if I take an existing file and modify
it. In this case there isn't much of the original left so I dropped
these (both author and license)

> 
> > +#
> > +#
> > +
> > +from __future__ import print_function, division, absolute_import
> > +import os
> > +import random
> > +import textwrap
> > +
> > +from six.moves import range
> > +
> > +from modules import utils
> > +from genclbuiltins import MAX_VALUES
> > +
> > +TYPES = {
> > +'char': 'uchar',
> > +'uchar': 'uchar',
> > +'short': 'ushort',
> > +'ushort': 'ushort',
> > +'half': 'ushort',
> > +'int': 'uint',
> > +'uint': 'uint',
> > +'float': 'uint',
> > +'long': 'ulong',
> > +'ulong': 'ulong',
> > +'double': 'ulong'
> > +}
> > +
> > +VEC_SIZES = ['2', '4', '8', '16']
> > +ELEMENTS = 8
> > +
> > +DIR_NAME = os.path.join("cl", "builtin", "misc")
> > +
> > +
> > +def gen_array(size, m):
> > +return [random.randint(0, m) for i in range(size)]
> > +
> > +
> > +def permute(data1, data2, mask, ssize, dsize):
> > +ret = []
> > +for i in range(len(mask)):
> > +idx = mask[i] % (2 * ssize)
> > +src = data1 if idx < ssize else data2
> > +idx = mask[i] % ssize
> > +ret.append(src[idx + ((i // dsize) * ssize)])
> > +return ret
> 
> please use use enumerate here, I don't know if the list comprehension would be
> very readable here, so just enumerate would be good.
> 
> > +
> > +
> > +def ext_req(type_name):
> > +if type_name[:6] == "double":
> > +return "require_device_extensions: cl_khr_fp64"
> > +if type_name[:4] == "half":
> > +return "require_device_extensions: cl_khr_fp16"
> > +return ""
> > +
> > +
> > +def print_config(f, type_name, utype_name):
> > +f.write(textwrap.dedent(("""\
> > +/*!
> > +[config]
> > +name: shuffle2 {type_name} {utype_name}
> > +dimensions: 1
> > +""" + ext_req(type_name))
> > +.format(type_name=type_name, utype_name=utype_name)))
> > +
> > +
> > +def begin_test(type_name, utype_name):
> > +fileName = os.path.join(DIR_NAME, 
> > 'builtin-shuffle2-{}-{}.cl'.format(type_name, utype_name))
> > +print(fileName)
> > +f = open(fileName, 'w')
> > +print_config(f, type_name, utype_name)
> > +return f
> > +
> > +
> > +def main():
> >

[Piglit] [PATCH v2 1/2] cl: Add generator for shuffle builtins

2017-09-01 Thread Jan Vesely
v2: "The size of each element in the mask must match the size of each element 
in the result."

Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
 generated_tests/CMakeLists.txt |   4 +
 generated_tests/gen_cl_shuffle_builtins.py | 149 +
 tests/cl.py|   3 +
 3 files changed, 156 insertions(+)
 create mode 100644 generated_tests/gen_cl_shuffle_builtins.py

diff --git a/generated_tests/CMakeLists.txt b/generated_tests/CMakeLists.txt
index fe82ccfa4..251c7e0b8 100644
--- a/generated_tests/CMakeLists.txt
+++ b/generated_tests/CMakeLists.txt
@@ -225,6 +225,9 @@ piglit_make_generated_tests(
 piglit_make_generated_tests(
builtin_cl_common_tests.list
gen_cl_common_builtins.py)
+piglit_make_generated_tests(
+   builtin_cl_shuffle_tests.list
+   gen_cl_shuffle_builtins.py)
 
 # Create a custom target for generating OpenGL tests
 # This is not added to the default target, instead it is added
@@ -272,6 +275,7 @@ add_custom_target(gen-cl-tests
builtin_cl_math_tests.list
builtin_cl_relational_tests.list
builtin_cl_common_tests.list
+   builtin_cl_shuffle_tests.list
cl_store_tests.list
cl_vstore_tests.list
cl_vload_tests.list
diff --git a/generated_tests/gen_cl_shuffle_builtins.py 
b/generated_tests/gen_cl_shuffle_builtins.py
new file mode 100644
index 0..4e007b130
--- /dev/null
+++ b/generated_tests/gen_cl_shuffle_builtins.py
@@ -0,0 +1,149 @@
+# Copyright 2013 Advanced Micro Devices, Inc.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+#
+# Authors: Tom Stellard <thomas.stell...@amd.com>
+#
+#
+
+from __future__ import print_function, division, absolute_import
+import os
+import random
+import textwrap
+
+from six.moves import range
+
+from modules import utils
+from genclbuiltins import MAX_VALUES, DATA_SIZES
+
+TYPES = {
+'char': 'uchar',
+'uchar': 'uchar',
+'short': 'ushort',
+'ushort': 'ushort',
+'half': 'ushort',
+'int': 'uint',
+'uint': 'uint',
+'float': 'uint',
+'long': 'ulong',
+'ulong': 'ulong',
+'double': 'ulong'
+}
+
+VEC_SIZES = ['2', '4', '8', '16']
+ELEMENTS = 8
+
+DIR_NAME = os.path.join("cl", "builtin", "misc")
+
+
+def gen_array(size, m):
+return [random.randint(0, m) for i in range(size)]
+
+
+def permute(data, mask, ssize, dsize):
+ret = []
+for i in range(len(mask)):
+idx = mask[i] % ssize
+ret.append(data[idx + ((i // dsize) * ssize)])
+return ret
+
+
+def ext_req(type_name):
+if type_name[:6] == "double":
+return "require_device_extensions: cl_khr_fp64"
+if type_name[:4] == "half":
+return "require_device_extensions: cl_khr_fp16"
+return ""
+
+
+def print_config(f, type_name, utype_name):
+f.write(textwrap.dedent(("""\
+/*!
+[config]
+name: shuffle {type_name} {utype_name}
+dimensions: 1
+""" + ext_req(type_name))
+.format(type_name=type_name, utype_name=utype_name)))
+
+
+def begin_test(type_name, utype_name):
+fileName = os.path.join(DIR_NAME, 
'builtin-shuffle-{}-{}.cl'.format(type_name, utype_name))
+print(fileName)
+f = open(fileName, 'w')
+print_config(f, type_name, utype_name)
+return f
+
+
+def main():
+random.seed(0)
+utils.safe_makedirs(DIR_NAME)
+
+for t, ut in TYPES.items():
+f = begin_test(t, ut)
+for ss in VEC_SIZES:
+for ds in VEC_SIZES:
+ssize = int(ss) * ELEMENTS
+dsize = int(ds) * ELEMENTS
+stype_name = t + ss
+dtype_name = t + ds
+utype_name = ut + ds

[Piglit] [PATCH 2/2] cl: Add generator for shuffle2 builtins

2017-09-01 Thread Jan Vesely
Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
 generated_tests/CMakeLists.txt  |   4 +
 generated_tests/gen_cl_shuffle2_builtins.py | 154 
 2 files changed, 158 insertions(+)
 create mode 100644 generated_tests/gen_cl_shuffle2_builtins.py

diff --git a/generated_tests/CMakeLists.txt b/generated_tests/CMakeLists.txt
index 251c7e0b8..adec9b4cb 100644
--- a/generated_tests/CMakeLists.txt
+++ b/generated_tests/CMakeLists.txt
@@ -228,6 +228,9 @@ piglit_make_generated_tests(
 piglit_make_generated_tests(
builtin_cl_shuffle_tests.list
gen_cl_shuffle_builtins.py)
+piglit_make_generated_tests(
+   builtin_cl_shuffle2_tests.list
+   gen_cl_shuffle2_builtins.py)
 
 # Create a custom target for generating OpenGL tests
 # This is not added to the default target, instead it is added
@@ -276,6 +279,7 @@ add_custom_target(gen-cl-tests
builtin_cl_relational_tests.list
builtin_cl_common_tests.list
builtin_cl_shuffle_tests.list
+   builtin_cl_shuffle2_tests.list
cl_store_tests.list
cl_vstore_tests.list
cl_vload_tests.list
diff --git a/generated_tests/gen_cl_shuffle2_builtins.py 
b/generated_tests/gen_cl_shuffle2_builtins.py
new file mode 100644
index 0..677917210
--- /dev/null
+++ b/generated_tests/gen_cl_shuffle2_builtins.py
@@ -0,0 +1,154 @@
+# Copyright 2013 Advanced Micro Devices, Inc.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+#
+# Authors: Tom Stellard <thomas.stell...@amd.com>
+#
+#
+
+from __future__ import print_function, division, absolute_import
+import os
+import random
+import textwrap
+
+from six.moves import range
+
+from modules import utils
+from genclbuiltins import MAX_VALUES
+
+TYPES = {
+'char': 'uchar',
+'uchar': 'uchar',
+'short': 'ushort',
+'ushort': 'ushort',
+'half': 'ushort',
+'int': 'uint',
+'uint': 'uint',
+'float': 'uint',
+'long': 'ulong',
+'ulong': 'ulong',
+'double': 'ulong'
+}
+
+VEC_SIZES = ['2', '4', '8', '16']
+ELEMENTS = 8
+
+DIR_NAME = os.path.join("cl", "builtin", "misc")
+
+
+def gen_array(size, m):
+return [random.randint(0, m) for i in range(size)]
+
+
+def permute(data1, data2, mask, ssize, dsize):
+ret = []
+for i in range(len(mask)):
+idx = mask[i] % (2 * ssize)
+src = data1 if idx < ssize else data2
+idx = mask[i] % ssize
+ret.append(src[idx + ((i // dsize) * ssize)])
+return ret
+
+
+def ext_req(type_name):
+if type_name[:6] == "double":
+return "require_device_extensions: cl_khr_fp64"
+if type_name[:4] == "half":
+return "require_device_extensions: cl_khr_fp16"
+return ""
+
+
+def print_config(f, type_name, utype_name):
+f.write(textwrap.dedent(("""\
+/*!
+[config]
+name: shuffle2 {type_name} {utype_name}
+dimensions: 1
+""" + ext_req(type_name))
+.format(type_name=type_name, utype_name=utype_name)))
+
+
+def begin_test(type_name, utype_name):
+fileName = os.path.join(DIR_NAME, 
'builtin-shuffle2-{}-{}.cl'.format(type_name, utype_name))
+print(fileName)
+f = open(fileName, 'w')
+print_config(f, type_name, utype_name)
+return f
+
+
+def main():
+random.seed(0)
+utils.safe_makedirs(DIR_NAME)
+
+for t, ut in TYPES.items():
+f = begin_test(t, ut)
+for ss in VEC_SIZES:
+for ds in VEC_SIZES:
+ssize = int(ss) * ELEMENTS
+dsize = int(ds) * ELEMENTS
+stype_name = t + ss
+dtype_name = t + ds
+utype_name = ut + ds
+data1 = gen_array(ssize, MAX_VALUES['ushort'

[Piglit] [PATCH 1/1] cl: Add generator for shuffle builtins

2017-08-31 Thread Jan Vesely
Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
 generated_tests/CMakeLists.txt |   4 +
 generated_tests/gen_cl_shuffle_builtins.py | 129 +
 tests/cl.py|   3 +
 3 files changed, 136 insertions(+)
 create mode 100644 generated_tests/gen_cl_shuffle_builtins.py

diff --git a/generated_tests/CMakeLists.txt b/generated_tests/CMakeLists.txt
index fe82ccfa4..251c7e0b8 100644
--- a/generated_tests/CMakeLists.txt
+++ b/generated_tests/CMakeLists.txt
@@ -225,6 +225,9 @@ piglit_make_generated_tests(
 piglit_make_generated_tests(
builtin_cl_common_tests.list
gen_cl_common_builtins.py)
+piglit_make_generated_tests(
+   builtin_cl_shuffle_tests.list
+   gen_cl_shuffle_builtins.py)
 
 # Create a custom target for generating OpenGL tests
 # This is not added to the default target, instead it is added
@@ -272,6 +275,7 @@ add_custom_target(gen-cl-tests
builtin_cl_math_tests.list
builtin_cl_relational_tests.list
builtin_cl_common_tests.list
+   builtin_cl_shuffle_tests.list
cl_store_tests.list
cl_vstore_tests.list
cl_vload_tests.list
diff --git a/generated_tests/gen_cl_shuffle_builtins.py 
b/generated_tests/gen_cl_shuffle_builtins.py
new file mode 100644
index 0..98b7773ca
--- /dev/null
+++ b/generated_tests/gen_cl_shuffle_builtins.py
@@ -0,0 +1,129 @@
+# Copyright 2013 Advanced Micro Devices, Inc.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+#
+# Authors: Tom Stellard <thomas.stell...@amd.com>
+#
+#
+
+from __future__ import print_function, division, absolute_import
+import os
+import random
+import textwrap
+
+from six.moves import range
+
+from modules import utils
+from genclbuiltins import MAX_VALUES
+
+TYPES = ['char', 'uchar', 'short', 'ushort', 'int', 'uint', 'long', 'ulong', 
'half', 'float', 'double']
+UTYPES = ['uchar', 'ushort', 'uint', 'ulong']
+
+VEC_SIZES = ['2', '4', '8', '16']
+ELEMENTS = 8
+
+DIR_NAME = os.path.join("cl", "builtin", "misc")
+
+
+def gen_array(size, m):
+return [random.randint(0, m) for i in range(size)]
+
+
+def permute(data, mask, ssize, dsize):
+ret = []
+for i in range(len(mask)):
+idx = mask[i] % ssize
+ret.append(data[idx + ((i // dsize) * ssize)])
+return ret
+
+
+def ext_req(type_name):
+if type_name[:6] == "double":
+return "require_device_extensions: cl_khr_fp64"
+if type_name[:4] == "half":
+return "require_device_extensions: cl_khr_fp16"
+return ""
+
+
+def print_config(f, type_name, utype_name):
+f.write(textwrap.dedent(("""\
+/*!
+[config]
+name: shuffle {type_name} {utype_name}
+dimensions: 1
+""" + ext_req(type_name))
+.format(type_name=type_name, utype_name=utype_name)))
+
+
+def begin_test(type_name, utype_name):
+fileName = os.path.join(DIR_NAME, 
'builtin-shuffle-{}-{}.cl'.format(type_name, utype_name))
+print(fileName)
+f = open(fileName, 'w')
+print_config(f, type_name, utype_name)
+return f
+
+
+def main():
+random.seed(0)
+utils.safe_makedirs(DIR_NAME)
+
+for t in TYPES:
+for ut in UTYPES:
+f = begin_test(t, ut)
+for ss in VEC_SIZES:
+for ds in VEC_SIZES:
+ssize = int(ss) * ELEMENTS
+dsize = int(ds) * ELEMENTS
+stype_name = t + ss
+dtype_name = t + ds
+utype_name = ut + ds
+data = gen_array(ssize, MAX_VALUES['ushort'])
+mask = gen_array(dsize, MAX_VALUES[ut])
+perm = permute(data, mask,

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

2017-08-28 Thread Jan Vesely
On Mon, 2017-08-28 at 15:15 -0700, Vinson Lee wrote:
> On Wed, Jul 19, 2017 at 3:51 PM, Jan Vesely <jan.ves...@rutgers.edu> 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 <jan.ves...@rutgers.edu>
> > ---
> > 
> > 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
> > 
> 
> This patch introduced this GCC warning.
> 
> create-command-queue.c: In function ‘piglit_cl_test’:
> create-command-queue.c:159:12: warning: cast from pointer to integer
> of different size [-Wpointer-to-int-cast]
> (unsigned int)mixed_command_queue_properties);
> ^

thanks for noticing. the attached patch should fix the problem (and
correctly report failed property).

Jan

> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
From 9324f9da7dabf59fe983d7b7eb346cdc33b10d89 Mon Sep 17 00:00:00 2001
From: Jan Vesely <jan.ves...@rutgers.edu>
Date: Mon, 28 Aug 2017 18:20:26 -0400
Subject: [Piglit][PATCH 1/1] cl: Fix error message value.

Fixes: f6d4e22d8b8eef1fbf5c7a234f520ae013a3e0d5 ("cl: Add support for OCL 2.0")

Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
 tests/cl/api/create-command-queue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/cl/api/create-command-queue.c b/tests/cl/api/create-command-queue.c
index 3ada5af90..e409d5261 100644
--- a/tests/cl/api/create-command-queue.c
+++ b/tests/cl/api/create-command-queue.c
@@ -156,7 +156,7 @@ piglit_cl_test(const int argc,
 			fprintf(stderr,
 			"Failed (error code: %s): Create command queue using 0x%X as command queue properties.\n",
 			piglit_cl_get_error_name(errNo),
-			(unsigned int)mixed_command_queue_properties);
+			(unsigned int)mixed_command_queue_properties[1]);
 			piglit_merge_result(, PIGLIT_FAIL);
 		}
 		clReleaseCommandQueue(command_queue);
-- 
2.13.5



signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH v2 3/3] cl: Replace handwritten vload tests with a generator

2017-08-24 Thread Jan Vesely
On Wed, 2017-08-23 at 14:54 -0700, Dylan Baker wrote:
> Quoting Jan Vesely (2017-08-23 12:38:53)
> > Hi Dylan,
> > 
> > do you mind taking a look at the python parts?
> > 
> > thanks,
> > Jan
> 
> Sure, I have a few comments, but mostly this looks okay, my comments are 
> mostly
> style nits anyway.
> 
> Dylan
> 
> > On Wed, 2017-08-16 at 20:39 -0400, Jan Vesely wrote:
> > > v2: simplify
> > > mark local storage volatile
> > > Passes on beignet(IVB), and intel CPU
> > > 
> > > Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
> > > ---
> > > clover on carrizo passes as well, apart from vload_half tests, because
> > > the function is missing in libclc
> > > 
> > > +
> 
> [snip]
> 
> > > +from __future__ import print_function, division, absolute_import
> > > +import os
> > > +import textwrap
> > > +import random
> 
> please sort the os, textwrap, and radom imports
> 
> > > +
> > > +from six.moves import range
> > > +
> > > +from modules import utils
> > > +
> > > +TYPES = ['char', 'uchar', 'short', 'ushort', 'int', 'uint', 'long', 
> > > 'ulong', 'half', 'float', 'double']
> > > +VEC_SIZES = ['2', '4', '8', '16']
> > > +
> > > +dirName = os.path.join("cl", "vload")
> 
> module level constants should be all caps with underscores like TYPES and
> VEC_SIZES
> 
> > > +
> > > +
> > > +def gen_array(size):
> > > +random.seed(size)
> > > +return [str(random.randint(0, 255)) for i in range(size)]
> > > +
> > > +
> > > +def ext_req(type_name):
> > > +if type_name[:6] == "double":
> > > +return "require_device_extensions: cl_khr_fp64"
> > > +if type_name[:6] == "half":
> 
> Should this be [:4]?
> 
> > > +return "require_device_extensions: cl_khr_fp16"
> > > +return ""
> > > +
> > > +def begin_test(suffix, type_name, mem_type, vec_sizes, addr_space):
> > > +fileName = os.path.join(dirName, 'vload'+ suffix + '-' + type_name + 
> > > '-' + addr_space + '.cl')
> 
> I think that using str.format here is much more readable:
> fileName = os.path.join(dirName, "vload{}-{}-{}.cl".format(suffix, type_name, 
> addr_space))
> 
> Also, could you use file_name instead of fileName, in keeping with our python
> style?
> 
> > > +print(fileName)
> > > +f = open(fileName, 'w')
> > > +f.write(textwrap.dedent(("""
> 
> You can add a \ to the end of """ to avoid an extra newline at the top of the
> file, if you like
> 
> > > +/*!
> > > +[config]
> > > +name: Vector load{suffix} {addr_space} {type_name}2,4,8,16
> > > +clc_version_min: 10
> > > +
> > > +dimensions: 1
> > > +global_size: 1 0 0
> > > +""" + ext_req(type_name))
> > > +.format(type_name=type_name, addr_space=addr_space, suffix=suffix)))
> > > +for s in vec_sizes:
> > > +size = int(s) if s != '' else 1
> > > +data_array = gen_array(size)
> > > +ty_name = type_name + s
> > > +f.write(textwrap.dedent("""
> > > +[test]
> > > +name: vector load{suffix} {addr_space} {type_name}
> > > +kernel_name: vload{suffix}{n}_{addr_space}
> > > +arg_in:  0 buffer {mem_type}[{size}] 0 {gen_array}
> > > +arg_out: 1 buffer {type_name}[2] {first_array} {gen_array}
> > > +
> > > +[test]
> > > +name: vector load{suffix} {addr_space} offset {type_name}
> > > +kernel_name: vload{suffix}{n}_{addr_space}_offset
> > > +arg_in:  0 buffer {mem_type}[{offset_size}] {zeros}{gen_array}
> > > +arg_out: 1 buffer {type_name}[2] {first_array} {gen_array}
> > > +""".format(type_name=ty_name, mem_type=mem_type, size=size + 1,
> > > +   zeros=("0 " * (size + 1)), offset_size=size*2 + 1, 
> > > n=s,
> 
> Spaces around the * operator please (offset_size=size * 2 + 1,)
> 
> > > +   gen_array=' '.join(data_array), suffix=suffix,
> > > +   addr_space=addr_space,
> > > +   first_array="0 " + ' '.join(data_array[:-1]
> > > +
>

Re: [Piglit] [PATCH 1/1] cl: Add failing case to exp test

2017-08-24 Thread Jan Vesely
On Thu, 2017-08-24 at 12:54 -0400, Jan Vesely wrote:
> From: Tom Stellard <thomas.stell...@amd.com>

Hi Tom,

this patch was never pushed. Do you remember what hw failed in this
case? Do you mind if I push it?

thanks,
Jan

> 
> ---
>  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 29b4e1a3f..d1e0e3c24 100644
> --- a/generated_tests/gen_cl_math_builtins.py
> +++ b/generated_tests/gen_cl_math_builtins.py
> @@ -261,8 +261,8 @@ tests = {
>  'arg_types' : [F, F],
>  'function_type': 'ttt',
>  'values' : [
> -[1.0, exp(0.95), exp(pi), exp(-pi), float("inf") ], # Result
> -[0.0, 0.95, pi, -pi, float("inf")]  # Arg0
> +[1.0, exp(0.95), exp(pi), exp(-pi), float("inf"), 
> float.fromhex('0x1.66fe8ap+4')], # Result
> +[0.0, 0.95, pi, -pi, float("inf"), float.fromhex('0x1.8e2cp+1')] 
>  # Arg0
>  ],
>  'tolerance' : 3
>  },


signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/1] cl: Add failing case to exp test

2017-08-24 Thread Jan Vesely
From: Tom Stellard 

---
 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 29b4e1a3f..d1e0e3c24 100644
--- a/generated_tests/gen_cl_math_builtins.py
+++ b/generated_tests/gen_cl_math_builtins.py
@@ -261,8 +261,8 @@ tests = {
 'arg_types' : [F, F],
 'function_type': 'ttt',
 'values' : [
-[1.0, exp(0.95), exp(pi), exp(-pi), float("inf") ], # Result
-[0.0, 0.95, pi, -pi, float("inf")]  # Arg0
+[1.0, exp(0.95), exp(pi), exp(-pi), float("inf"), 
float.fromhex('0x1.66fe8ap+4')], # Result
+[0.0, 0.95, pi, -pi, float("inf"), float.fromhex('0x1.8e2cp+1')]  
# Arg0
 ],
 'tolerance' : 3
 },
-- 
2.13.5

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


Re: [Piglit] [PATCH v2 3/3] cl: Replace handwritten vload tests with a generator

2017-08-23 Thread Jan Vesely
Hi Dylan,

do you mind taking a look at the python parts?

thanks,
Jan

On Wed, 2017-08-16 at 20:39 -0400, Jan Vesely wrote:
> v2: simplify
> mark local storage volatile
> Passes on beignet(IVB), and intel CPU
> 
> Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
> ---
> clover on carrizo passes as well, apart from vload_half tests, because
> the function is missing in libclc
> 
>  generated_tests/CMakeLists.txt |   4 +
>  generated_tests/gen_cl_vload_tests.py  | 212 
> +
>  tests/cl.py|   2 +
>  tests/cl/program/execute/vload-constant-int.cl |  64 
>  tests/cl/program/execute/vload-int.cl  | 175 
>  tests/cl/program/execute/vload-local-int.cl| 105 
>  tests/cl/program/execute/vload-private-int.cl  | 105 
>  7 files changed, 218 insertions(+), 449 deletions(-)
>  create mode 100644 generated_tests/gen_cl_vload_tests.py
>  delete mode 100644 tests/cl/program/execute/vload-constant-int.cl
>  delete mode 100644 tests/cl/program/execute/vload-int.cl
>  delete mode 100644 tests/cl/program/execute/vload-local-int.cl
>  delete mode 100644 tests/cl/program/execute/vload-private-int.cl
> 
> diff --git a/generated_tests/CMakeLists.txt b/generated_tests/CMakeLists.txt
> index 44572bdf6..fe82ccfa4 100644
> --- a/generated_tests/CMakeLists.txt
> +++ b/generated_tests/CMakeLists.txt
> @@ -214,6 +214,9 @@ piglit_make_generated_tests(
>   cl_vstore_tests.list
>   gen_cl_vstore_tests.py)
>  piglit_make_generated_tests(
> + cl_vload_tests.list
> + gen_cl_vload_tests.py)
> +piglit_make_generated_tests(
>   builtin_cl_math_tests.list
>   gen_cl_math_builtins.py)
>  piglit_make_generated_tests(
> @@ -271,6 +274,7 @@ add_custom_target(gen-cl-tests
>   builtin_cl_common_tests.list
>   cl_store_tests.list
>   cl_vstore_tests.list
> + cl_vload_tests.list
>  )
>  
>  # Add a "gen-tests" target that can be used to generate all the
> diff --git a/generated_tests/gen_cl_vload_tests.py 
> b/generated_tests/gen_cl_vload_tests.py
> new file mode 100644
> index 0..7ebb20fa7
> --- /dev/null
> +++ b/generated_tests/gen_cl_vload_tests.py
> @@ -0,0 +1,212 @@
> +# Copyright 2016 Advanced Micro Devices, Inc.
> +#
> +# Permission is hereby granted, free of charge, to any person obtaining a
> +# copy of this software and associated documentation files (the "Software"),
> +# to deal in the Software without restriction, including without limitation
> +# the rights to use, copy, modify, merge, publish, distribute, sublicense,
> +# and/or sell copies of the Software, and to permit persons to whom the
> +# Software is furnished to do so, subject to the following conditions:
> +#
> +# The above copyright notice and this permission notice (including the next
> +# paragraph) shall be included in all copies or substantial portions of the
> +# Software.
> +#
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
> FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
> THE
> +# SOFTWARE.
> +
> +from __future__ import print_function, division, absolute_import
> +import os
> +import textwrap
> +import random
> +
> +from six.moves import range
> +
> +from modules import utils
> +
> +TYPES = ['char', 'uchar', 'short', 'ushort', 'int', 'uint', 'long', 'ulong', 
> 'half', 'float', 'double']
> +VEC_SIZES = ['2', '4', '8', '16']
> +
> +dirName = os.path.join("cl", "vload")
> +
> +
> +def gen_array(size):
> +random.seed(size)
> +return [str(random.randint(0, 255)) for i in range(size)]
> +
> +
> +def ext_req(type_name):
> +if type_name[:6] == "double":
> +return "require_device_extensions: cl_khr_fp64"
> +if type_name[:6] == "half":
> +return "require_device_extensions: cl_khr_fp16"
> +return ""
> +
> +def begin_test(suffix, type_name, mem_type, vec_sizes, addr_space):
> +fileName = os.path.join(dirName, 'vload'+ suffix + '-' + type_name + '-' 
> + addr_space + '.cl')
> +print(fileName)
> +f = open(fileName, 'w')
> +f.write(textwrap.dedent((""

[Piglit] [PATCH v2 2/3] cl: Add private and local versions of vstore tests

2017-08-16 Thread Jan Vesely
v2: mark temporary storage as volatile

vstore_half requires workaround using short as local/private type
Tests pass on beignet(IVB), and intel CPU

Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
 generated_tests/gen_cl_vstore_tests.py | 81 ++
 1 file changed, 81 insertions(+)

diff --git a/generated_tests/gen_cl_vstore_tests.py 
b/generated_tests/gen_cl_vstore_tests.py
index d84541f29..1b8409450 100644
--- a/generated_tests/gen_cl_vstore_tests.py
+++ b/generated_tests/gen_cl_vstore_tests.py
@@ -116,14 +116,95 @@ def gen_test_global(suffix, t, mem_type, vec_sizes):
 
 f.close()
 
+def gen_test_local_private(suffix, t, mem_type, vec_sizes, addr_space):
+f = begin_test(suffix, t, mem_type, vec_sizes, addr_space)
+for s in vec_sizes:
+size = int(s) if s != '' else 1
+type_name = t + s
+f.write(textwrap.dedent("""
+kernel void vstore{suffix}{n}_{addr_space}(global {mem_type} *out,
+ global {type_name} *in) {{
+{type_name} tmp = in[0];
+volatile {addr_space} {mem_type} loc[{size}];
+vstore{suffix}{n}(({type_name})0, 0, ({addr_space} 
{mem_type}*)loc);
+vstore{suffix}{n}(tmp, 0, ({addr_space} {mem_type}*)loc + 1);
+for (int i = 0; i < {size}; ++i)
+out[i] = loc[i];
+}}
+
+kernel void vstore{suffix}{n}_{addr_space}_offset(global {mem_type} 
*out,
+global {type_name} *in) {{
+{type_name} tmp = ({type_name})0;
+volatile {addr_space} {mem_type} loc[{offset_size}];
+vstore{suffix}{n}(tmp, 0, ({addr_space} {mem_type}*)loc);
+vstore{suffix}{n}(tmp, 0, ({addr_space} {mem_type}*)loc + 1);
+tmp = in[0];
+vstore{suffix}{n}(tmp, 1, ({addr_space} {mem_type}*)loc + 1);
+for (int i = 0; i < {offset_size}; ++i)
+out[i] = loc[i];
+}}
+""".format(type_name=type_name, mem_type=mem_type, n=s, suffix=suffix,
+   offset_size=size*2 + 1, size=size + 1, 
addr_space=addr_space)))
+
+f.close()
+
+# vstore_half is special, becuase CLC won't allow us to use half type without
+# cl_khr_fp16
+def gen_test_local_private_half(suffix, t, vec_sizes, addr_space):
+f = begin_test(suffix, t, 'half', vec_sizes, addr_space)
+for s in vec_sizes:
+size = int(s) if s != '' else 1
+type_name = t + s
+f.write(textwrap.dedent("""
+kernel void vstore{suffix}{n}_{addr_space}(global half *out,
+ global {type_name} *in) {{
+{type_name} tmp = in[0];
+volatile {addr_space} short loc[{size}];
+vstore{suffix}{n}(({type_name})0, 0, ({addr_space} half*)loc);
+vstore{suffix}{n}(tmp, 0, ({addr_space} half*)loc + 1);
+for (int i = 0; i < {size}; ++i)
+((global short *)out)[i] = loc[i];
+}}
+
+kernel void vstore{suffix}{n}_{addr_space}_offset(global half *out,
+global {type_name} *in) {{
+{type_name} tmp = ({type_name})0;
+volatile {addr_space} short loc[{offset_size}];
+vstore{suffix}{n}(tmp, 0, ({addr_space} half*)loc);
+vstore{suffix}{n}(tmp, 0, ({addr_space} half*)loc + 1);
+tmp = in[0];
+vstore{suffix}{n}(tmp, 1, ({addr_space} half*)loc + 1);
+for (int i = 0; i < {offset_size}; ++i)
+((global short *)out)[i] = loc[i];
+}}
+""".format(type_name=type_name, n=s, suffix=suffix,
+   offset_size=size*2 + 1, size=size + 1, 
addr_space=addr_space)))
+
+def gen_test_local(suffix, t, mem_type, vec_sizes):
+if (mem_type == 'half'):
+gen_test_local_private_half(suffix, t, vec_sizes, 'local')
+else:
+gen_test_local_private(suffix, t, mem_type, vec_sizes, 'local')
+
+def gen_test_private(suffix, t, mem_type, vec_sizes):
+if (mem_type == 'half'):
+gen_test_local_private_half(suffix, t, vec_sizes, 'private')
+else:
+gen_test_local_private(suffix, t, mem_type, vec_sizes, 'private')
 
 def main():
 utils.safe_makedirs(dirName)
 for t in TYPES:
 gen_test_global('', t, t, VEC_SIZES);
+gen_test_local('', t, t, VEC_SIZES);
+gen_test_private('', t, t, VEC_SIZES);
 
 gen_test_global('_half', 'float',  'half', [''] + VEC_SIZES);
 gen_test_global('_half', 'double', 'half', [''] + VEC_SIZES);
+gen_test_local('_half', 'float',  'half', [''] + VEC_SIZES);
+gen_test_local('_half', 'double', 'half', [''] + VEC_SIZES);
+gen_test_private('_half', 'float',  'half', [''] + VEC_SIZES);
+gen_test_private('_half', 'double', 'half', [''] + VEC_SIZES);
 
 if __name__ == '__main__':
 main()
-- 
2.13

[Piglit] [PATCH v2 3/3] cl: Replace handwritten vload tests with a generator

2017-08-16 Thread Jan Vesely
v2: simplify
mark local storage volatile
Passes on beignet(IVB), and intel CPU

Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
clover on carrizo passes as well, apart from vload_half tests, because
the function is missing in libclc

 generated_tests/CMakeLists.txt |   4 +
 generated_tests/gen_cl_vload_tests.py  | 212 +
 tests/cl.py|   2 +
 tests/cl/program/execute/vload-constant-int.cl |  64 
 tests/cl/program/execute/vload-int.cl  | 175 
 tests/cl/program/execute/vload-local-int.cl| 105 
 tests/cl/program/execute/vload-private-int.cl  | 105 
 7 files changed, 218 insertions(+), 449 deletions(-)
 create mode 100644 generated_tests/gen_cl_vload_tests.py
 delete mode 100644 tests/cl/program/execute/vload-constant-int.cl
 delete mode 100644 tests/cl/program/execute/vload-int.cl
 delete mode 100644 tests/cl/program/execute/vload-local-int.cl
 delete mode 100644 tests/cl/program/execute/vload-private-int.cl

diff --git a/generated_tests/CMakeLists.txt b/generated_tests/CMakeLists.txt
index 44572bdf6..fe82ccfa4 100644
--- a/generated_tests/CMakeLists.txt
+++ b/generated_tests/CMakeLists.txt
@@ -214,6 +214,9 @@ piglit_make_generated_tests(
cl_vstore_tests.list
gen_cl_vstore_tests.py)
 piglit_make_generated_tests(
+   cl_vload_tests.list
+   gen_cl_vload_tests.py)
+piglit_make_generated_tests(
builtin_cl_math_tests.list
gen_cl_math_builtins.py)
 piglit_make_generated_tests(
@@ -271,6 +274,7 @@ add_custom_target(gen-cl-tests
builtin_cl_common_tests.list
cl_store_tests.list
cl_vstore_tests.list
+   cl_vload_tests.list
 )
 
 # Add a "gen-tests" target that can be used to generate all the
diff --git a/generated_tests/gen_cl_vload_tests.py 
b/generated_tests/gen_cl_vload_tests.py
new file mode 100644
index 0..7ebb20fa7
--- /dev/null
+++ b/generated_tests/gen_cl_vload_tests.py
@@ -0,0 +1,212 @@
+# Copyright 2016 Advanced Micro Devices, Inc.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+from __future__ import print_function, division, absolute_import
+import os
+import textwrap
+import random
+
+from six.moves import range
+
+from modules import utils
+
+TYPES = ['char', 'uchar', 'short', 'ushort', 'int', 'uint', 'long', 'ulong', 
'half', 'float', 'double']
+VEC_SIZES = ['2', '4', '8', '16']
+
+dirName = os.path.join("cl", "vload")
+
+
+def gen_array(size):
+random.seed(size)
+return [str(random.randint(0, 255)) for i in range(size)]
+
+
+def ext_req(type_name):
+if type_name[:6] == "double":
+return "require_device_extensions: cl_khr_fp64"
+if type_name[:6] == "half":
+return "require_device_extensions: cl_khr_fp16"
+return ""
+
+def begin_test(suffix, type_name, mem_type, vec_sizes, addr_space):
+fileName = os.path.join(dirName, 'vload'+ suffix + '-' + type_name + '-' + 
addr_space + '.cl')
+print(fileName)
+f = open(fileName, 'w')
+f.write(textwrap.dedent(("""
+/*!
+[config]
+name: Vector load{suffix} {addr_space} {type_name}2,4,8,16
+clc_version_min: 10
+
+dimensions: 1
+global_size: 1 0 0
+""" + ext_req(type_name))
+.format(type_name=type_name, addr_space=addr_space, suffix=suffix)))
+for s in vec_sizes:
+size = int(s) if s != '' else 1
+data_array = gen_array(size)
+ty_name = type_name + s
+f.write(textwrap.dedent("""
+[test]
+name: vector load{suffix} {addr_space} {type_name}
+kernel_name: vload{suffix}{n}_{addr_space}
+arg_in:  0 buffer {mem_type}[{size}] 0 {gen_array}

[Piglit] [PATCH 3/3] cl: Replace handwritten vload tests with a generator

2017-08-16 Thread Jan Vesely
Extend to other types

Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
 generated_tests/CMakeLists.txt |   4 +
 generated_tests/gen_cl_vload_tests.py  | 230 +
 tests/cl.py|   2 +
 tests/cl/program/execute/vload-constant-int.cl |  64 ---
 tests/cl/program/execute/vload-int.cl  | 175 ---
 tests/cl/program/execute/vload-local-int.cl| 105 ---
 tests/cl/program/execute/vload-private-int.cl  | 105 ---
 7 files changed, 236 insertions(+), 449 deletions(-)
 create mode 100644 generated_tests/gen_cl_vload_tests.py
 delete mode 100644 tests/cl/program/execute/vload-constant-int.cl
 delete mode 100644 tests/cl/program/execute/vload-int.cl
 delete mode 100644 tests/cl/program/execute/vload-local-int.cl
 delete mode 100644 tests/cl/program/execute/vload-private-int.cl

diff --git a/generated_tests/CMakeLists.txt b/generated_tests/CMakeLists.txt
index 44572bdf6..fe82ccfa4 100644
--- a/generated_tests/CMakeLists.txt
+++ b/generated_tests/CMakeLists.txt
@@ -214,6 +214,9 @@ piglit_make_generated_tests(
cl_vstore_tests.list
gen_cl_vstore_tests.py)
 piglit_make_generated_tests(
+   cl_vload_tests.list
+   gen_cl_vload_tests.py)
+piglit_make_generated_tests(
builtin_cl_math_tests.list
gen_cl_math_builtins.py)
 piglit_make_generated_tests(
@@ -271,6 +274,7 @@ add_custom_target(gen-cl-tests
builtin_cl_common_tests.list
cl_store_tests.list
cl_vstore_tests.list
+   cl_vload_tests.list
 )
 
 # Add a "gen-tests" target that can be used to generate all the
diff --git a/generated_tests/gen_cl_vload_tests.py 
b/generated_tests/gen_cl_vload_tests.py
new file mode 100644
index 0..82034ee97
--- /dev/null
+++ b/generated_tests/gen_cl_vload_tests.py
@@ -0,0 +1,230 @@
+# Copyright 2016 Advanced Micro Devices, Inc.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+from __future__ import print_function, division, absolute_import
+import os
+import textwrap
+import random
+
+from six.moves import range
+
+from modules import utils
+
+TYPES = ['char', 'uchar', 'short', 'ushort', 'int', 'uint', 'long', 'ulong', 
'half', 'float', 'double']
+VEC_SIZES = ['2', '4', '8', '16']
+
+dirName = os.path.join("cl", "vload")
+
+
+def gen_array(size):
+random.seed(size)
+return [str(random.randint(0, 255)) for i in range(size)]
+
+
+def ext_req(type_name):
+if type_name[:6] == "double":
+return "require_device_extensions: cl_khr_fp64"
+if type_name[:6] == "half":
+return "require_device_extensions: cl_khr_fp16"
+return ""
+
+def begin_test(suffix, type_name, mem_type, vec_sizes, addr_space):
+fileName = os.path.join(dirName, 'vload'+ suffix + '-' + type_name + '-' + 
addr_space + '.cl')
+print(fileName)
+f = open(fileName, 'w')
+f.write(textwrap.dedent(("""
+/*!
+[config]
+name: Vector load{suffix} {addr_space} {type_name}2,4,8,16
+clc_version_min: 10
+
+dimensions: 1
+global_size: 1 0 0
+""" + ext_req(type_name))
+.format(type_name=type_name, addr_space=addr_space, suffix=suffix)))
+for s in vec_sizes:
+size = int(s) if s != '' else 1
+data_array = gen_array(size)
+ty_name = type_name + s
+f.write(textwrap.dedent("""
+[test]
+name: vector load{suffix} {addr_space} {type_name}
+kernel_name: vload{suffix}{n}_{addr_space}
+arg_in:  0 buffer {mem_type}[{size}] 0 {gen_array}
+arg_out: 1 buffer {type_name}[2] {first_array} {gen_array}
+
+[test]
+name: vector load{suffix} {addr_space} offset {type_name}
+kernel_name

[Piglit] [PATCH 2/2] cl: Add private and local versions of vstore tests

2017-08-16 Thread Jan Vesely
vstore_half requires workaround using short as local/private type
Tests pass on clover(Turks,Carrizo,Iceland), beignet(IVB), and intel CPU

Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
 generated_tests/gen_cl_vstore_tests.py | 81 ++
 1 file changed, 81 insertions(+)

diff --git a/generated_tests/gen_cl_vstore_tests.py 
b/generated_tests/gen_cl_vstore_tests.py
index d84541f29..579b55a2e 100644
--- a/generated_tests/gen_cl_vstore_tests.py
+++ b/generated_tests/gen_cl_vstore_tests.py
@@ -116,14 +116,95 @@ def gen_test_global(suffix, t, mem_type, vec_sizes):
 
 f.close()
 
+def gen_test_local_private(suffix, t, mem_type, vec_sizes, addr_space):
+f = begin_test(suffix, t, mem_type, vec_sizes, addr_space)
+for s in vec_sizes:
+size = int(s) if s != '' else 1
+type_name = t + s
+f.write(textwrap.dedent("""
+kernel void vstore{suffix}{n}_{addr_space}(global {mem_type} *out,
+ global {type_name} *in) {{
+{type_name} tmp = in[0];
+{addr_space} {mem_type} loc[{size}];
+vstore{suffix}{n}(({type_name})0, 0, loc);
+vstore{suffix}{n}(tmp, 0, loc + 1);
+for (int i = 0; i < {size}; ++i)
+out[i] = loc[i];
+}}
+
+kernel void vstore{suffix}{n}_{addr_space}_offset(global {mem_type} 
*out,
+global {type_name} *in) {{
+{type_name} tmp = ({type_name})0;
+{addr_space} {mem_type} loc[{offset_size}];
+vstore{suffix}{n}(tmp, 0, loc);
+vstore{suffix}{n}(tmp, 0, loc + 1);
+tmp = in[0];
+vstore{suffix}{n}(tmp, 1, loc + 1);
+for (int i = 0; i < {offset_size}; ++i)
+out[i] = loc[i];
+}}
+""".format(type_name=type_name, mem_type=mem_type, n=s, suffix=suffix,
+   offset_size=size*2 + 1, size=size + 1, 
addr_space=addr_space)))
+
+f.close()
+
+# vstore_half is special, becuase CLC won't allow us to use half type without
+# cl_khr_fp16
+def gen_test_local_private_half(suffix, t, vec_sizes, addr_space):
+f = begin_test(suffix, t, 'half', vec_sizes, addr_space)
+for s in vec_sizes:
+size = int(s) if s != '' else 1
+type_name = t + s
+f.write(textwrap.dedent("""
+kernel void vstore{suffix}{n}_{addr_space}(global half *out,
+ global {type_name} *in) {{
+{type_name} tmp = in[0];
+{addr_space} short loc[{size}];
+vstore{suffix}{n}(({type_name})0, 0, ({addr_space} half*)loc);
+vstore{suffix}{n}(tmp, 0, ({addr_space} half*)loc + 1);
+for (int i = 0; i < {size}; ++i)
+((global short *)out)[i] = loc[i];
+}}
+
+kernel void vstore{suffix}{n}_{addr_space}_offset(global half *out,
+global {type_name} *in) {{
+{type_name} tmp = ({type_name})0;
+{addr_space} short loc[{offset_size}];
+vstore{suffix}{n}(tmp, 0, ({addr_space} half*)loc);
+vstore{suffix}{n}(tmp, 0, ({addr_space} half*)loc + 1);
+tmp = in[0];
+vstore{suffix}{n}(tmp, 1, ({addr_space} half*)loc + 1);
+for (int i = 0; i < {offset_size}; ++i)
+((global short *)out)[i] = loc[i];
+}}
+""".format(type_name=type_name, n=s, suffix=suffix,
+   offset_size=size*2 + 1, size=size + 1, 
addr_space=addr_space)))
+
+def gen_test_local(suffix, t, mem_type, vec_sizes):
+if (mem_type == 'half'):
+gen_test_local_private_half(suffix, t, vec_sizes, 'local')
+else:
+gen_test_local_private(suffix, t, mem_type, vec_sizes, 'local')
+
+def gen_test_private(suffix, t, mem_type, vec_sizes):
+if (mem_type == 'half'):
+gen_test_local_private_half(suffix, t, vec_sizes, 'private')
+else:
+gen_test_local_private(suffix, t, mem_type, vec_sizes, 'private')
 
 def main():
 utils.safe_makedirs(dirName)
 for t in TYPES:
 gen_test_global('', t, t, VEC_SIZES);
+gen_test_local('', t, t, VEC_SIZES);
+gen_test_private('', t, t, VEC_SIZES);
 
 gen_test_global('_half', 'float',  'half', [''] + VEC_SIZES);
 gen_test_global('_half', 'double', 'half', [''] + VEC_SIZES);
+gen_test_local('_half', 'float',  'half', [''] + VEC_SIZES);
+gen_test_local('_half', 'double', 'half', [''] + VEC_SIZES);
+gen_test_private('_half', 'float',  'half', [''] + VEC_SIZES);
+gen_test_private('_half', 'double', 'half', [''] + VEC_SIZES);
 
 if __name__ == '__main__':
 main()
-- 
2.13.5

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


Re: [Piglit] [PATCH 1/1] cl: Add more arithmetic tests to exercise 24bit udiv/umod routines

2017-08-15 Thread Jan Vesely
just a heads up. unless there are objections, I plan to push this in
few days

Jan

On Fri, 2017-08-04 at 16:38 -0400, Jan Vesely wrote:
> based on 9f65c0a26 "cl: Add tests for 24-bit div / rem optimization" by Matt 
> Arsenault
> 
> Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
> ---
>  tests/cl/program/execute/scalar-arithmetic-uint.cl | 1657 
> 
>  1 file changed, 1657 insertions(+)
> 
> diff --git a/tests/cl/program/execute/scalar-arithmetic-uint.cl 
> b/tests/cl/program/execute/scalar-arithmetic-uint.cl
> index 195641621..7c4beabca 100644
> --- a/tests/cl/program/execute/scalar-arithmetic-uint.cl
> +++ b/tests/cl/program/execute/scalar-arithmetic-uint.cl
> @@ -77,6 +77,1165 @@ arg_in:  1 uint 0
>  arg_in:  2 uint 77
>  arg_out: 0 buffer uint[1] 0
>  
> +[test]
> +name: 0 udiv24 num
> +kernel_name: udiv24
> +global_size: 355 0 0
> +
> +arg_out: 0 buffer uint[355] \
> +  4194304   4194303   4194302   4194301   4194300 \
> +  2097152   2097151   2097151   2097150   2097150 \
> +  1398101   1398101   1398100   1398100   1398100 \
> +  1048576   1048575   1048575   1048575   1048575 \
> +  1048576   1048575   1048575   1048574   1048574 \
> +1 1 1 1 1 \
> +1 2 2 2 2 \
> +1 1 1 1 1 \
> +1 1 1 1 1 \
> +3 3 3 3 3 \
> +  4194303   2097151   1048575524287262143 \
> +  128643216 8 \
> +   7373737373 \
> +0 0 0 0 0 \
> +1 0 0 0 0 \
> +0 1 2 0 0 \
> +5 1 1 1 0 \
> +812 0 025 \
> +   14 0 1 1 0 \
> +0 2 1 1 0 \
> +1 1 2 0 1 \
> +1 2 2 1 3 \
> +0 1 0 0 1 \
> +   11 0 1 0 0 \
> +1 071 0 5 \
> +0 0 1 0 0 \
> +1 0 4 0 0 \
> +0 1 013 0 \
> +1 1 0 1 3 \
> +3 0 0 2 4 \
> +1 1 3 0 0 \
> +1 0 1 0 1 \
> +2 1 0 1 1 \
> +0 3 0 7 0 \
> +0 1 2 1 5 \
> +0 2 2 0 0 \
> +3 0 0 0 1 \
> +0 0 0 3 0 \
> +1 0 2 0 0 \
> +0 0 1 0 1 \
> +0 0 0 1 0 \
> +3 1 2 4 0 \
> +1 3 0 1 0 \
> +0 2 0 2 0 \
> +1 2 1 1 3 \
> +6 216 2 1 \
> +1 1 0 1 1 \
> +1 1 0 1 0 \
> +1 1 0 0 0 \
> +1 0 0 1 0 \
> +0 0 1 1 0 \
> +2 16102 3 2   460 \
> +  189 1470016  1973 3 \
> + 3407   24316 7 7 \
> +   30   916 4 4 4 \
> +7 2 3   111 2 \
> +  35428 2 420 \
> +225 8   10252 \
> +4 12707   457   44616 \
> +  390 2 2   484 4 \
> +  452 2  6129   12115 \
> +141023224 7 2 \
> + 344591  7801   203  3415 \
> + 3526  3216  343514 2 \
> +15272   106  3995   231 4 \
> +  1199354 2 7 \
> + 4039  6376   403   114  1007 \
> +2 138263149 3 \
> +299 8 220 \
&

[Piglit] [PATCH 1/1] cl: Add more arithmetic tests to exercise 24bit udiv/umod routines

2017-08-04 Thread Jan Vesely
based on 9f65c0a26 "cl: Add tests for 24-bit div / rem optimization" by Matt 
Arsenault

Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
 tests/cl/program/execute/scalar-arithmetic-uint.cl | 1657 
 1 file changed, 1657 insertions(+)

diff --git a/tests/cl/program/execute/scalar-arithmetic-uint.cl 
b/tests/cl/program/execute/scalar-arithmetic-uint.cl
index 195641621..7c4beabca 100644
--- a/tests/cl/program/execute/scalar-arithmetic-uint.cl
+++ b/tests/cl/program/execute/scalar-arithmetic-uint.cl
@@ -77,6 +77,1165 @@ arg_in:  1 uint 0
 arg_in:  2 uint 77
 arg_out: 0 buffer uint[1] 0
 
+[test]
+name: 0 udiv24 num
+kernel_name: udiv24
+global_size: 355 0 0
+
+arg_out: 0 buffer uint[355] \
+  4194304   4194303   4194302   4194301   4194300 \
+  2097152   2097151   2097151   2097150   2097150 \
+  1398101   1398101   1398100   1398100   1398100 \
+  1048576   1048575   1048575   1048575   1048575 \
+  1048576   1048575   1048575   1048574   1048574 \
+1 1 1 1 1 \
+1 2 2 2 2 \
+1 1 1 1 1 \
+1 1 1 1 1 \
+3 3 3 3 3 \
+  4194303   2097151   1048575524287262143 \
+  128643216 8 \
+   7373737373 \
+0 0 0 0 0 \
+1 0 0 0 0 \
+0 1 2 0 0 \
+5 1 1 1 0 \
+812 0 025 \
+   14 0 1 1 0 \
+0 2 1 1 0 \
+1 1 2 0 1 \
+1 2 2 1 3 \
+0 1 0 0 1 \
+   11 0 1 0 0 \
+1 071 0 5 \
+0 0 1 0 0 \
+1 0 4 0 0 \
+0 1 013 0 \
+1 1 0 1 3 \
+3 0 0 2 4 \
+1 1 3 0 0 \
+1 0 1 0 1 \
+2 1 0 1 1 \
+0 3 0 7 0 \
+0 1 2 1 5 \
+0 2 2 0 0 \
+3 0 0 0 1 \
+0 0 0 3 0 \
+1 0 2 0 0 \
+0 0 1 0 1 \
+0 0 0 1 0 \
+3 1 2 4 0 \
+1 3 0 1 0 \
+0 2 0 2 0 \
+1 2 1 1 3 \
+6 216 2 1 \
+1 1 0 1 1 \
+1 1 0 1 0 \
+1 1 0 0 0 \
+1 0 0 1 0 \
+0 0 1 1 0 \
+2 16102 3 2   460 \
+  189 1470016  1973 3 \
+ 3407   24316 7 7 \
+   30   916 4 4 4 \
+7 2 3   111 2 \
+  35428 2 420 \
+225 8   10252 \
+4 12707   457   44616 \
+  390 2 2   484 4 \
+  452 2  6129   12115 \
+141023224 7 2 \
+ 344591  7801   203  3415 \
+ 3526  3216  343514 2 \
+15272   106  3995   231 4 \
+  1199354 2 7 \
+ 4039  6376   403   114  1007 \
+2 138263149 3 \
+299 8 220 \
+  981 2 8   403   418 \
+1554414   793 2   461
+
+arg_in: 1 buffer uint[355] \
+  4194304   4194303   4194302   4194301   4194300 \
+  4194304   4194303   4194302   4194301   4194300 \
+  4194304   4194303   4194302   4194301   4194300 \
+  4194304   4194303   4194302   4194301   4194300 \
+  2097152   2097151   2097150   2097149   2097148 \
+  4194304   4194303   4194302   4194301   4194300 \
+  8388607   8388606   8388605   8388604   8388603 \
+  8388607   8388606   8388605   8388604   8388603 \
+  8388607   8388606   8388605   8

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

2017-07-30 Thread Jan Vesely
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 <awa...@gmail.com>

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.

regards,
Jan

> 
> --Aaron
> 
> On Wed, Jul 19, 2017 at 5:51 PM, Jan Vesely <jan.ves...@rutgers.edu> 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 <jan.ves...@rutgers.edu>
> > ---
> > 
> > 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-&

Re: [Piglit] [PATCH 1/1] cl: Use required format for sampler test

2017-07-30 Thread Jan Vesely
I plan to push this early next week unless there are objections.

Jan

On Mon, 2017-07-17 at 17:47 -0400, Jan Vesely wrote:
> CL_RGBA + CL_FLOAT is in minimal supported set.
> Fixes sampler test on beignet (IVB).
> 
> Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
> ---
>  tests/cl/program/execute/sampler.cl | 18 +-
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/tests/cl/program/execute/sampler.cl 
> b/tests/cl/program/execute/sampler.cl
> index 45960b778..6de1d4462 100644
> --- a/tests/cl/program/execute/sampler.cl
> +++ b/tests/cl/program/execute/sampler.cl
> @@ -10,12 +10,12 @@ local_size:  1 0 0
>  name: read from image using linear filtering and unnormalized coords
>  kernel_name: readf_f_x
>  
> -arg_in:  1 image float   0.0 1.0 \
> - 2.0 3.0 \
> +arg_in:  1 image float4   0.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0   \
> +  2.0 2.0 2.0 1.0 3.0 3.0 3.0 1.0   \
> image_type 2d \
> image_width 2 \
> image_height 2\
> -   image_channel_order INTENSITY \
> +   image_channel_order RGBA \
> image_channel_data_type FLOAT
>  arg_in:  2 sampler normalized_coords 0   \
> addressing_mode NONE  \
> @@ -27,12 +27,12 @@ arg_out: 0 buffer float[4]  0.0  0.5  1.5 
>  1.0
>  name: read from image using linear filtering and normalized coords
>  kernel_name: readf_f_x
>  
> -arg_in:  1 image float   0.0 1.0 \
> - 2.0 3.0 \
> +arg_in:  1 image float4   0.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0   \
> +  2.0 2.0 2.0 1.0 3.0 3.0 3.0 1.0   \
> image_type 2d \
> image_width 2 \
> image_height 2\
> -   image_channel_order INTENSITY \
> +   image_channel_order RGBA \
> image_channel_data_type FLOAT
>  arg_in:  2 sampler normalized_coords 1   \
> addressing_mode NONE  \
> @@ -44,12 +44,12 @@ arg_out: 0 buffer float[4]   0.0   0.5   1.5  
>  1.0
>  name: read from image using clamp_to_edge addressing mode
>  kernel_name: readf_f_x
>  
> -arg_in:  1 image float   0.0 1.0 \
> - 2.0 3.0 \
> +arg_in:  1 image float4   0.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0   \
> +  2.0 2.0 2.0 1.0 3.0 3.0 3.0 1.0   \
> image_type 2d \
> image_width 2 \
> image_height 2\
> -   image_channel_order INTENSITY \
> +       image_channel_order RGBA \
> image_channel_data_type FLOAT
>  arg_in:  2 sampler normalized_coords 0   \
> addressing_mode CLAMP_TO_EDGE  \

-- 
Jan Vesely <jan.ves...@rutgers.edu>

signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/1] cl: Add kernel_exec and __kernel_exec macro test

2017-07-27 Thread Jan Vesely
Based on attributes test. Passed on beignet (IVB) and clover(Turks) with posted 
libclc patch.

Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
 tests/cl/program/execute/kernel_exec.cl | 39 +
 1 file changed, 39 insertions(+)
 create mode 100644 tests/cl/program/execute/kernel_exec.cl

diff --git a/tests/cl/program/execute/kernel_exec.cl 
b/tests/cl/program/execute/kernel_exec.cl
new file mode 100644
index 0..3afad15f0
--- /dev/null
+++ b/tests/cl/program/execute/kernel_exec.cl
@@ -0,0 +1,39 @@
+/*!
+[config]
+name: kernel_exec macro tests
+clc_version_min: 10
+
+[test]
+name: kernel_exec
+kernel_name: testKernel
+dimensions: 1
+global_size: 4 0 0
+arg_out: 0 buffer int2[4] repeat 5
+
+[test]
+name: __kernel_exec
+kernel_name: test__Kernel
+dimensions: 1
+global_size: 4 0 0
+arg_out: 0 buffer int3[4] repeat 7
+
+!*/
+
+kernel_exec(4, int2) void testKernel(
+   global int2* out
+) {
+   const size_t gid = get_global_id(0);
+   if (gid >= get_global_size(0))
+   return;
+   out[gid] = (int2){5, 5};
+}
+
+__kernel_exec(4, int3) void test__Kernel(
+   global int3* out
+) {
+   const size_t gid = get_global_id(0);
+   if (gid >= get_global_size(0))
+   return;
+   out[gid] = (int3){7, 7, 7};
+}
+
-- 
2.13.3

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


Re: [Piglit] [PATCH 1/1] cl: Use required format for sampler test

2017-07-26 Thread Jan Vesely
ping.

Tom, Zoltan,

you added the original test, does this look OK to you?

thanks,
Jan

On Mon, 2017-07-17 at 17:47 -0400, Jan Vesely wrote:
> CL_RGBA + CL_FLOAT is in minimal supported set.
> Fixes sampler test on beignet (IVB and SKL).
> 
> Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
> ---
>  tests/cl/program/execute/sampler.cl | 18 +-
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/tests/cl/program/execute/sampler.cl 
> b/tests/cl/program/execute/sampler.cl
> index 45960b778..6de1d4462 100644
> --- a/tests/cl/program/execute/sampler.cl
> +++ b/tests/cl/program/execute/sampler.cl
> @@ -10,12 +10,12 @@ local_size:  1 0 0
>  name: read from image using linear filtering and unnormalized coords
>  kernel_name: readf_f_x
>  
> -arg_in:  1 image float   0.0 1.0 \
> - 2.0 3.0 \
> +arg_in:  1 image float4   0.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0   \
> +  2.0 2.0 2.0 1.0 3.0 3.0 3.0 1.0   \
> image_type 2d \
> image_width 2 \
> image_height 2\
> -   image_channel_order INTENSITY \
> +   image_channel_order RGBA \
> image_channel_data_type FLOAT
>  arg_in:  2 sampler normalized_coords 0   \
> addressing_mode NONE  \
> @@ -27,12 +27,12 @@ arg_out: 0 buffer float[4]  0.0  0.5  1.5 
>  1.0
>  name: read from image using linear filtering and normalized coords
>  kernel_name: readf_f_x
>  
> -arg_in:  1 image float   0.0 1.0 \
> - 2.0 3.0 \
> +arg_in:  1 image float4   0.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0   \
> +  2.0 2.0 2.0 1.0 3.0 3.0 3.0 1.0   \
> image_type 2d \
> image_width 2 \
> image_height 2\
> -   image_channel_order INTENSITY \
> +   image_channel_order RGBA \
> image_channel_data_type FLOAT
>  arg_in:  2 sampler normalized_coords 1   \
> addressing_mode NONE  \
> @@ -44,12 +44,12 @@ arg_out: 0 buffer float[4]   0.0   0.5   1.5  
>  1.0
>  name: read from image using clamp_to_edge addressing mode
>  kernel_name: readf_f_x
>  
> -arg_in:  1 image float   0.0 1.0 \
> - 2.0 3.0 \
> +arg_in:  1 image float4   0.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0   \
> +  2.0 2.0 2.0 1.0 3.0 3.0 3.0 1.0   \
> image_type 2d \
> image_width 2 \
> image_height 2\
> -   image_channel_order INTENSITY \
> +   image_channel_order RGBA \
> image_channel_data_type FLOAT
>  arg_in:  2 sampler normalized_coords 0   \
> addressing_mode CLAMP_TO_EDGE  \


signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH v2] cl: Guard against CL version overflow.

2017-07-24 Thread Jan Vesely
On Tue, 2017-07-25 at 00:09 +, Vinson Lee wrote:
> Fix Coverity overflowed return value defect.
> 
> CID: 1364163
> Signed-off-by: Vinson Lee <v...@freedesktop.org>

although it relies on signed overflow wraparound. if it cleans up
coverity output
Acked-by: Jan Vesely <jan.ves...@rutgers.edu>

Jan

> ---
>  tests/util/piglit-framework-cl.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/util/piglit-framework-cl.c 
> b/tests/util/piglit-framework-cl.c
> index 235f160877cf..758508ff902f 100644
> --- a/tests/util/piglit-framework-cl.c
> +++ b/tests/util/piglit-framework-cl.c
> @@ -450,6 +450,7 @@ piglit_cl_get_version_arg(int argc, const char** argv)
>  {
>   int version_major = 0;
>   int version_minor = 0;
> + int version = 0;
>  
>   const char* version_str;
>  
> @@ -466,7 +467,9 @@ piglit_cl_get_version_arg(int argc, const char** argv)
>   }
>   }
>  
> - return version_major*10 + version_minor;
> + version = version_major*10 + version_minor;
> + assert(version > 0);
> + return version;
>  }
>  
>  bool


signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


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

2017-07-19 Thread Jan Vesely
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 <jan.ves...@rutgers.edu>
---

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,
 );
+   } else
+#endif //CL_VERSION_2_0
+   {
+   command_queue = clCreateCommandQueue(cl_ctx,
+env->device_id,
+
mixed_command_queue_properties[1],
+);
+   }
if(errNo != CL_SUCCESS && errNo != CL_INVALID_QUEUE_PROPERTIES) 
{
piglit_cl_check_error(errNo, CL_SUCCESS);
fprintf(stderr,
diff --git a/tests/cl/api/get-mem-object-info.c 
b/tests/cl/api/get-mem-object-info.c
index 2db3b6ae6..5dcb4752d 100644
--- a/tests/cl/api/get-mem-object-info.c
+++ b/tests/cl/api/get-mem-object-info.c
@@ -170,6 +170,14 @@ test(int n,
}
break;
 #endif
+#if defined(CL_VERSION_2_0)
+   case CL_MEM_USES_SVM_POINTER:
+   if (env->version >= 20) {
+   CHECK_SIZE(cl_bool)
+   CHECK_VALUE(cl_bool, CL_FALSE)
+   }
+   break;
+#endif
default:
fprintf(stderr, "Warn: untested parameter %s\n

[Piglit] [PATCH 1/1] cl: Use required format for sampler test

2017-07-17 Thread Jan Vesely
CL_RGBA + CL_FLOAT is in minimal supported set.
Fixes sampler test on beignet (IVB).

Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
 tests/cl/program/execute/sampler.cl | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/tests/cl/program/execute/sampler.cl 
b/tests/cl/program/execute/sampler.cl
index 45960b778..6de1d4462 100644
--- a/tests/cl/program/execute/sampler.cl
+++ b/tests/cl/program/execute/sampler.cl
@@ -10,12 +10,12 @@ local_size:  1 0 0
 name: read from image using linear filtering and unnormalized coords
 kernel_name: readf_f_x
 
-arg_in:  1 image float   0.0 1.0 \
- 2.0 3.0 \
+arg_in:  1 image float4   0.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0   \
+  2.0 2.0 2.0 1.0 3.0 3.0 3.0 1.0   \
image_type 2d \
image_width 2 \
image_height 2\
-   image_channel_order INTENSITY \
+   image_channel_order RGBA \
image_channel_data_type FLOAT
 arg_in:  2 sampler normalized_coords 0   \
addressing_mode NONE  \
@@ -27,12 +27,12 @@ arg_out: 0 buffer float[4]  0.0  0.5  1.5  
1.0
 name: read from image using linear filtering and normalized coords
 kernel_name: readf_f_x
 
-arg_in:  1 image float   0.0 1.0 \
- 2.0 3.0 \
+arg_in:  1 image float4   0.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0   \
+  2.0 2.0 2.0 1.0 3.0 3.0 3.0 1.0   \
image_type 2d \
image_width 2 \
image_height 2\
-   image_channel_order INTENSITY \
+   image_channel_order RGBA \
image_channel_data_type FLOAT
 arg_in:  2 sampler normalized_coords 1   \
addressing_mode NONE  \
@@ -44,12 +44,12 @@ arg_out: 0 buffer float[4]   0.0   0.5   1.5
   1.0
 name: read from image using clamp_to_edge addressing mode
 kernel_name: readf_f_x
 
-arg_in:  1 image float   0.0 1.0 \
- 2.0 3.0 \
+arg_in:  1 image float4   0.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0   \
+  2.0 2.0 2.0 1.0 3.0 3.0 3.0 1.0   \
image_type 2d \
image_width 2 \
image_height 2\
-   image_channel_order INTENSITY \
+   image_channel_order RGBA \
image_channel_data_type FLOAT
 arg_in:  2 sampler normalized_coords 0   \
addressing_mode CLAMP_TO_EDGE  \
-- 
2.13.3

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


Re: [Piglit] [PATCH] cl: Guard against CL version overflow.

2017-07-06 Thread Jan Vesely
On Thu, 2017-07-06 at 18:46 -0400, Ilia Mirkin wrote:
> Would it make more sense to just make all of that unsigned?

or add an assert. This is a very stretched way to appease static
checker.

Jan

> 
> On Thu, Jul 6, 2017 at 5:59 PM, Vinson Lee <v...@freedesktop.org> wrote:
> > Fix Coverity overflowed return value defect.
> > 
> > CID: 1364163
> > Signed-off-by: Vinson Lee <v...@freedesktop.org>
> > ---
> >  tests/util/piglit-framework-cl.c | 8 +++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tests/util/piglit-framework-cl.c 
> > b/tests/util/piglit-framework-cl.c
> > index 235f160877cf..31346b7d8a17 100644
> > --- a/tests/util/piglit-framework-cl.c
> > +++ b/tests/util/piglit-framework-cl.c
> > @@ -450,6 +450,7 @@ piglit_cl_get_version_arg(int argc, const char** argv)
> >  {
> > int version_major = 0;
> > int version_minor = 0;
> > +   int version;
> > 
> > const char* version_str;
> > 
> > @@ -466,7 +467,12 @@ piglit_cl_get_version_arg(int argc, const char** argv)
> > }
> > }
> > 
> > -   return version_major*10 + version_minor;
> > +   version = version_major*10 + version_minor;
> > +   if (version < 0) {
> > +   version = 0;
> > +   }
> > +
> > +   return version;
> >  }
> > 
> >  bool
> > --
> > 2.11.0
> > 
> > ___
> > Piglit mailing list
> > Piglit@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/piglit
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit

-- 
Jan Vesely <jan.ves...@rutgers.edu>

signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/1] cmake: bump gbm dependency to 17.1

2017-06-22 Thread Jan Vesely
c6e1dc5247 switched to use gbm_bo_get_offset and gbm_bo_get_stride_for_plane.
These symbols were added in mesa 17.1. Since there is no alternative to using 
them, bump the gbm requirement to 17.1.

Fixes: c6e1dc5247 "piglit_drm_dma_buf: fix GPU offsets and strides"
Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---
 CMakeLists.txt | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b4dfe4f..90d056b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -137,16 +137,14 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
add_definitions(-DPIGLIT_HAS_GLX)
endif()
 
-   pkg_check_modules(GBM QUIET gbm)
+   pkg_check_modules(GBM QUIET gbm>=17.1)
if(GBM_FOUND)
set(PIGLIT_HAS_GBM True)
add_definitions(-DPIGLIT_HAS_GBM)
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} 
${GBM_LIBRARIES})
-   if (GBM_VERSION VERSION_EQUAL "12.1" OR GBM_VERSION 
VERSION_GREATER "12.1")
-   CHECK_FUNCTION_EXISTS(gbm_bo_map PIGLIT_HAS_GBM_BO_MAP)
-   if (PIGLIT_HAS_GBM_BO_MAP)
-   add_definitions(-DPIGLIT_HAS_GBM_BO_MAP)
-   endif()
+   CHECK_FUNCTION_EXISTS(gbm_bo_map PIGLIT_HAS_GBM_BO_MAP)
+   if (PIGLIT_HAS_GBM_BO_MAP)
+   add_definitions(-DPIGLIT_HAS_GBM_BO_MAP)
endif()
endif(GBM_FOUND)
 
-- 
2.9.4

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


Re: [Piglit] [PATCH] piglit_drm_dma_buf: fix GPU offsets and strides

2017-06-21 Thread Jan Vesely
On Mon, 2017-06-19 at 16:22 -0700, Eric Anholt wrote:
> Marek Olšák  writes:
> 
> > From: Marek Olšák 
> > 
> > Most of the original code is simply wrong.
> > 
> > This patch makes sure that at least the returned GPU offsets and strides
> > are correct. This doesn't fix the incorrect CPU upload path for non-zero
> > planes. GBM doesn't seem to have the capability to map a specific plane
> > for CPU access.
> 
> Reviewed-by: Eric Anholt 

This patch breaks build using older mesa/gbm:
$ rpm -q mesa-libgbm-devel
mesa-libgbm-devel-17.0.5-3.fc25.x86_64

/usr/bin/cc -I/home/vesely/mesa/include -Wall -std=gnu99 -Werror=vla
-Werror=pointer-arith -Werror=variadic-macros -g  -rdynamic
CMakeFiles/point-sprite.dir/point-sprite.c.o  -o ../../../../bin/point-
sprite -Wl,-rpath,/home/vesely/piglit/lib::
../../../../lib/libpiglitutil_gl.so.0 -lGL
../../../../lib/libpiglitutil.so.0 -lrt -ldl -lxkbcommon -lpng -lz -lm
-lEGL -lgbm -lwaffle-1 -ldrm -lxcb -lxcb-dri2 -ldrm_intel -ldrm -lxcb
-lxcb-dri2 -ldrm_intel -lX11 -lwayland-egl -lwayland-client -lGL 
../../../../lib/libpiglitutil_gl.so.0: undefined reference to
`gbm_bo_get_offset'
../../../../lib/libpiglitutil_gl.so.0: undefined reference to
`gbm_bo_get_stride_for_plane'
collect2: error: ld returned 1 exit status

looks like the used functions were added in 17.1, so this needs to bump
gbm requirement (or check for those functions explicitly).

Jan

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


signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH v4] CMake: define GBM_BO_MAP only when symbol is found

2017-05-16 Thread Jan Vesely
On Tue, 2017-05-16 at 15:34 -0500, Daniel Díaz wrote:
> Hello!
> 
> 
> On 05/16/2017 03:06 PM, Jan Vesely wrote:
> > On Mon, 2017-05-15 at 20:27 -0500, Daniel Díaz wrote:
> > > diff --git a/CMakeLists.txt b/CMakeLists.txt index 
> > > a4ff99e..cc26fa8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
> > > @@ -141,8 +141,9 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
> > > if(GBM_FOUND) set(PIGLIT_HAS_GBM True) 
> > > add_definitions(-DPIGLIT_HAS_GBM) -   if (GBM_VERSION 
> > > VERSION_EQUAL "12.1" OR GBM_VERSION VERSION_GREATER "12.1") - 
> > > set(PIGLIT_HAS_GBM_BO_MAP True)
> > 
> > you still need to preserve the above line ^^, otherwise it breaks 
> > the check on line 197.
> 
> But it is still defined, right? The CheckSymbolExists module defines
> PIGLIT_HAS_GBM_BO_MAP which can be used in the condition down below,
> in true ("1") or false ("") form.

ah, right. I missed that you reuse the same variable name.
sorry for the noise. It forced me to dig a bit through cmake docs.
you can add my
Reviewed-by: Jan Vesely <jan.ves...@rutgers.edu>
if Dylan will take it.

Jan
> 
> This snippet (similar to line ~197) seems to work as expected:
>   CHECK_FUNCTION_EXISTS(bogus_fx BOGUS_COND)
>   if(False OR BOGUS_COND)
>   message(FATAL_ERROR "True here")
>   ELSE()
>   message(FATAL_ERROR "False here")
>   ENDIF()
> 
> Please let me know if I'm missing something.
> 
> Thanks and greetings
> 
> Daniel Díaz
> daniel.d...@linaro.org
> 


signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH v4] CMake: define GBM_BO_MAP only when symbol is found

2017-05-16 Thread Jan Vesely
On Mon, 2017-05-15 at 20:27 -0500, Daniel Díaz wrote:
> gbm_bo_map() and _unmap() have been added recently to Mesa,
> and this update may not have reached all implementations of
> GBM, such as the one provided by Mali r6, where said
> definitions can be found in the header file but not in the
> library itself. This leads to errors like the following when
> linking:
>   ../../../../lib/libpiglitutil_gl.so.0: undefined reference to `gbm_bo_unmap'
>   ../../../../lib/libpiglitutil_gl.so.0: undefined reference to `gbm_bo_map'
>   collect2: error: ld returned 1 exit status
>   make[2]: *** [bin/point-sprite] Error 1
> 
> Instead of relying on the header file, actually try to link
> using that symbol to determine if PIGLIT_HAS_GBM_BO_MAP
> should be defined.
> 
> Signed-off-by: Daniel Díaz <daniel.d...@linaro.org>
> ---
> v2: Use CHECK_SYMBOL_EXISTS as suggested by Jan Vesely.
> v3: Back to CHECK_FUNCTION_EXISTS.
> v4: Use ${GBM_LIBRARIES} instead of 'gbm'.
> 
>  CMakeLists.txt | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index a4ff99e..cc26fa8 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -141,8 +141,9 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
>   if(GBM_FOUND)
>   set(PIGLIT_HAS_GBM True)
>   add_definitions(-DPIGLIT_HAS_GBM)
> - if (GBM_VERSION VERSION_EQUAL "12.1" OR GBM_VERSION 
> VERSION_GREATER "12.1")
> - set(PIGLIT_HAS_GBM_BO_MAP True)
you still need to preserve the above line ^^, otherwise it breaks the
check on line 197.

Jan
> + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} 
> ${GBM_LIBRARIES})
> + CHECK_FUNCTION_EXISTS(gbm_bo_map PIGLIT_HAS_GBM_BO_MAP)
> + if (PIGLIT_HAS_GBM_BO_MAP)
>   add_definitions(-DPIGLIT_HAS_GBM_BO_MAP)
>   endif()
>   endif(GBM_FOUND)


signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH v3] CMake: define GBM_BO_MAP only when symbol is found

2017-05-15 Thread Jan Vesely
On Mon, 2017-05-15 at 18:54 -0500, Daniel Díaz wrote:
> gbm_bo_map() and _unmap() have been added recently to Mesa,
> and this update may not have reached all implementations of
> GBM, such as the one provided by Mali r6, where said
> definitions can be found in the header file but not in the
> library itself. This leads to errors like the following when
> linking:
>   ../../../../lib/libpiglitutil_gl.so.0: undefined reference to `gbm_bo_unmap'
>   ../../../../lib/libpiglitutil_gl.so.0: undefined reference to `gbm_bo_map'
>   collect2: error: ld returned 1 exit status
>   make[2]: *** [bin/point-sprite] Error 1
> 
> Instead of relying on the header file, actually try to link
> using that symbol to determine if PIGLIT_HAS_GBM_BO_MAP
> should be defined.
> 
> Signed-off-by: Daniel Díaz <daniel.d...@linaro.org>
> ---
> v2: Use CHECK_SYMBOL_EXISTS as suggested by Jan Vesely.
> v3: Back to CHECK_FUNCTION_EXISTS.

yeah, sorry about that. Since we know that it's a function it does not
really matter.

> 
>  CMakeLists.txt | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index a4ff99e..b9e5050 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -141,8 +141,9 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
>   if(GBM_FOUND)
>   set(PIGLIT_HAS_GBM True)
>   add_definitions(-DPIGLIT_HAS_GBM)
> - if (GBM_VERSION VERSION_EQUAL "12.1" OR GBM_VERSION 
> VERSION_GREATER "12.1")
> - set(PIGLIT_HAS_GBM_BO_MAP True)
The variable is checked in DMA_BUF build condition ^^
> + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} gbm)
It'd be nicer/cleaner to use ${GBM_LIBRARIES} instead of 'gbm'

Jan
> + CHECK_FUNCTION_EXISTS(gbm_bo_map PIGLIT_HAS_GBM_BO_MAP)
> + if (PIGLIT_HAS_GBM_BO_MAP)
>   add_definitions(-DPIGLIT_HAS_GBM_BO_MAP)
>   endif()
>   endif(GBM_FOUND)


signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] CMake: define GBM_BO_MAP only when symbol is found

2017-05-11 Thread Jan Vesely
On Thu, 2017-05-11 at 14:17 -0500, Daniel Díaz wrote:
> gbm_bo_map() and _unmap() have been added recently to Mesa,
> and this update may not have reached all implementations of
> GBM, such as the one provided by Mali r6, where said
> definitions can be found in the header file but not in the
> library itself. This leads to errors like the following when
> linking:
>   ../../../../lib/libpiglitutil_gl.so.0: undefined reference to `gbm_bo_unmap'
>   ../../../../lib/libpiglitutil_gl.so.0: undefined reference to `gbm_bo_map'
>   collect2: error: ld returned 1 exit status
>   make[2]: *** [bin/point-sprite] Error 1
> 
> Instead of relying on the header file, actually try to link
> using that symbol to determine if PIGLIT_HAS_GBM_BO_MAP
> should be defined.
> 
> Signed-off-by: Daniel Díaz 
> ---
>  CMakeLists.txt | 8 ++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index a4ff99e..136cc21 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -141,10 +141,14 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
>   if(GBM_FOUND)
>   set(PIGLIT_HAS_GBM True)
>   add_definitions(-DPIGLIT_HAS_GBM)
> - if (GBM_VERSION VERSION_EQUAL "12.1" OR GBM_VERSION 
> VERSION_GREATER "12.1")
> - set(PIGLIT_HAS_GBM_BO_MAP True)
> + set(OLD_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
> + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} gbm)
> + CHECK_FUNCTION_EXISTS(gbm_bo_map PIGLIT_HAS_GBM_BO_MAP)
> + if (PIGLIT_HAS_GBM_BO_MAP)
>   add_definitions(-DPIGLIT_HAS_GBM_BO_MAP)
>   endif()
> + set(CMAKE_REQUIRED_LIBRARIES ${OLD_REQUIRED_LIBRARIES})
> +

wouldn't it be cleaner to use CheckSymbolExists(gbm_bo_map GBM_HEADERS
PIGLIT_HAS_GBM_BO_MAP)
instead of the autostyle detection?

Jan


>   endif(GBM_FOUND)
>  
>   pkg_check_modules(WAYLAND QUIET wayland-client wayland-egl)


signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/1] cl: Add array of structures to program-scope-arrays test

2017-04-22 Thread Jan Vesely
On Fri, 2017-04-14 at 11:32 -0400, Jan Vesely wrote:
> Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
> ---
>  tests/cl/program/execute/program-scope-arrays.cl | 60 
> 
>  1 file changed, 60 insertions(+)
> 
> diff --git a/tests/cl/program/execute/program-scope-arrays.cl 
> b/tests/cl/program/execute/program-scope-arrays.cl
> index a930da9..cf11e39 100644
> --- a/tests/cl/program/execute/program-scope-arrays.cl
> +++ b/tests/cl/program/execute/program-scope-arrays.cl
> @@ -72,6 +72,32 @@ kernel_name: indirection_2
>  arg_in: 1 buffer uchar[4] 3 2 1 0
>  arg_out: 0 buffer float[8] 1.0 5.0 2.0 5.0 3.0 5.0 4.0 5.0
>  
> +[test]
> +name: simple-constant-struct
> +kernel_name: simple_constant_struct
> +arg_out: 0 buffer float[4] 32.0 32.0 32.0 32.0
> +arg_out: 1 buffer int[4] 42 42 42 42
> +
> +[test]
> +name: given-constant-struct
> +kernel_name: given_constant_struct
> +arg_in: 2 int 2
> +arg_out: 0 buffer float[4] 33.0 33.0 33.0 33.0
> +arg_out: 1 buffer int[4] 43 43 43 43
> +
> +[test]
> +name: simple-gid-struct
> +kernel_name: simple_gid_struct
> +arg_out: 0 buffer float[4] 31.0 32.0 33.0 34.0
> +arg_out: 1 buffer int[4] 41 42 43 44
> +
> +[test]
> +name: indirection-struct
> +kernel_name: indirection_struct
> +arg_in: 2 buffer uchar[4] 3 2 1 0
> +arg_out: 0 buffer float[4] 34.0 33.0 32.0 31.0
> +arg_out: 1 buffer int[4] 44 43 42 41
> +
>  !*/
>  
>  __constant float arr[] = {
> @@ -149,3 +175,37 @@ __kernel void indirection_2(__global float2 *out, 
> __global uchar *in) {
>   int i = get_global_id(0);
>   out[i] = arr2[in[i]];
>  }
> +
> +__constant struct foo {
> + float a;
> + int b;
> +} arrs[] = {
> + {31.0, 41},
> + {32.0, 42},
> + {33.0, 43},
> + {34.0, 44}
> +};
> +
> +__kernel void simple_constant_struct(__global float *outa, __global int 
> *outb) {
> + int i = get_global_id(0);
> + outa[i] = arrs[1].a;
> + outb[i] = arrs[1].b;
> +}
> +
> +__kernel void given_constant_struct(__global float *outa, __global int 
> *outb, int c) {
> + int i = get_global_id(0);
> + outa[i] = arrs[c].a;
> + outb[i] = arrs[c].b;
> +}
> +
> +__kernel void simple_gid_struct(__global float *outa, __global int *outb) {
> + int i = get_global_id(0);
> + outa[i] = arrs[i].a;
> + outb[i] = arrs[i].b;
> +}
> +
> +__kernel void indirection_struct(__global float *outa, __global int *outb, 
> __global uchar *in) {
> + int i = get_global_id(0);
> + outa[i] = arrs[in[i]].a;
> + outb[i] = arrs[in[i]].b;
> +}
ping.
I plan to push this later next week, unless someone objects.

Jan
-- 
Jan Vesely <jan.ves...@rutgers.edu>

signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


  1   2   3   4   >