Skip to content

Commit

Permalink
comments #2
Browse files Browse the repository at this point in the history
  • Loading branch information
eshoguli committed Jan 9, 2023
1 parent e411052 commit 9f9b6f6
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ namespace pass {
class ConvertToSnippetsOpset: ngraph::pass::FunctionPass {
public:
OPENVINO_RTTI("ConvertToSnippetsOpset", "0");
ConvertToSnippetsOpset(
const ov::element::Type supported_precision,
const std::shared_ptr<const TargetMachine>& target_machine);
ConvertToSnippetsOpset();
bool run_on_model(const std::shared_ptr<ov::Model>& m) override;

private:
Expand Down
6 changes: 3 additions & 3 deletions src/common/snippets/src/op/subgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@ void snippets::op::Subgraph::convert_to_snippet_dialect() {
}

// it's a place to replace all TypeRelax ops to snippets opset ops
// TODO: question #1: keep it here
snippets::pass::ConvertToSnippetsOpset().run_on_model(body_ptr());

manager.run_passes(body_ptr());
}
Expand Down Expand Up @@ -391,9 +393,7 @@ snippets::Schedule snippets::op::Subgraph::generate(ngraph::pass::Manager& opt,
OV_ITT_SCOPED_TASK(ngraph::pass::itt::domains::SnippetsTransform, "Snippets::op::generate")
NGRAPH_CHECK(m_generator != nullptr, "generate is called while generator is not set");
convert_to_snippet_dialect();
opt.run_passes(body_ptr()); // just for info: it's a place for custom plugin ops

snippets::pass::ConvertToSnippetsOpset(element::f32, m_generator->get_target_machine()).run_on_model(body_ptr());
opt.run_passes(body_ptr()); // just for info: it's a place for custom plugin ops

// It's place:
// TargetMachine <= plugin dependencies directly from emitters <= has to be extended:
Expand Down
7 changes: 4 additions & 3 deletions src/common/snippets/src/pass/convert_to_snippets_opset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@
#include "ngraph/pass/visualize_tree.hpp"
#endif

ngraph::snippets::pass::ConvertToSnippetsOpset::ConvertToSnippetsOpset(
const ov::element::Type supported_precision,
const std::shared_ptr<const TargetMachine>& target_machine) : supported_precision(supported_precision), target_machine(target_machine) {
ngraph::snippets::pass::ConvertToSnippetsOpset::ConvertToSnippetsOpset() {
}

bool ngraph::snippets::pass::ConvertToSnippetsOpset::run_on_model(const std::shared_ptr<ov::Model>& f) {
RUN_ON_MODEL_SCOPE(ConvertToSnippetsOpset);
OV_ITT_SCOPED_TASK(ngraph::pass::itt::domains::SnippetsTransform, "Snippets::op::ConvertToSnippetsOpset")

// not need to make separate matcher
// TODO: question #3: one traversal in cycle, use macros. Don't need separate transformation for each operation.
// TODO: each operation constructor has to be accept original operation
auto passConfig = get_pass_config();
ngraph::pass::Manager manager(passConfig);
manager.register_pass<Add>();
Expand Down
2 changes: 1 addition & 1 deletion src/common/snippets/src/pass/propagate_precision.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ std::set<InferenceEngine::Precision> get_supported_precisions(T&){
};

namespace {

// TODO: question #4: reuse method from ov::utils
// TODO: how to convert: InferenceEngine::Precision => ov::element::Type ?
InferenceEngine::Precision to_precision(const ov::element::Type type) {
switch (type) {
Expand Down
1 change: 1 addition & 0 deletions src/plugins/intel_cpu/src/emitters/cpu_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
using namespace std;
using namespace ngraph::snippets;

// TODO: question #2: keep as is
#define CREATE_EMITTER(e_type) { \
[this](const std::shared_ptr<ngraph::Node>& n) -> std::shared_ptr<ngraph::snippets::Emitter> { \
return std::make_shared<e_type>(h.get(), isa, n); \
Expand Down

0 comments on commit 9f9b6f6

Please sign in to comment.