I noticed that almost nothing in pocl depends on the fact that kernels are written in OpenCL C. With a minimal patch, we can support other languages as well. And when discussing OpenCL with others, I generally find that most people would prefer to have some kind of templating mechanism available, as is offered e.g. by C++.
What do you think?
-erik
This is the patch required for pocl to accept a kernel build option
"-DPOCL_KERNEL_CXX" that builds kernel as C++ instead of as OpenCL C:
diff --git a/scripts/pocl-build.in b/scripts/pocl-build.in
index cf6ea65..709737b 100644
--- a/scripts/pocl-build.in
+++ b/scripts/pocl-build.in
@@ -91,4 +91,8 @@ else
include_cmd="-include $kernel_h"
fi
-@CLANG@ -I. @CLFLAGS@ @FORCED_CLFLAGS@ ${EXTRA_CPPFLAGS} ${USER_OPTIONS}
${CLANG_FLAGS} -c ${include_cmd} -emit-llvm -o ${output_file} -x cl $1
+if echo '' "$USER_OPTIONS" '' | grep -q -e ' -DPOCL_KERNEL_CXX '; then
+ @CLANG@ -I. @CLFLAGS@ @FORCED_CLFLAGS@ ${EXTRA_CPPFLAGS} ${USER_OPTIONS}
${CLANG_FLAGS} -c -emit-llvm -o ${output_file} -x c++ $1
+else
+ @CLANG@ -I. @CLFLAGS@ @FORCED_CLFLAGS@ ${EXTRA_CPPFLAGS} ${USER_OPTIONS}
${CLANG_FLAGS} -c ${include_cmd} -emit-llvm -o ${output_file} -x cl $1
+fi
In addition, a small patch to clang is required:
Index: include/clang/Basic/TokenKinds.def
===================================================================
--- include/clang/Basic/TokenKinds.def (revision 194333)
+++ include/clang/Basic/TokenKinds.def (working copy)
@@ -436,7 +436,7 @@
KEYWORD(__unaligned , KEYMS)
// OpenCL-specific keywords
-KEYWORD(__kernel , KEYOPENCL)
+KEYWORD(__kernel , KEYALL)
ALIAS("kernel", __kernel , KEYOPENCL)
KEYWORD(vec_step , KEYOPENCL|KEYALTIVEC)
KEYWORD(__private , KEYOPENCL)
-erik
--
Erik Schnetter <[email protected]>
http://www.perimeterinstitute.ca/personal/eschnetter/
My email is as private as my paper mail. I therefore support encrypting
and signing email messages. Get my PGP key from http://pgp.mit.edu/.
signature.asc
Description: Message signed with OpenPGP using GPGMail
------------------------------------------------------------------------------ Shape the Mobile Experience: Free Subscription Software experts and developers: Be at the forefront of tech innovation. Intel(R) Software Adrenaline delivers strategic insight and game-changing conversations that shape the rapidly evolving mobile landscape. Sign up now. http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________ pocl-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pocl-devel
