[Mesa-dev] [PATCH v6] clover: Introduce CLOVER_EXTRA_*_OPTIONS environment variables

Edward O'Callaghan funfunctor at folklore1984.net
Wed Sep 28 14:22:16 UTC 2016



On 09/29/2016 12:18 AM, Vedran Miletić wrote:
> The options specified in the CLOVER_EXTRA_BUILD_OPTIONS shell
> variable are appended to the options specified by the OpenCL program
> in the clBuildProgram function call, if any.
> Analogously, the options specified in the CLOVER_EXTRA_COMPILE_OPTIONS
> and CLOVER_EXTRA_LINK_OPTIONS variables are appended to the options
> specified in clCompileProgram and clLinkProgram function calls,
> respectively.
> 
> v2:
>  * rename to CLOVER_EXTRA_COMPILER_OPTIONS
>  * use debug_get_option
>  * append to linker options as well
> 
> v3: code cleanups
> 
> v4: separate CLOVER_EXTRA_LINKER_OPTIONS options
> 
> v5:
>  * fix documentation typo
>  * use CLOVER_EXTRA_COMPILER_OPTIONS in link stage
> 
> v6:
>  * separate in CLOVER_EXTRA_{BUILD,COMPILE,LINK}_OPTIONS
>  * append options in cl{Build,Compile,Link}Program
> 
> Signed-off-by: Vedran Miletić <vedran at miletic.net>
> Reviewed-by[v1]: Edward O'Callaghan <funfunctor at folklore1984.net>
Just drop the Rb as soon as you revise any patch please. Obviously there
was a bunch of stuff that happened and discussion..

> ---
>  docs/envvars.html                                 | 15 +++++++++++++++
>  src/gallium/state_trackers/clover/api/program.cpp | 15 +++++++++++----
>  2 files changed, 26 insertions(+), 4 deletions(-)
> 
> diff --git a/docs/envvars.html b/docs/envvars.html
> index cf57ca5..af1a30c 100644
> --- a/docs/envvars.html
> +++ b/docs/envvars.html
> @@ -235,6 +235,21 @@ Setting to "tgsi", for example, will print all the TGSI shaders.
>  See src/mesa/state_tracker/st_debug.c for other options.
>  </ul>
>  
> +<h3>Clover state tracker environment variables</h3>
> +
> +<ul>
> +<li>CLOVER_EXTRA_BUILD_OPTIONS - allows specifying additional compiler and linker
> +    options. Specified options are appended after the options set by the OpenCL
> +    program in clBuildProgram.
> +<li>CLOVER_EXTRA_COMPILE_OPTIONS - allows specifying additional compiler
> +    options. Specified options are appended after the options set by the OpenCL
> +    program in clCompileProgram.
> +<li>CLOVER_EXTRA_LINK_OPTIONS - allows specifying additional linker
> +    options. Specified options are appended after the options set by the OpenCL
> +    program in clLinkProgram.
> +</ul>
> +
> +
>  <h3>Softpipe driver environment variables</h3>
>  <ul>
>  <li>SOFTPIPE_DUMP_FS - if set, the softpipe driver will print fragment shaders
> diff --git a/src/gallium/state_trackers/clover/api/program.cpp b/src/gallium/state_trackers/clover/api/program.cpp
> index c3f9cb9..e842e1f 100644
> --- a/src/gallium/state_trackers/clover/api/program.cpp
> +++ b/src/gallium/state_trackers/clover/api/program.cpp
> @@ -22,6 +22,7 @@
>  
>  #include "api/util.hpp"
>  #include "core/program.hpp"
> +#include "util/u_debug.h"
>  
>  #include <sstream>
>  
> @@ -181,9 +182,11 @@ clBuildProgram(cl_program d_prog, cl_uint num_devs,
>  
>     validate_build_common(prog, num_devs, d_devs, pfn_notify, user_data);
>  
> +   const std::string all_opts = std::string(opts) + " " +
> +                             debug_get_option("CLOVER_EXTRA_BUILD_OPTIONS", "");
>     if (prog.has_source) {
> -      prog.compile(devs, opts);
> -      prog.link(devs, opts, { prog });
> +      prog.compile(devs, all_opts);
> +      prog.link(devs, all_opts, { prog });
>     }
>  
>     return CL_SUCCESS;
> @@ -224,7 +227,9 @@ clCompileProgram(cl_program d_prog, cl_uint num_devs,
>        range(header_names, num_headers),
>        objs<allow_empty_tag>(d_header_progs, num_headers));
>  
> -   prog.compile(devs, opts, headers);
> +   const std::string all_opts = std::string(opts) + " " +
> +                           debug_get_option("CLOVER_EXTRA_COMPILE_OPTIONS", "");
> +   prog.compile(devs, all_opts, headers);
>     return CL_SUCCESS;
>  
>  } catch (invalid_build_options_error &e) {
> @@ -280,8 +285,10 @@ clLinkProgram(cl_context d_ctx, cl_uint num_devs, const cl_device_id *d_devs,
>  
>     validate_build_common(prog, num_devs, d_devs, pfn_notify, user_data);
>  
> +   const std::string all_opts = std::string(opts) + " " +
> +                              debug_get_option("CLOVER_EXTRA_LINK_OPTIONS", "");
>     try {
> -      prog().link(devs, opts, progs);
> +      prog().link(devs, all_opts, progs);
>        ret_error(r_errcode, CL_SUCCESS);
>  
>     } catch (build_error &e) {
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160929/0ea0f4f3/attachment.sig>


More information about the mesa-dev mailing list