diff options
author | Zhigang Gong <zhigang.gong@intel.com> | 2014-11-14 08:02:57 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@intel.com> | 2014-11-14 08:08:25 +0800 |
commit | 39f89175c677653c56e36c08c4510fc972da5358 (patch) | |
tree | e3673a7322ff4115a53a4ac9bb274376c3115995 | |
parent | 83357b448ca2eaa8a7e9965d1395baac302f90d0 (diff) |
GBE: work around error reporting for unresolved symbols
Beignet currently doesn't have a good error reporting mechanism
for internal passes. Currently, almost all error will cause an
user unfriendly assert. This is ok for most of the cases, but
it is really not good for unresolve symbols error, as it is not
a real compiler internal bug and we should not assert. We should
report it to help user to identify the error and fix that in the
cl kernel.
This patch is just a work around. We will implement a better
error handling in the future to consolidate all this type of
error into the normal error log buffer.
Signed-off-by: Zhigang Gong <zhigang.gong@intel.com>
-rw-r--r-- | backend/src/llvm/llvm_gen_backend.cpp | 7 | ||||
-rw-r--r-- | backend/src/llvm/llvm_scalarize.cpp | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/backend/src/llvm/llvm_gen_backend.cpp b/backend/src/llvm/llvm_gen_backend.cpp index d1cae585..558491f0 100644 --- a/backend/src/llvm/llvm_gen_backend.cpp +++ b/backend/src/llvm/llvm_gen_backend.cpp @@ -2588,6 +2588,13 @@ namespace gbe // Get the name of the called function and handle it const std::string fnName = Callee->getName(); auto it = instrinsicMap.map.find(fnName); + // FIXME, should create a complete error reporting mechanism + // when found error in beignet managed passes including Gen pass. + if (it == instrinsicMap.map.end()) { + std::cerr << "Unresolved symbol: " << fnName << std::endl; + std::cerr << "Aborting..." << std::endl; + exit(-1); + } GBE_ASSERT(it != instrinsicMap.map.end()); switch (it->second) { case GEN_OCL_GET_GROUP_ID0: diff --git a/backend/src/llvm/llvm_scalarize.cpp b/backend/src/llvm/llvm_scalarize.cpp index 66ccf24c..5450a2b2 100644 --- a/backend/src/llvm/llvm_scalarize.cpp +++ b/backend/src/llvm/llvm_scalarize.cpp @@ -637,6 +637,13 @@ namespace gbe { Value *Callee = call->getCalledValue(); const std::string fnName = Callee->getName(); auto it = instrinsicMap.map.find(fnName); + // FIXME, should create a complete error reporting mechanism + // when found error in beignet managed passes including Gen pass. + if (it == instrinsicMap.map.end()) { + std::cerr << "Unresolved symbol: " << fnName << std::endl; + std::cerr << "Aborting..." << std::endl; + exit(-1); + } GBE_ASSERT(it != instrinsicMap.map.end()); // Get the function arguments |