[Mesa-dev] [PATCH v3 09/21] clover: Track flags per module section
Pierre Moreau
pierre.morrow at free.fr
Thu Feb 22 10:43:44 UTC 2018
On 2018-02-21 — 20:04, Aaron Watry wrote:
> On Wed, Feb 21, 2018 at 4:50 PM, Pierre Moreau <pierre.morrow at free.fr> wrote:
> > One flag that needs to be tracked is whether a library is allowed to
> > received mathematics optimisations or not, as the authorisation is given
> > when creating the library while the optimisations are specified when
> > creating the executable.
> >
> > Signed-off-by: Pierre Moreau <pierre.morrow at free.fr>
> > ---
> > src/gallium/state_trackers/clover/core/module.cpp | 1 +
> > src/gallium/state_trackers/clover/core/module.hpp | 13 +++++++++----
> > src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp | 3 ++-
> > src/gallium/state_trackers/clover/llvm/codegen/common.cpp | 2 +-
> > src/gallium/state_trackers/clover/tgsi/compiler.cpp | 3 ++-
> > 5 files changed, 15 insertions(+), 7 deletions(-)
> >
> > diff --git a/src/gallium/state_trackers/clover/core/module.cpp b/src/gallium/state_trackers/clover/core/module.cpp
> > index a6c5b98d8e..0e11506d0d 100644
> > --- a/src/gallium/state_trackers/clover/core/module.cpp
> > +++ b/src/gallium/state_trackers/clover/core/module.cpp
> > @@ -163,6 +163,7 @@ namespace {
> > proc(S &s, QT &x) {
> > _proc(s, x.id);
> > _proc(s, x.type);
> > + _proc(s, x.flags);
> > _proc(s, x.size);
> > _proc(s, x.data);
> > }
> > diff --git a/src/gallium/state_trackers/clover/core/module.hpp b/src/gallium/state_trackers/clover/core/module.hpp
> > index 2ddd26426f..ff7e9b6234 100644
> > --- a/src/gallium/state_trackers/clover/core/module.hpp
> > +++ b/src/gallium/state_trackers/clover/core/module.hpp
> > @@ -41,14 +41,19 @@ namespace clover {
> > data_local,
> > data_private
> > };
> > + enum class flags_t {
> > + none,
> > + allow_link_options
> > + };
> >
> > - section(resource_id id, enum type type, size_t size,
> > - const std::vector<char> &data) :
> > - id(id), type(type), size(size), data(data) { }
> > - section() : id(0), type(text_intermediate), size(0), data() { }
> > + section(resource_id id, enum type type, flags_t flags,
> > + size_t size, const std::vector<char> &data) :
> > + id(id), type(type), flags(flags), size(size), data(data) { }
> > + section() : id(0), type(text_intermediate), flags(flags_t::none), size(0), data() { }
> >
> > resource_id id;
> > type type;
> > + flags_t flags;
> > size_t size;
> > std::vector<char> data;
> > };
> > diff --git a/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp b/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
> > index 40bb426218..8e9d4c7e85 100644
> > --- a/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
> > +++ b/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
> > @@ -84,7 +84,8 @@ clover::llvm::build_module_library(const ::llvm::Module &mod,
> > enum module::section::type section_type) {
> > module m;
> > const auto code = emit_code(mod);
> > - m.secs.emplace_back(0, section_type, code.size(), code);
> > + m.secs.emplace_back(0, section_type, module::section::flags_t::none,
> > + code.size(), code);
> > return m;
> > }
> >
> > diff --git a/src/gallium/state_trackers/clover/llvm/codegen/common.cpp b/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
> > index ddf2083f37..3a08f11fcc 100644
> > --- a/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
> > +++ b/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
> > @@ -179,7 +179,7 @@ namespace {
> > make_text_section(const std::vector<char> &code) {
> > const pipe_llvm_program_header header { uint32_t(code.size()) };
> > module::section text { 0, module::section::text_executable,
> > - header.num_bytes, {} };
> > + module::section::flags_t::none, header.num_bytes, {} };
> >
> > text.data.insert(text.data.end(), reinterpret_cast<const char *>(&header),
> > reinterpret_cast<const char *>(&header) + sizeof(header));
> > diff --git a/src/gallium/state_trackers/clover/tgsi/compiler.cpp b/src/gallium/state_trackers/clover/tgsi/compiler.cpp
> > index e165311fa4..46b8ca7a07 100644
> > --- a/src/gallium/state_trackers/clover/tgsi/compiler.cpp
> > +++ b/src/gallium/state_trackers/clover/tgsi/compiler.cpp
> > @@ -91,7 +91,8 @@ namespace {
> >
> > unsigned sz = tgsi_num_tokens(prog) * sizeof(tgsi_token);
> > std::vector<char> data( (char *)prog, (char *)prog + sz );
> > - m.secs.push_back({ 0, module::section::text_executable, sz, data });
> > + m.secs.push_back({ 0, module::section::text_executable,
> > + module::section::flags_t::none, sz, data });
>
> If you re-order the TGSI-backend removal, this hunk becomes unnecessary.
>
> Might be more trouble than it's worth.
>
> Either way works for me.
You are absolutely right, and I don’t think it will be that hard to do.
> > }
> > }
> >
> > --
> > 2.16.2
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180222/7df23bc2/attachment.sig>
More information about the mesa-dev
mailing list