[Mesa-dev] [PATCH 3/7] clover: split module::section::text

Tom Stellard tom at stellard.net
Fri Dec 19 13:14:47 PST 2014


On Sun, Dec 14, 2014 at 11:31:23AM +0100, EdB wrote:
> OpenCL 1.2 make distinction between 3 binaries kind:
>  executable as produce by clBuildProgram and clLinkProgam
>  compiled as produce by clCompileProgram
>  library as produce by clLinkProgam with -create-library option

s/produce/produced/

> ---
>  src/gallium/state_trackers/clover/core/kernel.cpp     | 2 +-
>  src/gallium/state_trackers/clover/core/module.hpp     | 6 ++++--
>  src/gallium/state_trackers/clover/llvm/invocation.cpp | 4 ++--
>  src/gallium/state_trackers/clover/tgsi/compiler.cpp   | 3 ++-
>  4 files changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/src/gallium/state_trackers/clover/core/kernel.cpp b/src/gallium/state_trackers/clover/core/kernel.cpp
> index 442762c..ed4b9b0 100644
> --- a/src/gallium/state_trackers/clover/core/kernel.cpp
> +++ b/src/gallium/state_trackers/clover/core/kernel.cpp
> @@ -156,7 +156,7 @@ kernel::exec_context::bind(intrusive_ptr<command_queue> _q,
>     // Bind kernel arguments.
>     auto &m = kern.program().binary(q->device());
>     auto margs = find(name_equals(kern.name()), m.syms).args;
> -   auto msec = find(type_equals(module::section::text), m.secs);
> +   auto msec = find(type_equals(module::section::text_executable), m.secs);
>     auto explicit_arg = kern._args.begin();
>  
>     for (auto &marg : margs) {
> diff --git a/src/gallium/state_trackers/clover/core/module.hpp b/src/gallium/state_trackers/clover/core/module.hpp
> index ee6caf9..200b9de 100644
> --- a/src/gallium/state_trackers/clover/core/module.hpp
> +++ b/src/gallium/state_trackers/clover/core/module.hpp
> @@ -32,7 +32,9 @@ namespace clover {
>  
>        struct section {
>           enum type {
> -            text,
> +            text_executable,
> +            text_compiled,

>From clover's perspective, what is the difference between text_executable
and text_compiled?


> +            text_library,
>              data_constant,
>              data_global,
>              data_local,
> @@ -42,7 +44,7 @@ namespace clover {
>           section(resource_id id, enum type type, size_t size,
>                   const compat::vector<char> &data) :
>                   id(id), type(type), size(size), data(data) { }
> -         section() : id(0), type(text), size(0), data() { }
> +         section() : id(0), type(text_executable), size(0), data() { }
>  
>           resource_id id;
>           type type;
> diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp b/src/gallium/state_trackers/clover/llvm/invocation.cpp
> index 510e195..1eb47f5 100644
> --- a/src/gallium/state_trackers/clover/llvm/invocation.cpp
> +++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp
> @@ -457,7 +457,7 @@ namespace {
>        data.insert(0, (char*)(&header), sizeof(header));
>        data.insert(data.end(), llvm_bitcode.begin(),
>                                    llvm_bitcode.end());
> -      m.secs.push_back(module::section(0, module::section::text,
> +      m.secs.push_back(module::section(0, module::section::text_executable,
>                                         header.num_bytes, data));
>  
>        return m;
> @@ -622,7 +622,7 @@ namespace {
>        std::string data;
>        data.append((char*)(&header), sizeof(header));
>        data.append(code.begin(), code.end());
> -      m.secs.push_back(module::section(0, module::section::text,
> +      m.secs.push_back(module::section(0, module::section::text_executable,
>                                         header.num_bytes, data));
>  
>        for (std::map<std::string, unsigned>::iterator i = kernel_offsets.begin(),
> diff --git a/src/gallium/state_trackers/clover/tgsi/compiler.cpp b/src/gallium/state_trackers/clover/tgsi/compiler.cpp
> index 93dfeb5..d901d2b 100644
> --- a/src/gallium/state_trackers/clover/tgsi/compiler.cpp
> +++ b/src/gallium/state_trackers/clover/tgsi/compiler.cpp
> @@ -83,7 +83,8 @@ namespace {
>           throw build_error("translate failed");
>  
>        unsigned sz = tgsi_num_tokens(prog) * sizeof(tgsi_token);
> -      m.secs.push_back({ 0, module::section::text, sz, { (char *)prog, sz } });
> +      m.secs.push_back({ 0, module::section::text_executable,
> +                         sz, { (char *)prog, sz } });
>     }
>  }
>  
> -- 
> 2.2.0
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list