anko-intel commented on code in PR #21077:
URL: https://github.com/apache/incubator-mxnet/pull/21077#discussion_r904817336


##########
src/operator/subgraph/dnnl/dnnl_fc_sum_fuse_property.h:
##########
@@ -63,26 +63,21 @@ class SgDNNLFCSumFuseSelector : public SubgraphSelectorV2 {
 
   bool quantized_;
   SelectStatus status_ = kFail;
-  std::vector<const BiDirectedNode*> matched_list_;
 
  public:
   explicit SgDNNLFCSumFuseSelector(bool quantized) : quantized_(quantized) {}
 
   bool Select(const BiDirectedNode& seed_node,
               const std::shared_ptr<NodeAttr>& node_attr) override {
     const auto n = seed_node.node;
-    if (n->op() == Op::Get("_sg_onednn_fully_connected")) {
-      if (SupportDNNLAttr(node_attr) && (seed_node.outputs.size() == 1)) {
-        auto const& fc_param = nnvm::get<DNNLFCFullParam>(n->attrs.parsed);
-        if ((!quantized_) || (fc_param.dnnl_param.quantized && 
!fc_param.dnnl_param.with_eltwise)) {
-          // Start subgraph when fusing for floats (quantized_ is false for 
ONEDNN backend) or
-          // when FC is already quantized (second pass for ONEDNN_QUANTIZE) 
but not already fuzed
-          // with elemwise operator.
-          status_ = kStart;
-          matched_list_.clear();
-          matched_list_.push_back(&seed_node);
-          return true;
-        }
+    if (n->op() == Op::Get("_sg_onednn_fully_connected") && 
seed_node.outputs.size() == 1) {

Review Comment:
   separate "if"s are more readable in mu opinion, so I will left it.



##########
src/operator/subgraph/dnnl/dnnl_fc_sum_fuse_property.h:
##########
@@ -95,42 +90,27 @@ class SgDNNLFCSumFuseSelector : public SubgraphSelectorV2 {
   bool SelectOutput(const BiDirectedNode& cur_node, const BiDirectedNode& 
output_node) override {
     const auto cur_n    = cur_node.node;
     const auto output_n = output_node.node;
-    if (status_ == kFail || status_ == kSuccess || output_n->is_variable()) {
+    if (status_ != kStart || output_n->is_variable()) {

Review Comment:
   The same state machine process was done on other operators. Evee it is not 
fully utilized here yet, I think it is better to do it in the common way. 
(status_ == kFail || status_ == kSuccess ||)



##########
src/operator/subgraph/dnnl/dnnl_fc_sum_fuse_property.h:
##########
@@ -63,26 +63,21 @@ class SgDNNLFCSumFuseSelector : public SubgraphSelectorV2 {
 
   bool quantized_;
   SelectStatus status_ = kFail;
-  std::vector<const BiDirectedNode*> matched_list_;
 
  public:
   explicit SgDNNLFCSumFuseSelector(bool quantized) : quantized_(quantized) {}
 
   bool Select(const BiDirectedNode& seed_node,
               const std::shared_ptr<NodeAttr>& node_attr) override {
     const auto n = seed_node.node;
-    if (n->op() == Op::Get("_sg_onednn_fully_connected")) {
-      if (SupportDNNLAttr(node_attr) && (seed_node.outputs.size() == 1)) {
-        auto const& fc_param = nnvm::get<DNNLFCFullParam>(n->attrs.parsed);
-        if ((!quantized_) || (fc_param.dnnl_param.quantized && 
!fc_param.dnnl_param.with_eltwise)) {
-          // Start subgraph when fusing for floats (quantized_ is false for 
ONEDNN backend) or
-          // when FC is already quantized (second pass for ONEDNN_QUANTIZE) 
but not already fuzed
-          // with elemwise operator.
-          status_ = kStart;
-          matched_list_.clear();
-          matched_list_.push_back(&seed_node);
-          return true;
-        }
+    if (n->op() == Op::Get("_sg_onednn_fully_connected") && 
seed_node.outputs.size() == 1) {
+      auto const& fc_param = nnvm::get<DNNLFCFullParam>(n->attrs.parsed);

Review Comment:
   Are you sure that SupportDNNLAttr() is not required here ?



##########
src/operator/subgraph/dnnl/dnnl_fc_sum_fuse_property.h:
##########
@@ -63,26 +63,21 @@ class SgDNNLFCSumFuseSelector : public SubgraphSelectorV2 {
 
   bool quantized_;
   SelectStatus status_ = kFail;
-  std::vector<const BiDirectedNode*> matched_list_;

Review Comment:
   Why it is removed ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to