summaryrefslogtreecommitdiff
path: root/backend/src/llvm/llvm_bitcode_link.cpp
diff options
context:
space:
mode:
authorJunyan He <junyan.he@linux.intel.com>2014-09-10 16:10:28 +0800
committerZhigang Gong <zhigang.gong@intel.com>2014-09-10 16:27:19 +0800
commit077337848a738fe0f9cae7b786b64ad8e5a5782d (patch)
tree870dc2bfb8138b2caaa2ddfb3f5bbe18c4177487 /backend/src/llvm/llvm_bitcode_link.cpp
parent423dbb0d2389dea27dd451cf458b06df92c27ecb (diff)
Add the switch logic for math conformance fast path
Modify the __ocl_math_fastpath_flag init value in the backend link stage to switch between fast path and conformance path. V2: Rename the function prototype parameter name. V3: Modify the parameter to boolean and correct some comment words. Signed-off-by: Junyan He <junyan.he@linux.intel.com> Reviewed-by: "Song, Ruiling" <ruiling.song@intel.com>
Diffstat (limited to 'backend/src/llvm/llvm_bitcode_link.cpp')
-rw-r--r--backend/src/llvm/llvm_bitcode_link.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/backend/src/llvm/llvm_bitcode_link.cpp b/backend/src/llvm/llvm_bitcode_link.cpp
index 7841db2..d845479 100644
--- a/backend/src/llvm/llvm_bitcode_link.cpp
+++ b/backend/src/llvm/llvm_bitcode_link.cpp
@@ -50,7 +50,7 @@ SVAR(OCL_BITCODE_LIB_PATH, OCL_BITCODE_BIN);
namespace gbe
{
- static Module* createOclBitCodeModule(LLVMContext& ctx)
+ static Module* createOclBitCodeModule(LLVMContext& ctx, bool strictMath)
{
std::string bitCodeFiles = OCL_BITCODE_LIB_PATH;
std::istringstream bitCodeFilePath(bitCodeFiles);
@@ -73,6 +73,13 @@ namespace gbe
return NULL;
}
+ if (strictMath) {
+ llvm::GlobalVariable* mathFastFlag = oclLib->getGlobalVariable("__ocl_math_fastpath_flag");
+ assert(mathFastFlag);
+ Type* intTy = IntegerType::get(ctx, 32);
+ mathFastFlag->setInitializer(ConstantInt::get(intTy, 0));
+ }
+
return oclLib;
}
@@ -126,11 +133,11 @@ namespace gbe
}
- Module* runBitCodeLinker(Module *mod)
+ Module* runBitCodeLinker(Module *mod, bool strictMath)
{
LLVMContext& ctx = mod->getContext();
std::set<std::string> materializedFuncs;
- Module* clonedLib = createOclBitCodeModule(ctx);
+ Module* clonedLib = createOclBitCodeModule(ctx, strictMath);
assert(clonedLib && "Can not create the beignet bitcode\n");
std::vector<const char *> kernels;