[Beignet] [PATCH 2/2] Remove deprecated function cl_context_get_static_kernel().
Zhigang Gong
zhigang.gong at intel.com
Wed Jul 15 21:47:47 PDT 2015
Also fix a spelling bug - s/internel/internal.
Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
---
src/cl_context.c | 73 +++++++++-----------------------------------------------
src/cl_context.h | 2 +-
2 files changed, 12 insertions(+), 63 deletions(-)
diff --git a/src/cl_context.c b/src/cl_context.c
index 5b9da23..c45e0aa 100644
--- a/src/cl_context.c
+++ b/src/cl_context.c
@@ -199,16 +199,16 @@ cl_context_delete(cl_context ctx)
/* delete the internal programs. */
for (i = CL_INTERNAL_KERNEL_MIN; i < CL_INTERNAL_KERNEL_MAX; i++) {
- if (ctx->internel_kernels[i]) {
- cl_kernel_delete(ctx->internel_kernels[i]);
- ctx->internel_kernels[i] = NULL;
+ if (ctx->internal_kernels[i]) {
+ cl_kernel_delete(ctx->internal_kernels[i]);
+ ctx->internal_kernels[i] = NULL;
assert(ctx->internal_prgs[i]);
cl_program_delete(ctx->internal_prgs[i]);
ctx->internal_prgs[i] = NULL;
}
- if (ctx->internel_kernels[i]) {
+ if (ctx->internal_kernels[i]) {
cl_kernel_delete(ctx->built_in_kernels[i]);
ctx->built_in_kernels[i] = NULL;
}
@@ -269,57 +269,6 @@ cl_context_get_bufmgr(cl_context ctx)
}
cl_kernel
-cl_context_get_static_kernel(cl_context ctx, cl_int index, const char * str_kernel, const char * str_option)
-{
- cl_int ret;
- if (!ctx->internal_prgs[index]) {
- size_t length = strlen(str_kernel) + 1;
- ctx->internal_prgs[index] = cl_program_create_from_source(ctx, 1, &str_kernel, &length, NULL);
-
- if (!ctx->internal_prgs[index])
- return NULL;
-
- ret = cl_program_build(ctx->internal_prgs[index], str_option);
- if (ret != CL_SUCCESS)
- return NULL;
-
- ctx->internal_prgs[index]->is_built = 1;
-
- /* All CL_ENQUEUE_FILL_BUFFER_ALIGN16_xxx use the same program, different kernel. */
- if (index >= CL_ENQUEUE_FILL_BUFFER_ALIGN8_8 && index <= CL_ENQUEUE_FILL_BUFFER_ALIGN8_64) {
- int i = CL_ENQUEUE_FILL_BUFFER_ALIGN8_8;
- for (; i <= CL_ENQUEUE_FILL_BUFFER_ALIGN8_64; i++) {
- if (index != i) {
- assert(ctx->internal_prgs[i] == NULL);
- assert(ctx->internel_kernels[i] == NULL);
- cl_program_add_ref(ctx->internal_prgs[index]);
- ctx->internal_prgs[i] = ctx->internal_prgs[index];
- }
-
- if (i == CL_ENQUEUE_FILL_BUFFER_ALIGN8_8) {
- ctx->internel_kernels[i] = cl_program_create_kernel(ctx->internal_prgs[index],
- "__cl_fill_region_align8_2", NULL);
- } else if (i == CL_ENQUEUE_FILL_BUFFER_ALIGN8_16) {
- ctx->internel_kernels[i] = cl_program_create_kernel(ctx->internal_prgs[index],
- "__cl_fill_region_align8_4", NULL);
- } else if (i == CL_ENQUEUE_FILL_BUFFER_ALIGN8_32) {
- ctx->internel_kernels[i] = cl_program_create_kernel(ctx->internal_prgs[index],
- "__cl_fill_region_align8_8", NULL);
- } else if (i == CL_ENQUEUE_FILL_BUFFER_ALIGN8_64) {
- ctx->internel_kernels[i] = cl_program_create_kernel(ctx->internal_prgs[index],
- "__cl_fill_region_align8_16", NULL);
- } else
- assert(0);
- }
- } else {
- ctx->internel_kernels[index] = cl_kernel_dup(ctx->internal_prgs[index]->ker[0]);
- }
- }
-
- return ctx->internel_kernels[index];
-}
-
-cl_kernel
cl_context_get_static_kernel_from_bin(cl_context ctx, cl_int index,
const char * str_kernel, size_t size, const char * str_option)
{
@@ -349,31 +298,31 @@ cl_context_get_static_kernel_from_bin(cl_context ctx, cl_int index,
for (; i <= CL_ENQUEUE_FILL_BUFFER_ALIGN8_64; i++) {
if (index != i) {
assert(ctx->internal_prgs[i] == NULL);
- assert(ctx->internel_kernels[i] == NULL);
+ assert(ctx->internal_kernels[i] == NULL);
cl_program_add_ref(ctx->internal_prgs[index]);
ctx->internal_prgs[i] = ctx->internal_prgs[index];
}
if (i == CL_ENQUEUE_FILL_BUFFER_ALIGN8_8) {
- ctx->internel_kernels[i] = cl_program_create_kernel(ctx->internal_prgs[index],
+ ctx->internal_kernels[i] = cl_program_create_kernel(ctx->internal_prgs[index],
"__cl_fill_region_align8_2", NULL);
} else if (i == CL_ENQUEUE_FILL_BUFFER_ALIGN8_16) {
- ctx->internel_kernels[i] = cl_program_create_kernel(ctx->internal_prgs[index],
+ ctx->internal_kernels[i] = cl_program_create_kernel(ctx->internal_prgs[index],
"__cl_fill_region_align8_4", NULL);
} else if (i == CL_ENQUEUE_FILL_BUFFER_ALIGN8_32) {
- ctx->internel_kernels[i] = cl_program_create_kernel(ctx->internal_prgs[index],
+ ctx->internal_kernels[i] = cl_program_create_kernel(ctx->internal_prgs[index],
"__cl_fill_region_align8_8", NULL);
} else if (i == CL_ENQUEUE_FILL_BUFFER_ALIGN8_64) {
- ctx->internel_kernels[i] = cl_program_create_kernel(ctx->internal_prgs[index],
+ ctx->internal_kernels[i] = cl_program_create_kernel(ctx->internal_prgs[index],
"__cl_fill_region_align8_16", NULL);
} else
assert(0);
}
} else {
- ctx->internel_kernels[index] = cl_kernel_dup(ctx->internal_prgs[index]->ker[0]);
+ ctx->internal_kernels[index] = cl_kernel_dup(ctx->internal_prgs[index]->ker[0]);
}
}
- ker = ctx->internel_kernels[index];
+ ker = ctx->internal_kernels[index];
unlock:
pthread_mutex_unlock(&ctx->program_lock);
diff --git a/src/cl_context.h b/src/cl_context.h
index 249fed8..a68a823 100644
--- a/src/cl_context.h
+++ b/src/cl_context.h
@@ -115,7 +115,7 @@ struct _cl_context {
pthread_mutex_t event_lock; /* To allocate and deallocate events */
cl_program internal_prgs[CL_INTERNAL_KERNEL_MAX];
/* All programs internal used, for example clEnqueuexxx api use */
- cl_kernel internel_kernels[CL_INTERNAL_KERNEL_MAX];
+ cl_kernel internal_kernels[CL_INTERNAL_KERNEL_MAX];
/* All kernels for clenqueuexxx api, for example clEnqueuexxx api use */
cl_program built_in_prgs; /*all built-in kernels belongs to this program only*/
cl_kernel built_in_kernels[CL_INTERNAL_KERNEL_MAX];
--
1.9.1
More information about the Beignet
mailing list