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


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

2018-09-10 Thread Matt Arsenault
v2: Use uintptr_t

v3: Formatting

v4: More uintptr_t
---
 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();
+}
-- 
2.17.1

___
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-09-05 Thread Matt Arsenault


> 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
___
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 call stack realignment

2018-08-21 Thread Matt Arsenault
ping

> 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;
> +return (addr & 15) == 0;
> +}
> +
> +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
> 

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


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

2018-08-13 Thread Matt Arsenault
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;
+return (addr & 15) == 0;
+}
+
+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

___
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  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 

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-05 Thread Matt Arsenault


> On Apr 4, 2018, at 15:52, Jan Vesely  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___
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-05 Thread Matt Arsenault


> On Apr 4, 2018, at 15:52, Jan Vesely  wrote:
> 
> 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?
> 

This is testing that requirement when the object resides in a frame that isn’t 
the entry point / kernel. The problem was this requirement wasn’t being 
respected because the frame itself wasn’t aligned, so the absolute address of 
the object wasn’t properly aligned.







>>> +
>>> +[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.

Optimizations can use the alignment information to conclude this is always 
true, so the volatile load from memory prevents this


___
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 test for call stack realignment

2018-04-03 Thread Matt Arsenault
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
> +
> +[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 uint addr = (uint)_align16;
> +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
> 

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


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

2018-03-29 Thread Matt Arsenault
---
 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
+
+[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 uint addr = (uint)_align16;
+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

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