[Beignet] [PATCH] Add uncompatible PCH Options to avoid compiling failure.

Zhigang Gong zhigang.gong at linux.intel.com
Fri Sep 5 03:01:50 PDT 2014


Not very elgant but does work.
Pushed, thanks.

On Fri, Sep 05, 2014 at 04:54:27PM +0800, junyan.he at inbox.com wrote:
> From: Junyan He <junyan.he at linux.intel.com>
> 
> Signed-off-by: Junyan He <junyan.he at linux.intel.com>
> ---
>  backend/src/backend/program.cpp |   15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/backend/src/backend/program.cpp b/backend/src/backend/program.cpp
> index 092398c..30e7a0b 100644
> --- a/backend/src/backend/program.cpp
> +++ b/backend/src/backend/program.cpp
> @@ -629,6 +629,7 @@ namespace gbe {
>      std::istringstream idirs(dirs);
>      std::string pchFileName;
>      bool findPCH = false;
> +    bool invalidPCH = false;
>      size_t start = 0, end = 0;
>  
>      std::string hdirs = OCL_HEADER_FILE_DIR;
> @@ -653,6 +654,10 @@ namespace gbe {
>        std::string optionStr(str);
>        const std::string unsupportedOptions("-cl-denorms-are-zero, -cl-strict-aliasing, -cl-opt-disable,"
>                         "-cl-no-signed-zeros, -cl-fp32-correctly-rounded-divide-sqrt");
> +
> +      const std::string uncompatiblePCHOptions = ("-cl-single-precision-constant, -cl-fast-relaxed-math");
> +      const std::string fastMathOption = ("-cl-fast-relaxed-math");
> +
>        while (end != std::string::npos) {
>          end = optionStr.find(' ', start);
>          std::string str = optionStr.substr(start, end - start);
> @@ -663,6 +668,14 @@ namespace gbe {
>          if(unsupportedOptions.find(str) != std::string::npos)
>            continue;
>  
> +        if (uncompatiblePCHOptions.find(str) != std::string::npos)
> +          invalidPCH = true;
> +
> +        if (fastMathOption.find(str) != std::string::npos) {
> +          clOpt.push_back("-D");
> +          clOpt.push_back("__FAST_RELAXED_MATH__=1");
> +        }
> +
>          clOpt.push_back(str);
>        }
>        free(str);
> @@ -688,7 +701,7 @@ namespace gbe {
>      FILE *clFile = fdopen(clFd, "w");
>      FATAL_IF(clFile == NULL, "Failed to open temporary file");
>  
> -    if (!findPCH) {
> +    if (!findPCH || invalidPCH) {
>        clOpt.push_back("-include");
>        clOpt.push_back("ocl.h");
>      } else {
> -- 
> 1.7.9.5
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list