Utests: use clGetExtensionFunctionAddressForPlatform

Submitted by Rebecca N. Palmer on Oct. 8, 2016, 1:26 p.m.

Details

Message ID 74c84bde-addf-00b3-d45f-f622b6e77914@zoho.com
State New
Headers show
Series "Utests: use clGetExtensionFunctionAddressForPlatform" ( rev: 1 ) in Beignet

Not browsing as part of any series.

Commit Message

Rebecca N. Palmer Oct. 8, 2016, 1:26 p.m.
This is required to find KHR extensions via ICD, as the loader needs to
know which ICD to send the request to.

If the function is not found, fail the test instead of crashing.
---
 utests/utest_helper.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/utests/utest_helper.cpp b/utests/utest_helper.cpp
index d12dccf..d3fc069 100644
--- a/utests/utest_helper.cpp
+++ b/utests/utest_helper.cpp
@@ -891,7 +891,11 @@  int cl_check_subgroups(void)
     return 0;
   }
   if(utestclGetKernelSubGroupInfoKHR == NULL)
-    utestclGetKernelSubGroupInfoKHR  = (clGetKernelSubGroupInfoKHR_cb*) clGetExtensionFunctionAddress("clGetKernelSubGroupInfoKHR");
+    utestclGetKernelSubGroupInfoKHR  = (clGetKernelSubGroupInfoKHR_cb*) clGetExtensionFunctionAddressForPlatform(platform,"clGetKernelSubGroupInfoKHR");
+  if(utestclGetKernelSubGroupInfoKHR == NULL) {
+    printf("Can't find clGetKernelSubGroupInfoKHR");
+    OCL_ASSERT(0);
+  }
   return 1;
 }
 

Comments

Because clGetExtensionFunctionAddressForPlatform is available from OpenCL 1.2, I think it is better to add the opencl version check, just as clCreateImageFromLibvaIntel in the utest runtime_climage_from_boname.cpp.
Anyway, it is a refinement so I have merged it.

> -----Original Message-----

> From: Beignet [mailto:beignet-bounces@lists.freedesktop.org] On Behalf Of

> Rebecca N. Palmer

> Sent: Saturday, October 8, 2016 21:26

> To: beignet@lists.freedesktop.org

> Subject: [Beignet] [PATCH] Utests: use

> clGetExtensionFunctionAddressForPlatform

> 

> This is required to find KHR extensions via ICD, as the loader needs to know

> which ICD to send the request to.

> 

> If the function is not found, fail the test instead of crashing.

> ---

>  utests/utest_helper.cpp | 6 +++++-

>  1 file changed, 5 insertions(+), 1 deletion(-)

> 

> diff --git a/utests/utest_helper.cpp b/utests/utest_helper.cpp index

> d12dccf..d3fc069 100644

> --- a/utests/utest_helper.cpp

> +++ b/utests/utest_helper.cpp

> @@ -891,7 +891,11 @@ int cl_check_subgroups(void)

>      return 0;

>    }

>    if(utestclGetKernelSubGroupInfoKHR == NULL)

> -    utestclGetKernelSubGroupInfoKHR  = (clGetKernelSubGroupInfoKHR_cb*)

> clGetExtensionFunctionAddress("clGetKernelSubGroupInfoKHR");

> +    utestclGetKernelSubGroupInfoKHR  =

> (clGetKernelSubGroupInfoKHR_cb*)

> +

> clGetExtensionFunctionAddressForPlatform(platform,"clGetKernelSubGroup

> + InfoKHR");  if(utestclGetKernelSubGroupInfoKHR == NULL) {

> +    printf("Can't find clGetKernelSubGroupInfoKHR");

> +    OCL_ASSERT(0);

> +  }

>    return 1;

>  }

> 

> --

> 2.1.4

> 

> 

> _______________________________________________

> Beignet mailing list

> Beignet@lists.freedesktop.org

> https://lists.freedesktop.org/mailman/listinfo/beignet