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

junyan.he at inbox.com junyan.he at inbox.com
Fri May 16 00:13:34 PDT 2014


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



More information about the Beignet mailing list