[Beignet] [PATCH 5/8] OCL20: Add runtime functions to get the device enqueue info.
Yang Rong
rong.r.yang at intel.com
Fri May 20 07:46:04 UTC 2016
Add two functions gbe_kernel_use_device_enqueue and
gbe_program_get_device_enqueue_kernel_name.
Signed-off-by: Yang Rong <rong.r.yang at intel.com>
---
backend/src/backend/program.cpp | 17 ++++++++++++++++-
backend/src/gbe_bin_interpreter.cpp | 2 ++
src/cl_gbe_loader.cpp | 10 ++++++++++
src/cl_gbe_loader.h | 2 ++
4 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/backend/src/backend/program.cpp b/backend/src/backend/program.cpp
index a1589f4..28818cb 100644
--- a/backend/src/backend/program.cpp
+++ b/backend/src/backend/program.cpp
@@ -90,7 +90,6 @@ namespace gbe {
name(name), args(NULL), argNum(0), curbeSize(0), stackSize(0), useSLM(false),
slmSize(0), ctx(NULL), samplerSet(NULL), imageSet(NULL), printfSet(NULL),
useDeviceEnqueue(false) {}
-
Kernel::~Kernel(void) {
if(ctx) GBE_DELETE(ctx);
if(samplerSet) GBE_DELETE(samplerSet);
@@ -1018,6 +1017,12 @@ if(sizeof(int*) == 8) {
return program->getKernelNum();
}
+ const static char* programGetDeviceEnqueueKernelName(gbe_program gbeProgram, uint32_t index) {
+ if (gbeProgram == NULL) return 0;
+ const gbe::Program *program = (const gbe::Program*) gbeProgram;
+ return program->getDeviceEnqueueKernelName(index);
+ }
+
static gbe_kernel programGetKernelByName(gbe_program gbeProgram, const char *name) {
if (gbeProgram == NULL) return NULL;
const gbe::Program *program = (gbe::Program*) gbeProgram;
@@ -1168,6 +1173,12 @@ if(sizeof(int*) == 8) {
return ps->getPrintfNum();
}
+ static uint32_t kernelUseDeviceEnqueue(gbe_kernel gbeKernel) {
+ if (gbeKernel == NULL) return 0;
+ const gbe::Kernel *kernel = (const gbe::Kernel*) gbeKernel;
+ return kernel->getUseDeviceEnqueue();
+ }
+
static void* kernelDupPrintfSet(gbe_kernel gbeKernel) {
if (gbeKernel == NULL) return NULL;
const gbe::Kernel *kernel = (const gbe::Kernel*) gbeKernel;
@@ -1247,6 +1258,7 @@ GBE_EXPORT_SYMBOL gbe_program_delete_cb *gbe_program_delete = NULL;
GBE_EXPORT_SYMBOL gbe_program_get_kernel_num_cb *gbe_program_get_kernel_num = NULL;
GBE_EXPORT_SYMBOL gbe_program_get_kernel_by_name_cb *gbe_program_get_kernel_by_name = NULL;
GBE_EXPORT_SYMBOL gbe_program_get_kernel_cb *gbe_program_get_kernel = NULL;
+GBE_EXPORT_SYMBOL gbe_program_get_device_enqueue_kernel_name_cb *gbe_program_get_device_enqueue_kernel_name = NULL;
GBE_EXPORT_SYMBOL gbe_kernel_get_name_cb *gbe_kernel_get_name = NULL;
GBE_EXPORT_SYMBOL gbe_kernel_get_attributes_cb *gbe_kernel_get_attributes = NULL;
GBE_EXPORT_SYMBOL gbe_kernel_get_code_cb *gbe_kernel_get_code = NULL;
@@ -1275,6 +1287,7 @@ GBE_EXPORT_SYMBOL gbe_dup_printfset_cb *gbe_dup_printfset = NULL;
GBE_EXPORT_SYMBOL gbe_get_printf_buf_bti_cb *gbe_get_printf_buf_bti = NULL;
GBE_EXPORT_SYMBOL gbe_release_printf_info_cb *gbe_release_printf_info = NULL;
GBE_EXPORT_SYMBOL gbe_output_printf_cb *gbe_output_printf = NULL;
+GBE_EXPORT_SYMBOL gbe_kernel_use_device_enqueue_cb *gbe_kernel_use_device_enqueue = NULL;
#ifdef GBE_COMPILER_AVAILABLE
namespace gbe
@@ -1294,6 +1307,7 @@ namespace gbe
gbe_program_clean_llvm_resource = gbe::programCleanLlvmResource;
gbe_program_delete = gbe::programDelete;
gbe_program_get_kernel_num = gbe::programGetKernelNum;
+ gbe_program_get_device_enqueue_kernel_name = gbe::programGetDeviceEnqueueKernelName;
gbe_program_get_kernel_by_name = gbe::programGetKernelByName;
gbe_program_get_kernel = gbe::programGetKernel;
gbe_kernel_get_name = gbe::kernelGetName;
@@ -1324,6 +1338,7 @@ namespace gbe
gbe_dup_printfset = gbe::kernelDupPrintfSet;
gbe_release_printf_info = gbe::kernelReleasePrintfSet;
gbe_output_printf = gbe::kernelOutputPrintf;
+ gbe_kernel_use_device_enqueue = gbe::kernelUseDeviceEnqueue;
genSetupCallBacks();
}
diff --git a/backend/src/gbe_bin_interpreter.cpp b/backend/src/gbe_bin_interpreter.cpp
index b8c96f2..70b499f 100644
--- a/backend/src/gbe_bin_interpreter.cpp
+++ b/backend/src/gbe_bin_interpreter.cpp
@@ -38,6 +38,7 @@ struct BinInterpCallBackInitializer
gbe_program_get_kernel_num = gbe::programGetKernelNum;
gbe_program_get_kernel_by_name = gbe::programGetKernelByName;
gbe_program_get_kernel = gbe::programGetKernel;
+ gbe_program_get_device_enqueue_kernel_name = gbe::programGetDeviceEnqueueKernelName;
gbe_kernel_get_code_size = gbe::kernelGetCodeSize;
gbe_kernel_get_code = gbe::kernelGetCode;
gbe_kernel_get_arg_num = gbe::kernelGetArgNum;
@@ -71,6 +72,7 @@ struct BinInterpCallBackInitializer
gbe_dup_printfset = gbe::kernelDupPrintfSet;
gbe_release_printf_info = gbe::kernelReleasePrintfSet;
gbe_output_printf = gbe::kernelOutputPrintf;
+ gbe_kernel_use_device_enqueue = gbe::kernelUseDeviceEnqueue;
}
~BinInterpCallBackInitializer() {
diff --git a/src/cl_gbe_loader.cpp b/src/cl_gbe_loader.cpp
index c843850..5abc1fe 100644
--- a/src/cl_gbe_loader.cpp
+++ b/src/cl_gbe_loader.cpp
@@ -44,6 +44,7 @@ gbe_program_delete_cb *interp_program_delete = NULL;
gbe_program_get_kernel_num_cb *interp_program_get_kernel_num = NULL;
gbe_program_get_kernel_by_name_cb *interp_program_get_kernel_by_name = NULL;
gbe_program_get_kernel_cb *interp_program_get_kernel = NULL;
+gbe_program_get_device_enqueue_kernel_name_cb *interp_program_get_device_enqueue_kernel_name = NULL;
gbe_kernel_get_name_cb *interp_kernel_get_name = NULL;
gbe_kernel_get_attributes_cb *interp_kernel_get_attributes = NULL;
gbe_kernel_get_code_cb *interp_kernel_get_code = NULL;
@@ -72,6 +73,7 @@ gbe_dup_printfset_cb* interp_dup_printfset = NULL;
gbe_release_printf_info_cb* interp_release_printf_info = NULL;
gbe_output_printf_cb* interp_output_printf = NULL;
gbe_kernel_get_arg_info_cb *interp_kernel_get_arg_info = NULL;
+gbe_kernel_use_device_enqueue_cb *interp_kernel_use_device_enqueue = NULL;
struct GbeLoaderInitializer
{
@@ -133,6 +135,10 @@ struct GbeLoaderInitializer
if (interp_program_get_kernel == NULL)
return false;
+ interp_program_get_device_enqueue_kernel_name = *(gbe_program_get_device_enqueue_kernel_name_cb**)dlsym(dlhInterp, "gbe_program_get_device_enqueue_kernel_name");
+ if (interp_program_get_device_enqueue_kernel_name == NULL)
+ return false;
+
interp_kernel_get_name = *(gbe_kernel_get_name_cb**)dlsym(dlhInterp, "gbe_kernel_get_name");
if (interp_kernel_get_name == NULL)
return false;
@@ -245,6 +251,10 @@ struct GbeLoaderInitializer
if (interp_kernel_get_arg_info == NULL)
return false;
+ interp_kernel_use_device_enqueue = *(gbe_kernel_use_device_enqueue_cb**)dlsym(dlhInterp, "gbe_kernel_use_device_enqueue");
+ if (interp_kernel_use_device_enqueue == NULL)
+ return false;
+
return true;
}
diff --git a/src/cl_gbe_loader.h b/src/cl_gbe_loader.h
index da3d8d6..cbe990e 100644
--- a/src/cl_gbe_loader.h
+++ b/src/cl_gbe_loader.h
@@ -44,6 +44,7 @@ extern gbe_program_delete_cb *interp_program_delete;
extern gbe_program_get_kernel_num_cb *interp_program_get_kernel_num;
extern gbe_program_get_kernel_by_name_cb *interp_program_get_kernel_by_name;
extern gbe_program_get_kernel_cb *interp_program_get_kernel;
+extern gbe_program_get_device_enqueue_kernel_name_cb *interp_program_get_device_enqueue_kernel_name;
extern gbe_kernel_get_name_cb *interp_kernel_get_name;
extern gbe_kernel_get_attributes_cb *interp_kernel_get_attributes;
extern gbe_kernel_get_code_cb *interp_kernel_get_code;
@@ -72,6 +73,7 @@ extern gbe_dup_printfset_cb* interp_dup_printfset;
extern gbe_release_printf_info_cb* interp_release_printf_info;
extern gbe_output_printf_cb* interp_output_printf;
extern gbe_kernel_get_arg_info_cb *interp_kernel_get_arg_info;
+extern gbe_kernel_use_device_enqueue_cb * interp_kernel_use_device_enqueue;
int CompilerSupported();
#ifdef __cplusplus
--
1.9.1
More information about the Beignet
mailing list