GBE: fix clang's "incorrect" optimization for barrier call.
authorZhigang Gong <zhigang.gong@intel.com>
Fri, 13 Dec 2013 06:37:58 +0000 (14:37 +0800)
committerZhigang Gong <zhigang.gong@intel.com>
Wed, 18 Dec 2013 06:59:42 +0000 (14:59 +0800)
commit75f9362bb1f17d4e9ec2c58e0c8428f176e617c1
treec1b8e3c36db6f66e111d9a3f7d584abb70345343
parent625d5aa18446206cd6a00a52d8a2094948fd9d93
GBE: fix clang's "incorrect" optimization for barrier call.

Clang may duplicate one barrier call to multiple branches which
breaks opencl's spec and may cause gpu hang. To fix this issue,
we have to implement the barrier in a llvm module file and specify
the function attribute to noduplicate, and we have to link this
pre-compiled module before we compile the user kernel, so we set
it the pcm lib file to the LinkBitCodeFile field of the clang
instance.

v2: fix one typo.

Signed-off-by: Zhigang Gong <zhigang.gong@intel.com>
Reviewed-by: "Yang, Rong R" <rong.r.yang@intel.com>
backend/src/CMakeLists.txt
backend/src/GBEConfig.h.in
backend/src/backend/program.cpp
backend/src/ocl_barrier.ll [new file with mode: 0644]
backend/src/ocl_stdlib.tmpl.h