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

Yang, Rong R rong.r.yang at intel.com
Thu Jun 23 05:42:04 UTC 2016


LGTM, pushed, thanks.

> -----Original Message-----
> From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of
> Guo Yejun
> Sent: Friday, June 17, 2016 3:28
> To: beignet at lists.freedesktop.org
> Cc: Guo, Yejun <yejun.guo at intel.com>
> Subject: [Beignet] [PATCH] output message instead of assert when .bc file
> does not exist
> 
> 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
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list