[Beignet] [PATCH 7/7] Test case for global constant arrays

Xing, Homer homer.xing at intel.com
Wed May 1 20:12:44 PDT 2013


OK. Version 4 sent.

-----Original Message-----
From: Zhigang Gong [mailto:zhigang.gong at linux.intel.com] 
Sent: Thursday, May 02, 2013 10:53 AM
To: Xing, Homer
Cc: beignet at lists.freedesktop.org
Subject: Re: [Beignet] [PATCH 7/7] Test case for global constant arrays

On Thu, May 02, 2013 at 09:00:32AM +0800, Homer Hsing wrote:

I pushed the 1-6 patches, except the 7th one. I'm afriad you didn't see my last comments on this patch, so I paste it here.

Subject: Re: [Beignet] [PATCH 7/7] Test case for global constant arrays
User-Agent: Mutt/1.5.21 (2010-09-15)

Homer,

In general, Each unit test case is for one specific function/feature.
I don't think that merging your test cases with the previous Rong's test cases which are for the input constant buffer feature is a good idea.

Could you write new test cases for the global constant buffer?
And I found there is no test cases for more than one global constant buffer, could you also add one more case for that? Thanks.

Thanks.


> Version 3.
> 
> Signed-off-by: Homer Hsing <homer.xing at intel.com>
> ---
>  kernels/compiler_function_constant.cl  | 4 +++-  
> kernels/compiler_function_constant0.cl | 4 +++-  
> utests/compiler_function_constant.cpp  | 3 ++-  
> utests/compiler_function_constant0.cpp | 3 ++-  
> utests/compiler_function_constant1.cpp | 3 ++-
>  5 files changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/kernels/compiler_function_constant.cl 
> b/kernels/compiler_function_constant.cl
> index ca7e874..50931ac 100644
> --- a/kernels/compiler_function_constant.cl
> +++ b/kernels/compiler_function_constant.cl
> @@ -1,6 +1,8 @@
> +constant int h[7] = {71,72,73,74,75,76,77};
> +
>  __kernel void
>  compiler_function_constant(__constant short *c, __global int *dst, 
> int value)  {
>    int id = (int)get_global_id(0);
> -  dst[id] = value + c[id%69];
> +  dst[id] = value + c[id%69] + h[id%7];
>  }
> diff --git a/kernels/compiler_function_constant0.cl 
> b/kernels/compiler_function_constant0.cl
> index f6efcef..afc615f 100644
> --- a/kernels/compiler_function_constant0.cl
> +++ b/kernels/compiler_function_constant0.cl
> @@ -1,6 +1,8 @@
> +constant int h[7] = {71,72,73,74,75,76,77};
> +
>  __kernel void
>  compiler_function_constant0(__constant short *c0, __constant char 
> *c1, __global int *dst, int value)  {
>    int id = (int)get_global_id(0);
> -  dst[id] = value + c0[id%69] + c1[15];
> +  dst[id] = value + c0[id%69] + c1[15] + h[id%7];
>  }
> diff --git a/utests/compiler_function_constant.cpp 
> b/utests/compiler_function_constant.cpp
> index 20f0ece..1d45bae 100644
> --- a/utests/compiler_function_constant.cpp
> +++ b/utests/compiler_function_constant.cpp
> @@ -24,9 +24,10 @@ void compiler_function_constant(void)
>    OCL_NDRANGE(1);
>    OCL_MAP_BUFFER(1);
>  
> +  int h[7] = {71,72,73,74,75,76,77};
>    // Check results
>    for (uint32_t i = 0; i < n; ++i)
> -    OCL_ASSERT(((uint32_t *)buf_data[1])[i] == (value + i%69));
> +    OCL_ASSERT(((uint32_t *)buf_data[1])[i] == (value + i%69 + 
> + h[i%7]));
>  
>    OCL_UNMAP_BUFFER(1);
>  }
> diff --git a/utests/compiler_function_constant0.cpp 
> b/utests/compiler_function_constant0.cpp
> index de564f3..0480dea 100644
> --- a/utests/compiler_function_constant0.cpp
> +++ b/utests/compiler_function_constant0.cpp
> @@ -32,9 +32,10 @@ void compiler_function_constant0(void)
>    OCL_NDRANGE(1);
>    OCL_MAP_BUFFER(2);
>  
> +  int h[7] = {71,72,73,74,75,76,77};
>    // Check results
>    for (uint32_t i = 0; i < n; ++i)
> -    OCL_ASSERT(((uint32_t *)buf_data[2])[i] == (value + 15 + i%69));
> +    OCL_ASSERT(((uint32_t *)buf_data[2])[i] == (value + 15 + i%69 + 
> + h[i%7]));
>  
>    OCL_UNMAP_BUFFER(2);
>  }
> diff --git a/utests/compiler_function_constant1.cpp 
> b/utests/compiler_function_constant1.cpp
> index b92e6ca..b9de815 100644
> --- a/utests/compiler_function_constant1.cpp
> +++ b/utests/compiler_function_constant1.cpp
> @@ -37,9 +37,10 @@ void compiler_function_constant1(void)
>  
>    OCL_MAP_BUFFER(1);
>  
> +  int h[7] = {71,72,73,74,75,76,77};
>    // Check results
>    for (uint32_t i = 0; i < n; ++i)
> -    OCL_ASSERT(((uint32_t *)buf_data[1])[i] == (value + (i%69)*2));
> +    OCL_ASSERT(((uint32_t *)buf_data[1])[i] == (value + (i%69)*2 + 
> + h[i%7]));
>  
>    OCL_UNMAP_BUFFER(1);
>  }
> --
> 1.8.1.2
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list