[Beignet] [PATCH] add environment variable OCL_OUTPUT_KERNEL_SOURCE.

Song, Ruiling ruiling.song at intel.com
Mon May 11 20:15:51 PDT 2015


Please also output options: you can output like:
Options:
..........
CL Source:
......
.....

> -----Original Message-----
> From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of
> xionghu.luo at intel.com
> Sent: Tuesday, May 12, 2015 11:04 AM
> To: beignet at lists.freedesktop.org
> Cc: Luo, Xionghu
> Subject: [Beignet] [PATCH] add environment variable
> OCL_OUTPUT_KERNEL_SOURCE.
> 
> From: Luo Xionghu <xionghu.luo at intel.com>
> 
> export the variable to 1 to view the building or compiling kernel's source
> code. By default, it is false and GBE will not print any code.
> 
> Signed-off-by: Luo Xionghu <xionghu.luo at intel.com>
> ---
>  backend/src/backend/program.cpp | 2 ++
>  docs/Beignet/Backend.mdwn       | 3 +++
>  2 files changed, 5 insertions(+)
> 
> diff --git a/backend/src/backend/program.cpp
> b/backend/src/backend/program.cpp index eee7c3c..8f54077 100644
> --- a/backend/src/backend/program.cpp
> +++ b/backend/src/backend/program.cpp
> @@ -634,6 +634,7 @@ namespace gbe {
> 
>    SVAR(OCL_PCH_PATH, OCL_PCH_OBJECT);
>    SVAR(OCL_HEADER_FILE_DIR, OCL_HEADER_DIR);
> +  BVAR(OCL_OUTPUT_KERNEL_SOURCE, false);
> 
>    static bool processSourceAndOption(const char *source,
>                                       const char *options, @@
> -665,6 +666,7 @@ namespace gbe {
>        }
>      }
>      assert(findOcl);
> +    if (OCL_OUTPUT_KERNEL_SOURCE) std::cout << source;
>      std::string includePath  = "-I" + headerFilePath;
>      clOpt.push_back(includePath);
>      bool useDefaultCLCVersion = true;
> diff --git a/docs/Beignet/Backend.mdwn b/docs/Beignet/Backend.mdwn
> index cf80318..583e5d2 100644
> --- a/docs/Beignet/Backend.mdwn
> +++ b/docs/Beignet/Backend.mdwn
> @@ -45,6 +45,9 @@ Environment variables are used all over the code. Most
> important ones are:
>    Normally, you don't need to set it, we will select suitable simd width for
>    a given kernel. Default value is 16.
> 
> +- `OCL_OUTPUT_KENERL_SOURCE` `(0 or 1)`. Output the building or
> +compiling kernel's
> +  source code.
> +
>  - `OCL_OUTPUT_GEN_IR` `(0 or 1)`. Output Gen IR (scalar intermediate
>    representation) code
> 
> --
> 2.1.0
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list