[Beignet] [PATCH] Clear atomic dst buffer to fix atomic random fail.
Zhigang Gong
zhigang.gong at linux.intel.com
Mon Jul 1 01:37:27 PDT 2013
LGTM, pushed, thanks.
On Mon, Jul 01, 2013 at 01:38:48PM +0800, Yang Rong wrote:
> Because atomic's address used as src and dst, so need to clear this address.
>
> Signed-off-by: Yang Rong <rong.r.yang at intel.com>
> ---
> utests/compiler_atomic_functions.cpp | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/utests/compiler_atomic_functions.cpp b/utests/compiler_atomic_functions.cpp
> index 71e8384..571e0c6 100644
> --- a/utests/compiler_atomic_functions.cpp
> +++ b/utests/compiler_atomic_functions.cpp
> @@ -1,6 +1,7 @@
> #include "utest_helper.hpp"
> #include <cmath>
> #include <algorithm>
> +#include <string.h>
>
> #define GROUP_NUM 16
> #define LOCAL_SIZE 64
> @@ -71,6 +72,10 @@ static void compiler_atomic_functions(void)
> OCL_SET_ARG(1, 16 * sizeof(int), NULL);
> OCL_SET_ARG(2, sizeof(cl_mem), &buf[1]);
>
> + OCL_MAP_BUFFER(0);
> + memset(buf_data[0], 0, 16 * sizeof(int));
> + OCL_UNMAP_BUFFER(0);
> +
> OCL_MAP_BUFFER(1);
> for (uint32_t i = 0; i < locals[0]; ++i)
> cpu_src[i] = ((int*)buf_data[1])[i] = rand() & 0xff;
> --
> 1.7.10.4
>
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet
More information about the Beignet
mailing list