[Beignet] [PATCH 7/7] Test case for global constant arrays
Zhigang Gong
zhigang.gong at linux.intel.com
Sat Apr 27 03:49:48 PDT 2013
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.
On Thu, Apr 25, 2013 at 02:21:48PM +0800, Homer Hsing wrote:
>
> 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