[Beignet] [PATCH V2] fix the condition to check if there are built-in kernels

Guo Yejun yejun.guo at intel.com
Sun Aug 21 18:57:57 UTC 2016


an empty string is returned if no built-in kernels are supported
by the device, and so the returned size is 1, not 0.

v2: output "Skip!" to make the result clear
Signed-off-by: Guo Yejun <yejun.guo at intel.com>
---
 utests/builtin_kernel_max_global_size.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/utests/builtin_kernel_max_global_size.cpp b/utests/builtin_kernel_max_global_size.cpp
index d3e8373..ad9c028 100644
--- a/utests/builtin_kernel_max_global_size.cpp
+++ b/utests/builtin_kernel_max_global_size.cpp
@@ -10,8 +10,10 @@ void builtin_kernel_max_global_size(void)
 
 
   OCL_CALL (clGetDeviceInfo, device, CL_DEVICE_BUILT_IN_KERNELS, 0, 0, &built_in_kernels_size);
-  if(built_in_kernels_size == 0)
+  if(built_in_kernels_size <= 1) { //the size of empty string is 1
+    printf(" no built in kernel, Skip!");
     return;
+  }
 
   built_in_kernel_names = (char* )malloc(built_in_kernels_size * sizeof(char) );
   OCL_CALL(clGetDeviceInfo, device, CL_DEVICE_BUILT_IN_KERNELS, built_in_kernels_size, (void*)built_in_kernel_names, &ret_sz);
-- 
1.9.1



More information about the Beignet mailing list