[Beignet] [PATCH] Fix the bug of forgetting release sampler in utest.

Zhigang Gong zhigang.gong at linux.intel.com
Wed May 21 22:44:44 PDT 2014


LGTM, will push latter, thanks.

On Fri, May 16, 2014 at 03:13:34PM +0800, junyan.he at inbox.com wrote:
> From: Junyan He <junyan.he at linux.intel.com>
> 
> utest helper will not help us to free the sampler resource
> as buffer and kernel. So we need to release it by ourself.
> 
> Signed-off-by: Junyan He <junyan.he at linux.intel.com>
> ---
>  utests/compiler_copy_image.cpp      | 2 ++
>  utests/compiler_copy_image1.cpp     | 2 ++
>  utests/compiler_copy_image_3d.cpp   | 2 ++
>  utests/compiler_movforphi_undef.cpp | 2 ++
>  4 files changed, 8 insertions(+)
> 
> diff --git a/utests/compiler_copy_image.cpp b/utests/compiler_copy_image.cpp
> index 58827f2..82fd02b 100644
> --- a/utests/compiler_copy_image.cpp
> +++ b/utests/compiler_copy_image.cpp
> @@ -41,6 +41,8 @@ static void compiler_copy_image(void)
>        OCL_ASSERT(((uint32_t*)buf_data[0])[j * w + i] == ((uint32_t*)buf_data[1])[j * w + i]);
>    OCL_UNMAP_BUFFER(0);
>    OCL_UNMAP_BUFFER(1);
> +
> +  OCL_CALL(clReleaseSampler, sampler);
>  }
>  
>  MAKE_UTEST_FROM_FUNCTION(compiler_copy_image);
> diff --git a/utests/compiler_copy_image1.cpp b/utests/compiler_copy_image1.cpp
> index d469fbd..df146ca 100644
> --- a/utests/compiler_copy_image1.cpp
> +++ b/utests/compiler_copy_image1.cpp
> @@ -66,6 +66,8 @@ static void compiler_copy_image1(void)
>    OCL_UNMAP_BUFFER(3);
>    OCL_UNMAP_BUFFER(4);
>    OCL_UNMAP_BUFFER(5);
> +
> +  OCL_CALL(clReleaseSampler, sampler);
>  }
>  
>  MAKE_UTEST_FROM_FUNCTION(compiler_copy_image1);
> diff --git a/utests/compiler_copy_image_3d.cpp b/utests/compiler_copy_image_3d.cpp
> index ff493e7..072c99a 100644
> --- a/utests/compiler_copy_image_3d.cpp
> +++ b/utests/compiler_copy_image_3d.cpp
> @@ -53,6 +53,8 @@ static void compiler_copy_image_3d(void)
>  
>    for(uint32_t i = 0; i < depth + 2; i++)
>      OCL_UNMAP_BUFFER_GTT(i);
> +
> +  OCL_CALL(clReleaseSampler, sampler);
>  }
>  
>  MAKE_UTEST_FROM_FUNCTION(compiler_copy_image_3d);
> diff --git a/utests/compiler_movforphi_undef.cpp b/utests/compiler_movforphi_undef.cpp
> index 50526e8..31c7e89 100644
> --- a/utests/compiler_movforphi_undef.cpp
> +++ b/utests/compiler_movforphi_undef.cpp
> @@ -46,6 +46,8 @@ static void compiler_movforphi_undef(void)
>      }
>    OCL_UNMAP_BUFFER(0);
>    OCL_UNMAP_BUFFER(1);
> +
> +  OCL_CALL(clReleaseSampler, sampler);
>  }
>  
>  MAKE_UTEST_FROM_FUNCTION(compiler_movforphi_undef);
> -- 
> 1.8.3.2
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list