summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLu Guanqun <guanqun.lu@intel.com>2012-12-25 13:26:55 +0800
committerZhigang Gong <zhigang.gong@linux.intel.com>2013-03-29 19:35:17 +0800
commit4d5f9ccae70a540f040bdb4068954f57a3b8ea30 (patch)
tree170af188adf9d82ace43dc302c456664552bfe0c
parent18dc79be0c89f4785164c132ae0f31b5e085ac9d (diff)
fix assertion when two kernels exist in cl file
The root cause is that it fails to increment `currID` when traversing hash map. Signed-off-by: Lu Guanqun <guanqun.lu@intel.com> Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
-rw-r--r--backend/src/backend/program.hpp1
-rw-r--r--kernels/compiler_multiple_kernels.cl7
-rw-r--r--utests/CMakeLists.txt6
-rw-r--r--utests/compiler_multiple_kernels.cpp8
-rw-r--r--utests/utest_helper.hpp5
5 files changed, 27 insertions, 0 deletions
diff --git a/backend/src/backend/program.hpp b/backend/src/backend/program.hpp
index 646469b5..e0f7dbae 100644
--- a/backend/src/backend/program.hpp
+++ b/backend/src/backend/program.hpp
@@ -134,6 +134,7 @@ namespace gbe {
kernel = pair.second;
break;
}
+ currID++;
}
return kernel;
}
diff --git a/kernels/compiler_multiple_kernels.cl b/kernels/compiler_multiple_kernels.cl
new file mode 100644
index 00000000..d5cea68a
--- /dev/null
+++ b/kernels/compiler_multiple_kernels.cl
@@ -0,0 +1,7 @@
+__kernel void first_kernel(void)
+{
+}
+
+__kernel void second_kernel(void)
+{
+} \ No newline at end of file
diff --git a/utests/CMakeLists.txt b/utests/CMakeLists.txt
index 96409cb2..2b52994a 100644
--- a/utests/CMakeLists.txt
+++ b/utests/CMakeLists.txt
@@ -26,6 +26,12 @@ compiler_shader_toy.cpp
compiler_lower_return0.cpp
compiler_lower_return1.cpp
compiler_lower_return2.cpp
+ compiler_multiple_kernels.cpp
+ compiler_obread.cpp
+ compiler_obwrite.cpp
+ compiler_region.cpp
+ compiler_region0.cpp
+ compiler_region1.cpp
compiler_short_scatter.cpp
compiler_sub_bytes.cpp
compiler_sub_shorts.cpp
diff --git a/utests/compiler_multiple_kernels.cpp b/utests/compiler_multiple_kernels.cpp
new file mode 100644
index 00000000..09b4349b
--- /dev/null
+++ b/utests/compiler_multiple_kernels.cpp
@@ -0,0 +1,8 @@
+#include "utest_helper.hpp"
+
+static void compiler_multiple_kernels(void)
+{
+ OCL_CREATE_KERNEL_FROM_FILE("compiler_multiple_kernels", "first_kernel");
+}
+
+MAKE_UTEST_FROM_FUNCTION(compiler_multiple_kernels); \ No newline at end of file
diff --git a/utests/utest_helper.hpp b/utests/utest_helper.hpp
index 50184334..e1f2395c 100644
--- a/utests/utest_helper.hpp
+++ b/utests/utest_helper.hpp
@@ -52,6 +52,11 @@
OCL_CALL (cl_kernel_init, NAME".cl", NAME, SOURCE); \
} while (0)
+#define OCL_CREATE_KERNEL_FROM_FILE(FILE_NAME, KERNEL_NAME) \
+ do { \
+ OCL_CALL(cl_kernel_init, FILE_NAME".cl", KERNEL_NAME, SOURCE); \
+ } while (0)
+
#define OCL_CREATE_BUFFER(BUFFER, FLAGS, SIZE, DATA) \
do { \
cl_int status; \