[Beignet] [PATCH 2/3] Implement API clGetKernelInfo
Ruiling Song
ruiling.song at intel.com
Sun Jun 30 22:46:20 PDT 2013
Signed-off-by: Ruiling Song <ruiling.song at intel.com>
---
src/cl_api.c | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/src/cl_api.c b/src/cl_api.c
index b3d8f71..dc52f0a 100644
--- a/src/cl_api.c
+++ b/src/cl_api.c
@@ -919,8 +919,29 @@ clGetKernelInfo(cl_kernel kernel,
void * param_value,
size_t * param_value_size_ret)
{
- NOT_IMPLEMENTED;
- return 0;
+ cl_int err;
+
+ CHECK_KERNEL(kernel);
+
+ if (param_name == CL_KERNEL_CONTEXT) {
+ FILL_GETINFO_RET (cl_context, 1, &kernel->program->ctx, CL_SUCCESS);
+ } else if (param_name == CL_KERNEL_PROGRAM) {
+ FILL_GETINFO_RET (cl_program, 1, &kernel->program, CL_SUCCESS);
+ } else if (param_name == CL_KERNEL_NUM_ARGS) {
+ cl_uint n = kernel->arg_n;
+ FILL_GETINFO_RET (cl_uint, 1, &n, CL_SUCCESS);
+ } else if (param_name == CL_KERNEL_REFERENCE_COUNT) {
+ cl_int ref = kernel->ref_n;
+ FILL_GETINFO_RET (cl_int, 1, &ref, CL_SUCCESS);
+ } else if (param_name == CL_KERNEL_FUNCTION_NAME) {
+ const char * n = cl_kernel_get_name(kernel);
+ FILL_GETINFO_RET (cl_char, strlen(n)+1, n, CL_SUCCESS);
+ } else {
+ return CL_INVALID_VALUE;
+ }
+
+error:
+ return err;
}
cl_int
--
1.7.9.5
More information about the Beignet
mailing list