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

Jan Vesely jan.vesely at rutgers.edu
Wed Apr 4 19:52:27 UTC 2018


On Tue, 2018-04-03 at 18:03 -0400, Matt Arsenault wrote:
> ping
> 
> > On Mar 29, 2018, at 10:35, Matt Arsenault <arsenm2 at gmail.com> 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 000000000..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)&requires_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)&requires_align32;
> > +    return (addr & 31) == 0;
> > +}
> > +
> > +NOINLINE
> > +int test_stack_object_alignment64() {
> > +    volatile int16 requires_align64 = 0;
> > +    volatile uint addr = (uint)&requires_align64;
> > +    return (addr & 63) == 0;
> > +}
> > +
> > +NOINLINE
> > +int test_stack_object_alignment128() {
> > +    volatile long16 requires_align128 = 0;
> > +    volatile uint addr = (uint)&requires_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
> > 
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20180404/81a23ccb/attachment.sig>


More information about the Piglit mailing list