[Beignet] [PATCH] Utests: Allow testing cl_intel_accelerator via ICD

Rebecca N. Palmer rebecca_palmer at zoho.com
Mon Oct 10 07:07:24 UTC 2016


> [**** Chuanbo ****] This utest test intel extension cl_intel_accelerator and cl_intel_motion_estimation, so it's not beignet specific,
> but it's intel specific. You can add code such as:
> 	if (!cl_check_accelerator() && !cl_check_motion_estimation()) 
> The implementation of cl_check_accelerator and cl_check_motion_estimation are similar as cl_check_subgroups.

I was going for "not finding this on a beignet device means extension
lookup is broken (which would be a bug), not finding it on other
devices is normal"; this version keeps that while allowing the test
to run on non-beignet devices that do have it, but I haven't has time
to test it (or to check whether we already have a test for extension
lookup).

diff --git a/utests/builtin_kernel_block_motion_estimate_intel.cpp b/utests/builtin_kernel_block_motion_estimate_intel.cpp
index 5a48753..59927d2 100644
--- a/utests/builtin_kernel_block_motion_estimate_intel.cpp
+++ b/utests/builtin_kernel_block_motion_estimate_intel.cpp
@@ -40,8 +40,13 @@ void builtin_kernel_block_motion_estimate_intel(void)
   oclCreateAcceleratorIntel  = (OCLCREATEACCELERATORINTEL*)clGetExtensionFunctionAddress("clCreateAcceleratorINTEL");
 #endif
   if(!oclCreateAcceleratorIntel){
+    // This is expected on non-Intel devices, but a bug (broken extension lookup) on Intel devices
+    if (!cl_check_beignet()) {
+      printf("Not beignet device , Skip!");
+      return;
+    }
     fprintf(stderr, "Failed to get extension clCreateImageFromLibvaIntel\n");
-    exit(1);
+    OCL_ASSERT(0);
   }
   cl_accelerator_intel accel = oclCreateAcceleratorIntel(ctx, CL_ACCELERATOR_TYPE_MOTION_ESTIMATION_INTEL,sizeof(cl_motion_estimation_desc_intel), &vmedesc, &err);
   OCL_ASSERT(accel != NULL);
@@ -123,7 +128,7 @@ void builtin_kernel_block_motion_estimate_intel(void)
 #endif
   if(!oclReleaseAcceleratorIntel){
     fprintf(stderr, "Failed to get extension clCreateImageFromLibvaIntel\n");
-    exit(1);
+    OCL_ASSERT(0);
   }
   oclReleaseAcceleratorIntel(accel);
   clReleaseProgram(built_in_prog);



More information about the Beignet mailing list