[GPU] Remove some unused code (#23886)
This commit is contained in:
parent
f9a924f534
commit
b6bdb857fb
|
|
@ -80,8 +80,7 @@ struct PerfCounter {
|
|||
|
||||
class ProgramBuilder final {
|
||||
public:
|
||||
ProgramBuilder(std::shared_ptr<ov::Model> model, cldnn::engine& engine, const ExecutionConfig& config,
|
||||
bool createTopologyOnly = false, bool partialBuild = false,
|
||||
ProgramBuilder(std::shared_ptr<ov::Model> model, cldnn::engine& engine, const ExecutionConfig& config, bool partialBuild = false,
|
||||
std::shared_ptr<ov::threading::IStreamsExecutor> task_executor = nullptr,
|
||||
std::shared_ptr<cldnn::ICompilationContext> compilation_context = nullptr,
|
||||
bool innerProgram = false);
|
||||
|
|
@ -174,10 +173,9 @@ private:
|
|||
void cleanup_build();
|
||||
|
||||
// TODO(eunsoo): remove createTopolpgyOnly argument and add another method to create topology from ngraph function
|
||||
std::shared_ptr<cldnn::program> build(const std::vector<std::shared_ptr<ov::Node>>& ops,
|
||||
bool createTopologyOnly = false, bool partialBuild = false, bool innerProgram = false);
|
||||
std::shared_ptr<cldnn::program> build(const std::vector<std::shared_ptr<ov::Node>>& ops, bool partialBuild = false, bool innerProgram = false);
|
||||
|
||||
void CreateSingleLayerPrimitive(cldnn::topology& topology, const std::shared_ptr<ov::Node>& op);
|
||||
void CreateSingleLayerPrimitive(const std::shared_ptr<ov::Node>& op);
|
||||
};
|
||||
|
||||
void CreateCustomOp(ProgramBuilder& p, const std::shared_ptr<ov::Node>& node, CustomLayerPtr customLayer);
|
||||
|
|
@ -189,8 +187,6 @@ void CreateElementwiseOp(ProgramBuilder& p,
|
|||
std::vector<float> coefficients = {},
|
||||
bool pythondiv = true);
|
||||
|
||||
bool IsNodeOnConstPath(const std::shared_ptr<ov::Node>& node);
|
||||
|
||||
void validate_inputs_count(const std::shared_ptr<ov::Node>& op, std::vector<size_t> possible_inputs_count);
|
||||
|
||||
inline bool ends_with(const std::string& value, const std::string& suffix) {
|
||||
|
|
|
|||
|
|
@ -2,28 +2,17 @@
|
|||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/pass/serialize.hpp"
|
||||
#include "openvino/runtime/iplugin.hpp"
|
||||
#include "openvino/runtime/intel_gpu/properties.hpp"
|
||||
#include "openvino/runtime/internal_properties.hpp"
|
||||
#include "openvino/util/common_util.hpp"
|
||||
|
||||
#include "intel_gpu/graph/serialization/binary_buffer.hpp"
|
||||
#include "intel_gpu/graph/serialization/layout_serializer.hpp"
|
||||
#include "intel_gpu/graph/serialization/string_serializer.hpp"
|
||||
#include "intel_gpu/graph/serialization/utils.hpp"
|
||||
#include "intel_gpu/graph/serialization/vector_serializer.hpp"
|
||||
#include "intel_gpu/runtime/itt.hpp"
|
||||
#include "intel_gpu/plugin/graph.hpp"
|
||||
#include "intel_gpu/plugin/compiled_model.hpp"
|
||||
#include "intel_gpu/plugin/async_infer_request.hpp"
|
||||
|
||||
#include <fstream>
|
||||
#include <utility>
|
||||
#include <sys/types.h>
|
||||
#include <chrono>
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
|
||||
namespace ov {
|
||||
namespace intel_gpu {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ Graph::Graph(std::shared_ptr<ov::Model> model, const RemoteContextImpl::Ptr& con
|
|||
: m_context(context)
|
||||
, m_config(config)
|
||||
, m_stream_id(stream_id) {
|
||||
auto program_builder = std::make_shared<ProgramBuilder>(model, get_engine(), config, false, false);
|
||||
auto program_builder = std::make_shared<ProgramBuilder>(model, get_engine(), config, false);
|
||||
m_config = program_builder->get_config();
|
||||
|
||||
build(program_builder->get_compiled_program());
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ static cldnn::condition::branch gen_branch(ProgramBuilder& p, const std::shared_
|
|||
config.set_property(ov::intel_gpu::max_dynamic_batch(1));
|
||||
config.set_property(ov::intel_gpu::allow_new_shape_infer(op->is_dynamic() || p.use_new_shape_infer()));
|
||||
|
||||
ProgramBuilder prog(internal_body, p.get_engine(), config, false, false, p.get_task_executor(), p.get_compilation_context(), true);
|
||||
ProgramBuilder prog(internal_body, p.get_engine(), config, false, p.get_task_executor(), p.get_compilation_context(), true);
|
||||
branch.inner_program = prog.get_compiled_program();
|
||||
|
||||
auto& input_map = branch.input_map;
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ static void CreateCommonLoopOp(ProgramBuilder& p, const std::shared_ptr<ov::op::
|
|||
config.set_property(ov::intel_gpu::allow_new_shape_infer(is_dynamic));
|
||||
|
||||
// get body program from ov::Model
|
||||
ProgramBuilder prog(ov_model, p.get_engine(), config, false, false, p.get_task_executor(), p.get_compilation_context(), true);
|
||||
ProgramBuilder prog(ov_model, p.get_engine(), config, false, p.get_task_executor(), p.get_compilation_context(), true);
|
||||
auto body_program = prog.get_compiled_program();
|
||||
|
||||
GPU_DEBUG_LOG << "* trip_count_id : " << trip_count_id << std::endl;
|
||||
|
|
|
|||
|
|
@ -709,7 +709,7 @@ uint32_t Plugin::get_max_batch_size(const ov::AnyMap& options) const {
|
|||
|
||||
TransformationsPipeline transformations(config, device_info);
|
||||
transformations.apply(cloned_model);
|
||||
program = std::make_shared<ProgramBuilder>(cloned_model, engine, config, false, true);
|
||||
program = std::make_shared<ProgramBuilder>(cloned_model, engine, config, true);
|
||||
std::pair<int64_t, int64_t> device_memory_usage = program->get_compiled_program()->get_estimated_device_mem_usage();
|
||||
if (device_memory_usage.first == static_cast<int64_t>(-1L) && device_memory_usage.second == static_cast<int64_t>(-1L)) {
|
||||
return static_cast<uint32_t>(max_batch_size);
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ std::string layer_type_name_ID(const std::shared_ptr<ov::Node>& op) {
|
|||
}
|
||||
|
||||
ProgramBuilder::ProgramBuilder(std::shared_ptr<ov::Model> model, cldnn::engine& engine, const ExecutionConfig& config,
|
||||
bool create_topology_only, bool partial_build,
|
||||
bool partial_build,
|
||||
std::shared_ptr<ov::threading::IStreamsExecutor> task_executor,
|
||||
std::shared_ptr<cldnn::ICompilationContext> compilation_context,
|
||||
bool is_inner_program)
|
||||
|
|
@ -103,7 +103,7 @@ ProgramBuilder::ProgramBuilder(std::shared_ptr<ov::Model> model, cldnn::engine&
|
|||
|
||||
auto ops = model->get_ordered_ops();
|
||||
|
||||
m_program = build(ops, create_topology_only, partial_build, is_inner_program);
|
||||
m_program = build(ops, partial_build, is_inner_program);
|
||||
}
|
||||
|
||||
ProgramBuilder::ProgramBuilder(cldnn::engine& engine, const ExecutionConfig& config)
|
||||
|
|
@ -133,8 +133,7 @@ void ProgramBuilder::cleanup_build() {
|
|||
#endif
|
||||
}
|
||||
|
||||
std::shared_ptr<cldnn::program> ProgramBuilder::build(const std::vector<std::shared_ptr<ov::Node>>& ops,
|
||||
bool create_topology_only, bool partial_build, bool is_inner_program) {
|
||||
std::shared_ptr<cldnn::program> ProgramBuilder::build(const std::vector<std::shared_ptr<ov::Node>>& ops, bool partial_build, bool is_inner_program) {
|
||||
OV_ITT_SCOPED_TASK(itt::domains::intel_gpu_plugin, "ProgramBuilder::build");
|
||||
// In the case of inner program, allow_new_shape_infer flag is setted by outside of program.
|
||||
// So, do not check allow_new_shape_infer for inner program build
|
||||
|
|
@ -157,35 +156,31 @@ std::shared_ptr<cldnn::program> ProgramBuilder::build(const std::vector<std::sha
|
|||
{
|
||||
GPU_DEBUG_DEFINE_MEM_LOGGER("CreateSingleLayerPrimitives");
|
||||
for (const auto& op : ops) {
|
||||
CreateSingleLayerPrimitive(*m_topology, op);
|
||||
CreateSingleLayerPrimitive(op);
|
||||
}
|
||||
}
|
||||
if (create_topology_only) {
|
||||
return {};
|
||||
} else {
|
||||
OV_ITT_SCOPED_TASK(itt::domains::intel_gpu_plugin, "ProgramBuilder::CreateProgram");
|
||||
cldnn::program::ptr program;
|
||||
try {
|
||||
program = cldnn::program::build_program(m_engine,
|
||||
*m_topology,
|
||||
m_config,
|
||||
get_task_executor(),
|
||||
get_compilation_context(),
|
||||
false,
|
||||
false,
|
||||
is_inner_program);
|
||||
} catch (std::exception& e) {
|
||||
OPENVINO_ASSERT(false, "[GPU] ProgramBuilder build failed!\n", e.what());
|
||||
}
|
||||
cleanup_build();
|
||||
|
||||
return program;
|
||||
OV_ITT_SCOPED_TASK(itt::domains::intel_gpu_plugin, "ProgramBuilder::CreateProgram");
|
||||
cldnn::program::ptr program;
|
||||
try {
|
||||
program = cldnn::program::build_program(m_engine,
|
||||
*m_topology,
|
||||
m_config,
|
||||
get_task_executor(),
|
||||
get_compilation_context(),
|
||||
false,
|
||||
false,
|
||||
is_inner_program);
|
||||
} catch (std::exception& e) {
|
||||
OPENVINO_ASSERT(false, "[GPU] ProgramBuilder build failed!\n", e.what());
|
||||
}
|
||||
cleanup_build();
|
||||
|
||||
return program;
|
||||
}
|
||||
|
||||
bool ProgramBuilder::is_op_supported(const std::shared_ptr<ov::Node>& op) {
|
||||
OV_ITT_SCOPED_TASK(itt::domains::intel_gpu_plugin, "ProgramBuilder::is_op_supported");
|
||||
cldnn::topology topology;
|
||||
try {
|
||||
// Query mode disables checks that input primitives are created,
|
||||
// as is_op_supported method is called for each operation separately
|
||||
|
|
@ -199,7 +194,7 @@ bool ProgramBuilder::is_op_supported(const std::shared_ptr<ov::Node>& op) {
|
|||
// reliable results of QueryNetwork call.
|
||||
prepare_build();
|
||||
allow_new_shape_infer = requires_new_shape_infer(op);
|
||||
CreateSingleLayerPrimitive(topology, op);
|
||||
CreateSingleLayerPrimitive(op);
|
||||
cleanup_build();
|
||||
DisableQueryMode();
|
||||
} catch (std::exception&) {
|
||||
|
|
@ -211,7 +206,7 @@ bool ProgramBuilder::is_op_supported(const std::shared_ptr<ov::Node>& op) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void ProgramBuilder::CreateSingleLayerPrimitive(cldnn::topology& topology, const std::shared_ptr<ov::Node>& op) {
|
||||
void ProgramBuilder::CreateSingleLayerPrimitive(const std::shared_ptr<ov::Node>& op) {
|
||||
OV_ITT_SCOPED_TASK(itt::domains::intel_gpu_plugin, "ProgramBuilder::CreateSingleLayerPrimitive");
|
||||
GPU_DEBUG_LOG << "Process " << "op::" << op->get_type_info().version_id << "::" << op->get_type_name() << " operation "
|
||||
<< "(friendly_name=" << op->get_friendly_name() << ")" << std::endl;
|
||||
|
|
@ -369,28 +364,6 @@ int64_t ProgramBuilder::get_result_index(const ov::Output<const ov::Node>& value
|
|||
return m_model->get_result_index(value);
|
||||
}
|
||||
|
||||
// TODO: Does it make sense to add such method to ov core?
|
||||
bool IsNodeOnConstPath(const std::shared_ptr<ov::Node>& node) {
|
||||
std::set<std::shared_ptr<ov::Node>> nodes_processed = {};
|
||||
std::function<bool(const std::shared_ptr<ov::Node>&)> is_const_node = [&nodes_processed, &is_const_node](const std::shared_ptr<ov::Node>& node) {
|
||||
if (nodes_processed.count(node)) return true;
|
||||
nodes_processed.insert(node);
|
||||
// If input is constant, then drop it from the processing list
|
||||
if (std::dynamic_pointer_cast<ov::op::v0::Constant>(node) != nullptr)
|
||||
return true;
|
||||
// If the node doesn't have any parents and it's not a constant, then we deal with dynamic path
|
||||
if (node->get_input_size() == 0)
|
||||
return false;
|
||||
for (size_t i = 0; i < node->get_input_size(); i++) {
|
||||
auto input_node = node->get_input_node_shared_ptr(i);
|
||||
if (!is_const_node(input_node))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
return is_const_node(node);
|
||||
}
|
||||
|
||||
void validate_inputs_count(const std::shared_ptr<ov::Node>& op, std::vector<size_t> valid_inputs_count) {
|
||||
for (auto ic : valid_inputs_count) {
|
||||
if (op->get_input_size() == ic) {
|
||||
|
|
|
|||
|
|
@ -6,8 +6,6 @@
|
|||
#include "openvino/core/preprocess/input_tensor_info.hpp"
|
||||
#include "openvino/core/parallel.hpp"
|
||||
#include "openvino/core/validation_util.hpp"
|
||||
#include "openvino/op/util/op_types.hpp"
|
||||
#include "transformations/utils/utils.hpp"
|
||||
|
||||
#include "intel_gpu/primitives/kv_cache.hpp"
|
||||
#include "intel_gpu/plugin/usm_host_tensor.hpp"
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
#include "intel_gpu/plugin/usm_host_tensor.hpp"
|
||||
#include "intel_gpu/plugin/remote_tensor.hpp"
|
||||
#include "intel_gpu/plugin/remote_context.hpp"
|
||||
#include "openvino/runtime/make_tensor.hpp"
|
||||
#include <memory>
|
||||
|
||||
namespace ov {
|
||||
|
|
|
|||
Loading…
Reference in New Issue