diff options
author | Pierre Moreau <[email protected]> | 2018-02-10 16:56:11 +0100 |
---|---|---|
committer | Karol Herbst <[email protected]> | 2019-02-26 21:02:07 +0100 |
commit | 67769c913f2e1608530779be207bcb1eb46f3a90 (patch) | |
tree | f9f68a397aedf66ae19592a6597d610ac5039e1b | |
parent | 669d00ba4cabf444de12eb3663c5251b519e1681 (diff) |
clover: Remove the TGSI backend as unused
Reviewed-by: Karol Herbst <[email protected]>
Reviewed-by: Francisco Jerez <[email protected]>
-rw-r--r-- | src/gallium/state_trackers/clover/Makefile.am | 11 | ||||
-rw-r--r-- | src/gallium/state_trackers/clover/Makefile.sources | 4 | ||||
-rw-r--r-- | src/gallium/state_trackers/clover/core/device.cpp | 10 | ||||
-rw-r--r-- | src/gallium/state_trackers/clover/core/program.cpp | 13 | ||||
-rw-r--r-- | src/gallium/state_trackers/clover/meson.build | 10 | ||||
-rw-r--r-- | src/gallium/state_trackers/clover/tgsi/compiler.cpp | 120 | ||||
-rw-r--r-- | src/gallium/state_trackers/clover/tgsi/invocation.hpp | 37 |
7 files changed, 9 insertions, 196 deletions
diff --git a/src/gallium/state_trackers/clover/Makefile.am b/src/gallium/state_trackers/clover/Makefile.am index c92b2cdd274..32ed04f6a2c 100644 --- a/src/gallium/state_trackers/clover/Makefile.am +++ b/src/gallium/state_trackers/clover/Makefile.am @@ -33,14 +33,7 @@ cl_HEADERS = \ $(top_srcdir)/include/CL/opencl.h endif -noinst_LTLIBRARIES = libclover.la libcltgsi.la libclllvm.la - -libcltgsi_la_CXXFLAGS = \ - $(CXX11_CXXFLAGS) \ - $(CLOVER_STD_OVERRIDE) \ - $(VISIBILITY_CXXFLAGS) - -libcltgsi_la_SOURCES = $(TGSI_SOURCES) +noinst_LTLIBRARIES = libclover.la libclllvm.la libclllvm_la_CXXFLAGS = \ $(CXX11_CXXFLAGS) \ @@ -61,7 +54,7 @@ libclover_la_CXXFLAGS = \ $(VISIBILITY_CXXFLAGS) libclover_la_LIBADD = \ - libcltgsi.la libclllvm.la + libclllvm.la libclover_la_SOURCES = $(CPP_SOURCES) diff --git a/src/gallium/state_trackers/clover/Makefile.sources b/src/gallium/state_trackers/clover/Makefile.sources index e9828b107b5..5167ca75af4 100644 --- a/src/gallium/state_trackers/clover/Makefile.sources +++ b/src/gallium/state_trackers/clover/Makefile.sources @@ -62,7 +62,3 @@ LLVM_SOURCES := \ llvm/invocation.hpp \ llvm/metadata.hpp \ llvm/util.hpp - -TGSI_SOURCES := \ - tgsi/compiler.cpp \ - tgsi/invocation.hpp diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp index 0d911e37514..1fae465dae4 100644 --- a/src/gallium/state_trackers/clover/core/device.cpp +++ b/src/gallium/state_trackers/clover/core/device.cpp @@ -244,15 +244,7 @@ device::vendor_name() const { enum pipe_shader_ir device::ir_format() const { - int supported_irs = - pipe->get_shader_param(pipe, PIPE_SHADER_COMPUTE, - PIPE_SHADER_CAP_SUPPORTED_IRS); - - if (supported_irs & (1 << PIPE_SHADER_IR_NATIVE)) { - return PIPE_SHADER_IR_NATIVE; - } - - return PIPE_SHADER_IR_TGSI; + return PIPE_SHADER_IR_NATIVE; } std::string diff --git a/src/gallium/state_trackers/clover/core/program.cpp b/src/gallium/state_trackers/clover/core/program.cpp index 4e74fccd973..ec71d99b017 100644 --- a/src/gallium/state_trackers/clover/core/program.cpp +++ b/src/gallium/state_trackers/clover/core/program.cpp @@ -22,7 +22,6 @@ #include "core/program.hpp" #include "llvm/invocation.hpp" -#include "tgsi/invocation.hpp" using namespace clover; @@ -51,10 +50,9 @@ program::compile(const ref_vector<device> &devs, const std::string &opts, std::string log; try { - const module m = (dev.ir_format() == PIPE_SHADER_IR_TGSI ? - tgsi::compile_program(_source, log) : - llvm::compile_program(_source, headers, dev, - opts, log)); + assert(dev.ir_format() == PIPE_SHADER_IR_NATIVE); + const module m = llvm::compile_program(_source, headers, dev, opts, + log); _builds[&dev] = { m, opts, log }; } catch (...) { _builds[&dev] = { module(), opts, log }; @@ -76,9 +74,8 @@ program::link(const ref_vector<device> &devs, const std::string &opts, std::string log = _builds[&dev].log; try { - const module m = (dev.ir_format() == PIPE_SHADER_IR_TGSI ? - tgsi::link_program(ms) : - llvm::link_program(ms, dev, opts, log)); + assert(dev.ir_format() == PIPE_SHADER_IR_NATIVE); + const module m = llvm::link_program(ms, dev, opts, log); _builds[&dev] = { m, opts, log }; } catch (...) { _builds[&dev] = { module(), opts, log }; diff --git a/src/gallium/state_trackers/clover/meson.build b/src/gallium/state_trackers/clover/meson.build index 62ac5f5278d..2ff060bf35b 100644 --- a/src/gallium/state_trackers/clover/meson.build +++ b/src/gallium/state_trackers/clover/meson.build @@ -25,14 +25,6 @@ if with_opencl_icd clover_cpp_args += '-DHAVE_CLOVER_ICD' endif -libcltgsi = static_library( - 'cltgsi', - files('tgsi/compiler.cpp', 'tgsi/invocation.hpp'), - include_directories : clover_incs, - cpp_args : [cpp_vis_args], - override_options : clover_cpp_std, -) - libclllvm = static_library( 'clllvm', files( @@ -120,6 +112,6 @@ libclover = static_library( [clover_files, sha1_h], include_directories : clover_incs, cpp_args : [clover_cpp_args, cpp_vis_args], - link_with : [libcltgsi, libclllvm], + link_with : [libclllvm], override_options : clover_cpp_std, ) diff --git a/src/gallium/state_trackers/clover/tgsi/compiler.cpp b/src/gallium/state_trackers/clover/tgsi/compiler.cpp deleted file mode 100644 index e165311fa41..00000000000 --- a/src/gallium/state_trackers/clover/tgsi/compiler.cpp +++ /dev/null @@ -1,120 +0,0 @@ -// -// Copyright 2012 Francisco Jerez -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR -// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -// - -#include <sstream> - -#include "tgsi/invocation.hpp" -#include "core/error.hpp" - -#include "tgsi/tgsi_parse.h" -#include "tgsi/tgsi_text.h" -#include "util/u_memory.h" - -using namespace clover; - -namespace { - void - read_header(const std::string &header, module &m, std::string &r_log) { - std::istringstream ls(header); - std::string line; - - while (getline(ls, line)) { - std::istringstream ts(line); - std::string name, tok; - module::size_t offset; - std::vector<module::argument> args; - - if (!(ts >> name)) - continue; - - if (!(ts >> offset)) { - r_log = "invalid kernel start address"; - throw build_error(); - } - - while (ts >> tok) { - if (tok == "scalar") - args.push_back({ module::argument::scalar, 4 }); - else if (tok == "global") - args.push_back({ module::argument::global, 4 }); - else if (tok == "local") - args.push_back({ module::argument::local, 4 }); - else if (tok == "constant") - args.push_back({ module::argument::constant, 4 }); - else if (tok == "image2d_rd") - args.push_back({ module::argument::image2d_rd, 4 }); - else if (tok == "image2d_wr") - args.push_back({ module::argument::image2d_wr, 4 }); - else if (tok == "image3d_rd") - args.push_back({ module::argument::image3d_rd, 4 }); - else if (tok == "image3d_wr") - args.push_back({ module::argument::image3d_wr, 4 }); - else if (tok == "sampler") - args.push_back({ module::argument::sampler, 0 }); - else { - r_log = "invalid kernel argument"; - throw build_error(); - } - } - - m.syms.push_back({ name, 0, offset, args }); - } - } - - void - read_body(const char *source, module &m, std::string &r_log) { - tgsi_token prog[1024]; - - if (!tgsi_text_translate(source, prog, ARRAY_SIZE(prog))) { - r_log = "translate failed"; - throw build_error(); - } - - 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 }); - } -} - -module -clover::tgsi::compile_program(const std::string &source, std::string &r_log) { - const size_t body_pos = source.find("COMP\n"); - if (body_pos == std::string::npos) { - r_log = "invalid source"; - throw build_error(); - } - - const char *body = &source[body_pos]; - module m; - - read_header({ source.begin(), source.begin() + body_pos }, m, r_log); - read_body(body, m, r_log); - - return m; -} - -module -clover::tgsi::link_program(const std::vector<module> &modules) -{ - assert(modules.size() == 1 && "Not implemented"); - return modules[0]; -} diff --git a/src/gallium/state_trackers/clover/tgsi/invocation.hpp b/src/gallium/state_trackers/clover/tgsi/invocation.hpp deleted file mode 100644 index ae08461b014..00000000000 --- a/src/gallium/state_trackers/clover/tgsi/invocation.hpp +++ /dev/null @@ -1,37 +0,0 @@ -// -// Copyright 2016 Francisco Jerez -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR -// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -// - -#ifndef CLOVER_TGSI_INVOCATION_HPP -#define CLOVER_TGSI_INVOCATION_HPP - -#include "core/module.hpp" - -namespace clover { - namespace tgsi { - module compile_program(const std::string &source, - std::string &r_log); - - module link_program(const std::vector<module> &modules); - } -} - -#endif |