Utests: Allow testing cl_intel_accelerator via ICD

Submitted by Rebecca N. Palmer on Oct. 10, 2016, 7:07 a.m.

Details

Message ID e9071d88-5034-2770-e238-5abe10c59cc2@zoho.com
State New
Headers show
Series "Utests: Allow testing cl_intel_accelerator via ICD" ( rev: 3 ) in Beignet

Not browsing as part of any series.

Commit Message

Rebecca N. Palmer Oct. 10, 2016, 7:07 a.m.
> [**** 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).

Patch hide | download patch | download mbox

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);