Commit af8e78e0 authored by Dmitry Yershov's avatar Dmitry Yershov Committed by Scott Cyphers

IntelGPU backend: Enable FusedOpDecomposition pass (#2912)

* IntelGPU backend: Enable FusedOpDecomposition pass

* PR2912. Adress comments.
parent 212ab7c2
......@@ -45,6 +45,7 @@
#include "ngraph/pass/batch_fusion.hpp"
#include "ngraph/pass/core_fusion.hpp"
#include "ngraph/pass/cse.hpp"
#include "ngraph/pass/fused_op_decomposition.hpp"
#include "ngraph/pass/get_output_element_elimination.hpp"
#include "ngraph/pass/manager.hpp"
#include "ngraph/pass/nop_elimination.hpp"
......@@ -322,9 +323,13 @@ runtime::intelgpu::IntelGPUBackend::IntelGPUBackend()
}
// Disables the backend Function (graph) level optimizations
if (getenv("NGRAPH_INTELGPU_DISABLE_OPTIMIZATIONS") != nullptr)
// 0 or undefined - All optimization passes are enabled
// 1 - Disable optimization passes except FusedOpDecomposition
// >1 - Disable all optimization passes
const char* disable_backend_optimizations = getenv("NGRAPH_INTELGPU_DISABLE_OPTIMIZATIONS");
if (disable_backend_optimizations != nullptr)
{
m_disable_backend_optimizations = true;
m_disable_backend_optimizations = strtol(disable_backend_optimizations, nullptr, 10);
}
// Disables clDNN (cldnn::network) level optimizations
......@@ -410,10 +415,16 @@ shared_ptr<runtime::Executable>
visualize_tree(func, "intelgpu_", "_orig");
}
if (!m_disable_backend_optimizations)
ngraph::pass::Manager pass_manager;
if (m_disable_backend_optimizations < 2)
{
ngraph::pass::Manager pass_manager;
pass_manager.register_pass<ngraph::pass::FusedOpDecomposition>(
IntelGPUBackend::is_supported_impl);
}
if (m_disable_backend_optimizations < 1)
{
pass_manager.register_pass<ngraph::pass::NopElimination>();
pass_manager.register_pass<ngraph::pass::BatchFusion>();
pass_manager.register_pass<ngraph::pass::AlgebraicSimplification>();
......@@ -423,7 +434,10 @@ shared_ptr<runtime::Executable>
// GetOutputElementElimination must be after CommonSubexpressionElimination
pass_manager.register_pass<ngraph::pass::GetOutputElementElimination>();
}
if (m_disable_backend_optimizations < 2)
{
pass_manager.run_passes(func);
if (m_dump_graph_enable)
......@@ -2133,3 +2147,28 @@ bool runtime::intelgpu::IntelGPUBackend::is_supported_property(const Property pr
return false;
}
bool runtime::intelgpu::IntelGPUBackend::is_supported(const Node& node) const
{
return is_supported_impl(node);
}
bool runtime::intelgpu::IntelGPUBackend::is_supported_impl(const Node& node)
{
const OP_TYPEID op_type_id = get_typeid(node.description());
switch (op_type_id)
{
case OP_TYPEID::Clamp:
case OP_TYPEID::HardSigmoid:
case OP_TYPEID::DepthToSpace:
case OP_TYPEID::Elu:
case OP_TYPEID::Gemm:
case OP_TYPEID::MVN:
case OP_TYPEID::Normalize:
case OP_TYPEID::PRelu:
case OP_TYPEID::SpaceToDepth: { return false;
}
default: { return true;
}
}
}
......@@ -52,6 +52,10 @@ public:
bool is_supported_property(const Property prop) const override;
bool is_supported(const Node& node) const override;
static bool is_supported_impl(const Node& node);
private:
std::shared_ptr<cldnn::engine> cldnn_engine;
std::map<std::shared_ptr<Function>, std::shared_ptr<runtime::Executable>> cldnn_networks;
......@@ -62,6 +66,6 @@ private:
bool m_cldnn_graph_optimize = true;
bool m_cldnn_dump_enable = false;
bool m_function_cache_disabled = false;
bool m_disable_backend_optimizations = false;
long m_disable_backend_optimizations = 0;
std::string m_cldnn_dump_dir = std::string("intelgpu_codegen");
};
......@@ -21,13 +21,6 @@ shape_of_5d
shape_of_matrix
shape_of_scalar
shape_of_vector
prelu
prelu_shared_slope
prelu_negative_slope
elu
elu_negative_alpha
space_to_depth
depth_to_space
# Unsupported extra padding modes
pad_edge_1d
......@@ -48,7 +41,6 @@ pad_reflect_2d_with_neg
# Not implemented
erf
fused_clamp
gather_no_axis
gather
gather_nd_scalar_from_2d
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment