bartekkuncer commented on code in PR #21077:
URL: https://github.com/apache/incubator-mxnet/pull/21077#discussion_r904892704


##########
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:
   In my opinion there is no need to separate these conditions especially with 
the number of conditions decreased to just two, therefore I changed it.



##########
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:
   Because it is redundant.



##########
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:
   If op is "_sg_onednn_fully_connected" this condition has been checked 
already.



##########
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:
   In my opinion it is a basic change and there is no need to keep this 
condition any longer than it needs to be especially that now it is way easier 
to read. 



-- 
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