[Beignet] [PATCH] output message instead of assert when .bc file does not exist

Guo Yejun yejun.guo at intel.com
Thu Jun 16 19:27:48 UTC 2016


it is possible that .bc file is missing in the system, provide end
users with detail message.

Signed-off-by: Guo Yejun <yejun.guo at intel.com>
---
 backend/src/llvm/llvm_bitcode_link.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/backend/src/llvm/llvm_bitcode_link.cpp b/backend/src/llvm/llvm_bitcode_link.cpp
index 990babd..748a7fe 100644
--- a/backend/src/llvm/llvm_bitcode_link.cpp
+++ b/backend/src/llvm/llvm_bitcode_link.cpp
@@ -50,7 +50,10 @@ namespace gbe
         break;
       }
     }
-    assert(findBC);
+    if (!findBC) {
+      printf("Fatal Error: ocl lib %s does not exist\n", bitCodeFiles.c_str());
+      return NULL;
+    }
 
 #if LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR <= 5
     oclLib = getLazyIRFileModule(FilePath, Err, ctx);
@@ -138,7 +141,8 @@ namespace gbe
     std::set<std::string> materializedFuncs;
     std::vector<GlobalValue *> Gvs;
     Module* clonedLib = createOclBitCodeModule(ctx, strictMath);
-    assert(clonedLib && "Can not create the beignet bitcode\n");
+    if (clonedLib == NULL)
+      return NULL;
 
     std::vector<const char *> kernels;
     std::vector<const char *> builtinFuncs;
-- 
1.9.1



More information about the Beignet mailing list