From 49ee020352a2ee82c3d89c469c97d3f3c094448b Mon Sep 17 00:00:00 2001
From: Li Xinqi <lixinqi2010@gmail.com>
Date: Thu, 4 Apr 2019 15:53:08 +0800
Subject: [PATCH] Dev parallel split fw bw (#1782)

* ReduceSplitOp::InferDescs

* JobHelperConf

* fix compiling errors

* rename directory autograd => job_completer

* rename directory autograd => job_completer
---
 oneflow/core/job/compiler.cpp                            | 2 +-
 oneflow/core/job/job.proto                               | 4 +++-
 oneflow/core/{autograd => job_completer}/add_grad.cpp    | 2 +-
 oneflow/core/{autograd => job_completer}/autograd.cpp    | 4 ++--
 oneflow/core/{autograd => job_completer}/autograd.h      | 6 +++---
 oneflow/core/{autograd => job_completer}/autotick.cpp    | 2 +-
 oneflow/core/{autograd => job_completer}/autotick.h      | 6 +++---
 oneflow/core/{autograd => job_completer}/autovar.cpp     | 2 +-
 oneflow/core/{autograd => job_completer}/autovar.h       | 6 +++---
 .../{autograd => job_completer}/batch_gather_grad.cpp    | 2 +-
 .../core/{autograd => job_completer}/bias_add_grad.cpp   | 2 +-
 .../{autograd => job_completer}/broadcast_add_grad.cpp   | 2 +-
 .../{autograd => job_completer}/broadcast_div_grad.cpp   | 2 +-
 .../{autograd => job_completer}/broadcast_mul_grad.cpp   | 2 +-
 oneflow/core/{autograd => job_completer}/cast_grad.cpp   | 2 +-
 oneflow/core/{autograd => job_completer}/clone_grad.cpp  | 2 +-
 oneflow/core/{autograd => job_completer}/clone_grad.h    | 8 ++++----
 oneflow/core/{autograd => job_completer}/conv_grad.cpp   | 2 +-
 .../core/{autograd => job_completer}/dropout_grad.cpp    | 2 +-
 .../fully_connected_autovar.cpp                          | 2 +-
 .../{autograd => job_completer}/fully_connected_grad.cpp | 2 +-
 oneflow/core/{autograd => job_completer}/gather_grad.cpp | 2 +-
 oneflow/core/{autograd => job_completer}/gelu_grad.cpp   | 2 +-
 .../{autograd => job_completer}/identity_loss_grad.cpp   | 2 +-
 .../{autograd => job_completer}/identity_loss_grad.h     | 0
 .../core/{autograd => job_completer}/job_completer.cpp   | 8 ++++----
 oneflow/core/{autograd => job_completer}/job_completer.h | 0
 .../{autograd => job_completer}/layer_norm_autovar.cpp   | 2 +-
 .../core/{autograd => job_completer}/layer_norm_grad.cpp | 2 +-
 oneflow/core/{autograd => job_completer}/matmul_grad.cpp | 2 +-
 .../{autograd => job_completer}/normalization_grad.cpp   | 2 +-
 .../print_scalar_summary_facade.cpp                      | 2 +-
 .../{autograd => job_completer}/reduce_mean_grad.cpp     | 2 +-
 .../core/{autograd => job_completer}/reduce_sum_grad.cpp | 2 +-
 oneflow/core/{autograd => job_completer}/relu_grad.cpp   | 2 +-
 .../core/{autograd => job_completer}/reshape_grad.cpp    | 2 +-
 .../core/{autograd => job_completer}/scalar_add_grad.cpp | 2 +-
 .../core/{autograd => job_completer}/scalar_mul_grad.cpp | 2 +-
 oneflow/core/{autograd => job_completer}/slice_grad.cpp  | 2 +-
 .../core/{autograd => job_completer}/softmax_grad.cpp    | 2 +-
 .../sparse_cross_entropy_grad.cpp                        | 2 +-
 .../core/{autograd => job_completer}/transpose_grad.cpp  | 2 +-
 .../core/{autograd => job_completer}/variable_grad.cpp   | 2 +-
 oneflow/core/operator/op_conf.proto                      | 7 +++++++
 oneflow/core/register/logical_blob_id.proto              | 9 ++++++++-
 45 files changed, 71 insertions(+), 55 deletions(-)
 rename oneflow/core/{autograd => job_completer}/add_grad.cpp (92%)
 rename oneflow/core/{autograd => job_completer}/autograd.cpp (99%)
 rename oneflow/core/{autograd => job_completer}/autograd.h (92%)
 rename oneflow/core/{autograd => job_completer}/autotick.cpp (98%)
 rename oneflow/core/{autograd => job_completer}/autotick.h (58%)
 rename oneflow/core/{autograd => job_completer}/autovar.cpp (96%)
 rename oneflow/core/{autograd => job_completer}/autovar.h (89%)
 rename oneflow/core/{autograd => job_completer}/batch_gather_grad.cpp (96%)
 rename oneflow/core/{autograd => job_completer}/bias_add_grad.cpp (95%)
 rename oneflow/core/{autograd => job_completer}/broadcast_add_grad.cpp (97%)
 rename oneflow/core/{autograd => job_completer}/broadcast_div_grad.cpp (98%)
 rename oneflow/core/{autograd => job_completer}/broadcast_mul_grad.cpp (98%)
 rename oneflow/core/{autograd => job_completer}/cast_grad.cpp (95%)
 rename oneflow/core/{autograd => job_completer}/clone_grad.cpp (95%)
 rename oneflow/core/{autograd => job_completer}/clone_grad.h (58%)
 rename oneflow/core/{autograd => job_completer}/conv_grad.cpp (98%)
 rename oneflow/core/{autograd => job_completer}/dropout_grad.cpp (95%)
 rename oneflow/core/{autograd => job_completer}/fully_connected_autovar.cpp (96%)
 rename oneflow/core/{autograd => job_completer}/fully_connected_grad.cpp (97%)
 rename oneflow/core/{autograd => job_completer}/gather_grad.cpp (96%)
 rename oneflow/core/{autograd => job_completer}/gelu_grad.cpp (94%)
 rename oneflow/core/{autograd => job_completer}/identity_loss_grad.cpp (90%)
 rename oneflow/core/{autograd => job_completer}/identity_loss_grad.h (100%)
 rename oneflow/core/{autograd => job_completer}/job_completer.cpp (89%)
 rename oneflow/core/{autograd => job_completer}/job_completer.h (100%)
 rename oneflow/core/{autograd => job_completer}/layer_norm_autovar.cpp (96%)
 rename oneflow/core/{autograd => job_completer}/layer_norm_grad.cpp (98%)
 rename oneflow/core/{autograd => job_completer}/matmul_grad.cpp (97%)
 rename oneflow/core/{autograd => job_completer}/normalization_grad.cpp (98%)
 rename oneflow/core/{autograd => job_completer}/print_scalar_summary_facade.cpp (98%)
 rename oneflow/core/{autograd => job_completer}/reduce_mean_grad.cpp (97%)
 rename oneflow/core/{autograd => job_completer}/reduce_sum_grad.cpp (95%)
 rename oneflow/core/{autograd => job_completer}/relu_grad.cpp (94%)
 rename oneflow/core/{autograd => job_completer}/reshape_grad.cpp (95%)
 rename oneflow/core/{autograd => job_completer}/scalar_add_grad.cpp (90%)
 rename oneflow/core/{autograd => job_completer}/scalar_mul_grad.cpp (96%)
 rename oneflow/core/{autograd => job_completer}/slice_grad.cpp (95%)
 rename oneflow/core/{autograd => job_completer}/softmax_grad.cpp (96%)
 rename oneflow/core/{autograd => job_completer}/sparse_cross_entropy_grad.cpp (96%)
 rename oneflow/core/{autograd => job_completer}/transpose_grad.cpp (96%)
 rename oneflow/core/{autograd => job_completer}/variable_grad.cpp (87%)

diff --git a/oneflow/core/job/compiler.cpp b/oneflow/core/job/compiler.cpp
index 6763d790d..158eb38f5 100644
--- a/oneflow/core/job/compiler.cpp
+++ b/oneflow/core/job/compiler.cpp
@@ -2,7 +2,7 @@
 #include "oneflow/core/persistence/tee_persistent_log_stream.h"
 #include "oneflow/core/device/cudnn_conv_ctx_cache.h"
 #include "oneflow/core/graph/op_graph.h"
-#include "oneflow/core/autograd/job_completer.h"
+#include "oneflow/core/job_completer/job_completer.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/job/job.proto b/oneflow/core/job/job.proto
index 386daf40d..02261e825 100644
--- a/oneflow/core/job/job.proto
+++ b/oneflow/core/job/job.proto
@@ -11,6 +11,8 @@ import "oneflow/core/operator/op_conf.proto";
 message JobHelperConf {
   map<string, LogicalBlobIdPairs> tag2lbi_relations = 1;
   map<string, OpNameRelations> tag2op_name_relations = 2;
+  map<string, LogicalBlobIdGroups> tag2lbi_groups = 3;
+  map<string, OpNameGroups> tag2op_name_groups = 4;
 }
 
 message Job {
@@ -19,4 +21,4 @@ message Job {
   required Placement placement = 3;
   required Config other = 4;
   required JobHelperConf helper = 5;
-}
\ No newline at end of file
+}
diff --git a/oneflow/core/autograd/add_grad.cpp b/oneflow/core/job_completer/add_grad.cpp
similarity index 92%
rename from oneflow/core/autograd/add_grad.cpp
rename to oneflow/core/job_completer/add_grad.cpp
index bb29cd8b4..dad3f4cdf 100644
--- a/oneflow/core/autograd/add_grad.cpp
+++ b/oneflow/core/job_completer/add_grad.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autograd.h"
+#include "oneflow/core/job_completer/autograd.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/autograd.cpp b/oneflow/core/job_completer/autograd.cpp
similarity index 99%
rename from oneflow/core/autograd/autograd.cpp
rename to oneflow/core/job_completer/autograd.cpp
index 01d0ef045..ee8d2bf7f 100644
--- a/oneflow/core/autograd/autograd.cpp
+++ b/oneflow/core/job_completer/autograd.cpp
@@ -1,6 +1,6 @@
-#include "oneflow/core/autograd/autograd.h"
+#include "oneflow/core/job_completer/autograd.h"
 #include "oneflow/core/job/job_builder.h"
-#include "oneflow/core/autograd/clone_grad.h"
+#include "oneflow/core/job_completer/clone_grad.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/autograd.h b/oneflow/core/job_completer/autograd.h
similarity index 92%
rename from oneflow/core/autograd/autograd.h
rename to oneflow/core/job_completer/autograd.h
index 8f7c0f869..cae5ea481 100644
--- a/oneflow/core/autograd/autograd.h
+++ b/oneflow/core/job_completer/autograd.h
@@ -1,5 +1,5 @@
-#ifndef ONEFLOW_CORE_AUTOGRAD_AUTOGRAD_H_
-#define ONEFLOW_CORE_AUTOGRAD_AUTOGRAD_H_
+#ifndef ONEFLOW_CORE_JOB_COMPLETER_AUTOGRAD_H_
+#define ONEFLOW_CORE_JOB_COMPLETER_AUTOGRAD_H_
 
 #include "oneflow/core/job/job_desc.h"
 #include "oneflow/core/operator/operator.h"
@@ -40,4 +40,4 @@ class GenerateBackwardOpConfWrapperStruct final {
 
 }  // namespace oneflow
 
-#endif  // ONEFLOW_CORE_AUTOGRAD_AUTOGRAD_H_
+#endif  // ONEFLOW_CORE_JOB_COMPLETER_AUTOGRAD_H_
diff --git a/oneflow/core/autograd/autotick.cpp b/oneflow/core/job_completer/autotick.cpp
similarity index 98%
rename from oneflow/core/autograd/autotick.cpp
rename to oneflow/core/job_completer/autotick.cpp
index e7a0f8f01..94042ed81 100644
--- a/oneflow/core/autograd/autotick.cpp
+++ b/oneflow/core/job_completer/autotick.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autotick.h"
+#include "oneflow/core/job_completer/autotick.h"
 #include "oneflow/core/job/job_builder.h"
 
 namespace oneflow {
diff --git a/oneflow/core/autograd/autotick.h b/oneflow/core/job_completer/autotick.h
similarity index 58%
rename from oneflow/core/autograd/autotick.h
rename to oneflow/core/job_completer/autotick.h
index 3b51268ac..146ac4018 100644
--- a/oneflow/core/autograd/autotick.h
+++ b/oneflow/core/job_completer/autotick.h
@@ -1,5 +1,5 @@
-#ifndef ONEFLOW_CORE_AUTOGRAD_AUTOTICK_H_
-#define ONEFLOW_CORE_AUTOGRAD_AUTOTICK_H_
+#ifndef ONEFLOW_CORE_JOB_COMPLETER_AUTOTICK_H_
+#define ONEFLOW_CORE_JOB_COMPLETER_AUTOTICK_H_
 
 #include "oneflow/core/job/job_desc.h"
 #include "oneflow/core/operator/operator.h"
@@ -10,4 +10,4 @@ namespace oneflow {
 void AutoTick(const OpGraph& op_graph, Job* job);
 }
 
-#endif  // ONEFLOW_CORE_AUTOGRAD_AUTOTICK_H_
+#endif  // ONEFLOW_CORE_JOB_COMPLETER_AUTOTICK_H_
diff --git a/oneflow/core/autograd/autovar.cpp b/oneflow/core/job_completer/autovar.cpp
similarity index 96%
rename from oneflow/core/autograd/autovar.cpp
rename to oneflow/core/job_completer/autovar.cpp
index de7db46ab..1f05d3369 100644
--- a/oneflow/core/autograd/autovar.cpp
+++ b/oneflow/core/job_completer/autovar.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autovar.h"
+#include "oneflow/core/job_completer/autovar.h"
 #include "oneflow/core/job/job_builder.h"
 
 namespace oneflow {
diff --git a/oneflow/core/autograd/autovar.h b/oneflow/core/job_completer/autovar.h
similarity index 89%
rename from oneflow/core/autograd/autovar.h
rename to oneflow/core/job_completer/autovar.h
index ec9a0e6c8..3eab1e93a 100644
--- a/oneflow/core/autograd/autovar.h
+++ b/oneflow/core/job_completer/autovar.h
@@ -1,5 +1,5 @@
-#ifndef ONEFLOW_CORE_AUTOGRAD_AUTOVAR_H_
-#define ONEFLOW_CORE_AUTOGRAD_AUTOVAR_H_
+#ifndef ONEFLOW_CORE_JOB_COMPLETER_AUTOVAR_H_
+#define ONEFLOW_CORE_JOB_COMPLETER_AUTOVAR_H_
 
 #include "oneflow/core/job/job_desc.h"
 #include "oneflow/core/operator/operator.h"
@@ -33,4 +33,4 @@ class GenerateInputVarOpConfWrapperStruct final {
 
 }  // namespace oneflow
 
-#endif  // ONEFLOW_CORE_AUTOGRAD_AUTOVAR_H_
+#endif  // ONEFLOW_CORE_JOB_COMPLETER_AUTOVAR_H_
diff --git a/oneflow/core/autograd/batch_gather_grad.cpp b/oneflow/core/job_completer/batch_gather_grad.cpp
similarity index 96%
rename from oneflow/core/autograd/batch_gather_grad.cpp
rename to oneflow/core/job_completer/batch_gather_grad.cpp
index 1805233f2..671f17c62 100644
--- a/oneflow/core/autograd/batch_gather_grad.cpp
+++ b/oneflow/core/job_completer/batch_gather_grad.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autograd.h"
+#include "oneflow/core/job_completer/autograd.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/bias_add_grad.cpp b/oneflow/core/job_completer/bias_add_grad.cpp
similarity index 95%
rename from oneflow/core/autograd/bias_add_grad.cpp
rename to oneflow/core/job_completer/bias_add_grad.cpp
index b6d344438..a2ff8facb 100644
--- a/oneflow/core/autograd/bias_add_grad.cpp
+++ b/oneflow/core/job_completer/bias_add_grad.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autograd.h"
+#include "oneflow/core/job_completer/autograd.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/broadcast_add_grad.cpp b/oneflow/core/job_completer/broadcast_add_grad.cpp
similarity index 97%
rename from oneflow/core/autograd/broadcast_add_grad.cpp
rename to oneflow/core/job_completer/broadcast_add_grad.cpp
index dfe745fdd..b4d75f3cc 100644
--- a/oneflow/core/autograd/broadcast_add_grad.cpp
+++ b/oneflow/core/job_completer/broadcast_add_grad.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autograd.h"
+#include "oneflow/core/job_completer/autograd.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/broadcast_div_grad.cpp b/oneflow/core/job_completer/broadcast_div_grad.cpp
similarity index 98%
rename from oneflow/core/autograd/broadcast_div_grad.cpp
rename to oneflow/core/job_completer/broadcast_div_grad.cpp
index 67f807778..e972af364 100644
--- a/oneflow/core/autograd/broadcast_div_grad.cpp
+++ b/oneflow/core/job_completer/broadcast_div_grad.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autograd.h"
+#include "oneflow/core/job_completer/autograd.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/broadcast_mul_grad.cpp b/oneflow/core/job_completer/broadcast_mul_grad.cpp
similarity index 98%
rename from oneflow/core/autograd/broadcast_mul_grad.cpp
rename to oneflow/core/job_completer/broadcast_mul_grad.cpp
index be8a766e8..b06fddbf1 100644
--- a/oneflow/core/autograd/broadcast_mul_grad.cpp
+++ b/oneflow/core/job_completer/broadcast_mul_grad.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autograd.h"
+#include "oneflow/core/job_completer/autograd.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/cast_grad.cpp b/oneflow/core/job_completer/cast_grad.cpp
similarity index 95%
rename from oneflow/core/autograd/cast_grad.cpp
rename to oneflow/core/job_completer/cast_grad.cpp
index 81f484aac..c5dd4b86a 100644
--- a/oneflow/core/autograd/cast_grad.cpp
+++ b/oneflow/core/job_completer/cast_grad.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autograd.h"
+#include "oneflow/core/job_completer/autograd.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/clone_grad.cpp b/oneflow/core/job_completer/clone_grad.cpp
similarity index 95%
rename from oneflow/core/autograd/clone_grad.cpp
rename to oneflow/core/job_completer/clone_grad.cpp
index f76b3073f..d16110515 100644
--- a/oneflow/core/autograd/clone_grad.cpp
+++ b/oneflow/core/job_completer/clone_grad.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/clone_grad.h"
+#include "oneflow/core/job_completer/clone_grad.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/clone_grad.h b/oneflow/core/job_completer/clone_grad.h
similarity index 58%
rename from oneflow/core/autograd/clone_grad.h
rename to oneflow/core/job_completer/clone_grad.h
index 4193ed071..4e87e6301 100644
--- a/oneflow/core/autograd/clone_grad.h
+++ b/oneflow/core/job_completer/clone_grad.h
@@ -1,7 +1,7 @@
-#ifndef ONEFLOW_CORE_AUTOGRAD_CLONE_GRAD_H_
-#define ONEFLOW_CORE_AUTOGRAD_CLONE_GRAD_H_
+#ifndef ONEFLOW_CORE_JOB_COMPLETER_CLONE_GRAD_H_
+#define ONEFLOW_CORE_JOB_COMPLETER_CLONE_GRAD_H_
 
-#include "oneflow/core/autograd/autograd.h"
+#include "oneflow/core/job_completer/autograd.h"
 
 namespace oneflow {
 
@@ -11,4 +11,4 @@ void GenerateCloneGradOpIfNeed(
     HashMap<LogicalBlobId, LogicalBlobId>* lbi2out_diff_lbi);
 }
 
-#endif  // ONEFLOW_CORE_AUTOGRAD_CLONE_GRAD_H_
+#endif  // ONEFLOW_CORE_JOB_COMPLETER_CLONE_GRAD_H_
diff --git a/oneflow/core/autograd/conv_grad.cpp b/oneflow/core/job_completer/conv_grad.cpp
similarity index 98%
rename from oneflow/core/autograd/conv_grad.cpp
rename to oneflow/core/job_completer/conv_grad.cpp
index b4b808ffd..45379246f 100644
--- a/oneflow/core/autograd/conv_grad.cpp
+++ b/oneflow/core/job_completer/conv_grad.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autograd.h"
+#include "oneflow/core/job_completer/autograd.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/dropout_grad.cpp b/oneflow/core/job_completer/dropout_grad.cpp
similarity index 95%
rename from oneflow/core/autograd/dropout_grad.cpp
rename to oneflow/core/job_completer/dropout_grad.cpp
index 9d60dcec6..f4a0ad5b4 100644
--- a/oneflow/core/autograd/dropout_grad.cpp
+++ b/oneflow/core/job_completer/dropout_grad.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autograd.h"
+#include "oneflow/core/job_completer/autograd.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/fully_connected_autovar.cpp b/oneflow/core/job_completer/fully_connected_autovar.cpp
similarity index 96%
rename from oneflow/core/autograd/fully_connected_autovar.cpp
rename to oneflow/core/job_completer/fully_connected_autovar.cpp
index 7f39fa986..12c93dcce 100644
--- a/oneflow/core/autograd/fully_connected_autovar.cpp
+++ b/oneflow/core/job_completer/fully_connected_autovar.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autovar.h"
+#include "oneflow/core/job_completer/autovar.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/fully_connected_grad.cpp b/oneflow/core/job_completer/fully_connected_grad.cpp
similarity index 97%
rename from oneflow/core/autograd/fully_connected_grad.cpp
rename to oneflow/core/job_completer/fully_connected_grad.cpp
index 4d1a0e687..14adb750d 100644
--- a/oneflow/core/autograd/fully_connected_grad.cpp
+++ b/oneflow/core/job_completer/fully_connected_grad.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autograd.h"
+#include "oneflow/core/job_completer/autograd.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/gather_grad.cpp b/oneflow/core/job_completer/gather_grad.cpp
similarity index 96%
rename from oneflow/core/autograd/gather_grad.cpp
rename to oneflow/core/job_completer/gather_grad.cpp
index 08dc293e6..f7644c3fd 100644
--- a/oneflow/core/autograd/gather_grad.cpp
+++ b/oneflow/core/job_completer/gather_grad.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autograd.h"
+#include "oneflow/core/job_completer/autograd.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/gelu_grad.cpp b/oneflow/core/job_completer/gelu_grad.cpp
similarity index 94%
rename from oneflow/core/autograd/gelu_grad.cpp
rename to oneflow/core/job_completer/gelu_grad.cpp
index b728423fc..c5aff545b 100644
--- a/oneflow/core/autograd/gelu_grad.cpp
+++ b/oneflow/core/job_completer/gelu_grad.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autograd.h"
+#include "oneflow/core/job_completer/autograd.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/identity_loss_grad.cpp b/oneflow/core/job_completer/identity_loss_grad.cpp
similarity index 90%
rename from oneflow/core/autograd/identity_loss_grad.cpp
rename to oneflow/core/job_completer/identity_loss_grad.cpp
index 8ae47f74f..06c851446 100644
--- a/oneflow/core/autograd/identity_loss_grad.cpp
+++ b/oneflow/core/job_completer/identity_loss_grad.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autograd.h"
+#include "oneflow/core/job_completer/autograd.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/identity_loss_grad.h b/oneflow/core/job_completer/identity_loss_grad.h
similarity index 100%
rename from oneflow/core/autograd/identity_loss_grad.h
rename to oneflow/core/job_completer/identity_loss_grad.h
diff --git a/oneflow/core/autograd/job_completer.cpp b/oneflow/core/job_completer/job_completer.cpp
similarity index 89%
rename from oneflow/core/autograd/job_completer.cpp
rename to oneflow/core/job_completer/job_completer.cpp
index 30469f2d6..1143d786b 100644
--- a/oneflow/core/autograd/job_completer.cpp
+++ b/oneflow/core/job_completer/job_completer.cpp
@@ -1,7 +1,7 @@
-#include "oneflow/core/autograd/job_completer.h"
-#include "oneflow/core/autograd/autovar.h"
-#include "oneflow/core/autograd/autograd.h"
-#include "oneflow/core/autograd/autotick.h"
+#include "oneflow/core/job_completer/job_completer.h"
+#include "oneflow/core/job_completer/autovar.h"
+#include "oneflow/core/job_completer/autograd.h"
+#include "oneflow/core/job_completer/autotick.h"
 #include "oneflow/core/optimizer/optimizer.h"
 
 namespace oneflow {
diff --git a/oneflow/core/autograd/job_completer.h b/oneflow/core/job_completer/job_completer.h
similarity index 100%
rename from oneflow/core/autograd/job_completer.h
rename to oneflow/core/job_completer/job_completer.h
diff --git a/oneflow/core/autograd/layer_norm_autovar.cpp b/oneflow/core/job_completer/layer_norm_autovar.cpp
similarity index 96%
rename from oneflow/core/autograd/layer_norm_autovar.cpp
rename to oneflow/core/job_completer/layer_norm_autovar.cpp
index 112e5cde3..a15f93791 100644
--- a/oneflow/core/autograd/layer_norm_autovar.cpp
+++ b/oneflow/core/job_completer/layer_norm_autovar.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autovar.h"
+#include "oneflow/core/job_completer/autovar.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/layer_norm_grad.cpp b/oneflow/core/job_completer/layer_norm_grad.cpp
similarity index 98%
rename from oneflow/core/autograd/layer_norm_grad.cpp
rename to oneflow/core/job_completer/layer_norm_grad.cpp
index 1fc40c52d..1f4a727dd 100644
--- a/oneflow/core/autograd/layer_norm_grad.cpp
+++ b/oneflow/core/job_completer/layer_norm_grad.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autograd.h"
+#include "oneflow/core/job_completer/autograd.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/matmul_grad.cpp b/oneflow/core/job_completer/matmul_grad.cpp
similarity index 97%
rename from oneflow/core/autograd/matmul_grad.cpp
rename to oneflow/core/job_completer/matmul_grad.cpp
index 0b3b0461f..0064ead07 100644
--- a/oneflow/core/autograd/matmul_grad.cpp
+++ b/oneflow/core/job_completer/matmul_grad.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autograd.h"
+#include "oneflow/core/job_completer/autograd.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/normalization_grad.cpp b/oneflow/core/job_completer/normalization_grad.cpp
similarity index 98%
rename from oneflow/core/autograd/normalization_grad.cpp
rename to oneflow/core/job_completer/normalization_grad.cpp
index 501ef0461..eb32c1b1d 100644
--- a/oneflow/core/autograd/normalization_grad.cpp
+++ b/oneflow/core/job_completer/normalization_grad.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autograd.h"
+#include "oneflow/core/job_completer/autograd.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/print_scalar_summary_facade.cpp b/oneflow/core/job_completer/print_scalar_summary_facade.cpp
similarity index 98%
rename from oneflow/core/autograd/print_scalar_summary_facade.cpp
rename to oneflow/core/job_completer/print_scalar_summary_facade.cpp
index 4f17fcbff..342407b4b 100644
--- a/oneflow/core/autograd/print_scalar_summary_facade.cpp
+++ b/oneflow/core/job_completer/print_scalar_summary_facade.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/job_completer.h"
+#include "oneflow/core/job_completer/job_completer.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/reduce_mean_grad.cpp b/oneflow/core/job_completer/reduce_mean_grad.cpp
similarity index 97%
rename from oneflow/core/autograd/reduce_mean_grad.cpp
rename to oneflow/core/job_completer/reduce_mean_grad.cpp
index 28fd4c9a7..032b5363c 100644
--- a/oneflow/core/autograd/reduce_mean_grad.cpp
+++ b/oneflow/core/job_completer/reduce_mean_grad.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autograd.h"
+#include "oneflow/core/job_completer/autograd.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/reduce_sum_grad.cpp b/oneflow/core/job_completer/reduce_sum_grad.cpp
similarity index 95%
rename from oneflow/core/autograd/reduce_sum_grad.cpp
rename to oneflow/core/job_completer/reduce_sum_grad.cpp
index 4d4597fbd..3fda3cca9 100644
--- a/oneflow/core/autograd/reduce_sum_grad.cpp
+++ b/oneflow/core/job_completer/reduce_sum_grad.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autograd.h"
+#include "oneflow/core/job_completer/autograd.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/relu_grad.cpp b/oneflow/core/job_completer/relu_grad.cpp
similarity index 94%
rename from oneflow/core/autograd/relu_grad.cpp
rename to oneflow/core/job_completer/relu_grad.cpp
index 10b9cefa3..dda78dec0 100644
--- a/oneflow/core/autograd/relu_grad.cpp
+++ b/oneflow/core/job_completer/relu_grad.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autograd.h"
+#include "oneflow/core/job_completer/autograd.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/reshape_grad.cpp b/oneflow/core/job_completer/reshape_grad.cpp
similarity index 95%
rename from oneflow/core/autograd/reshape_grad.cpp
rename to oneflow/core/job_completer/reshape_grad.cpp
index f1b29b6aa..220349e31 100644
--- a/oneflow/core/autograd/reshape_grad.cpp
+++ b/oneflow/core/job_completer/reshape_grad.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autograd.h"
+#include "oneflow/core/job_completer/autograd.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/scalar_add_grad.cpp b/oneflow/core/job_completer/scalar_add_grad.cpp
similarity index 90%
rename from oneflow/core/autograd/scalar_add_grad.cpp
rename to oneflow/core/job_completer/scalar_add_grad.cpp
index 51a2aed2a..af2e8389e 100644
--- a/oneflow/core/autograd/scalar_add_grad.cpp
+++ b/oneflow/core/job_completer/scalar_add_grad.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autograd.h"
+#include "oneflow/core/job_completer/autograd.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/scalar_mul_grad.cpp b/oneflow/core/job_completer/scalar_mul_grad.cpp
similarity index 96%
rename from oneflow/core/autograd/scalar_mul_grad.cpp
rename to oneflow/core/job_completer/scalar_mul_grad.cpp
index 6ce1f9f2a..e50bd877d 100644
--- a/oneflow/core/autograd/scalar_mul_grad.cpp
+++ b/oneflow/core/job_completer/scalar_mul_grad.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autograd.h"
+#include "oneflow/core/job_completer/autograd.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/slice_grad.cpp b/oneflow/core/job_completer/slice_grad.cpp
similarity index 95%
rename from oneflow/core/autograd/slice_grad.cpp
rename to oneflow/core/job_completer/slice_grad.cpp
index 90e02c3ff..554c1bd26 100644
--- a/oneflow/core/autograd/slice_grad.cpp
+++ b/oneflow/core/job_completer/slice_grad.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autograd.h"
+#include "oneflow/core/job_completer/autograd.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/softmax_grad.cpp b/oneflow/core/job_completer/softmax_grad.cpp
similarity index 96%
rename from oneflow/core/autograd/softmax_grad.cpp
rename to oneflow/core/job_completer/softmax_grad.cpp
index d31e1a050..63f3d573a 100644
--- a/oneflow/core/autograd/softmax_grad.cpp
+++ b/oneflow/core/job_completer/softmax_grad.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autograd.h"
+#include "oneflow/core/job_completer/autograd.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/sparse_cross_entropy_grad.cpp b/oneflow/core/job_completer/sparse_cross_entropy_grad.cpp
similarity index 96%
rename from oneflow/core/autograd/sparse_cross_entropy_grad.cpp
rename to oneflow/core/job_completer/sparse_cross_entropy_grad.cpp
index 1a61a4c0a..5f95db5c7 100644
--- a/oneflow/core/autograd/sparse_cross_entropy_grad.cpp
+++ b/oneflow/core/job_completer/sparse_cross_entropy_grad.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autograd.h"
+#include "oneflow/core/job_completer/autograd.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/transpose_grad.cpp b/oneflow/core/job_completer/transpose_grad.cpp
similarity index 96%
rename from oneflow/core/autograd/transpose_grad.cpp
rename to oneflow/core/job_completer/transpose_grad.cpp
index b5e8242ca..38a9f2c82 100644
--- a/oneflow/core/autograd/transpose_grad.cpp
+++ b/oneflow/core/job_completer/transpose_grad.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autograd.h"
+#include "oneflow/core/job_completer/autograd.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/autograd/variable_grad.cpp b/oneflow/core/job_completer/variable_grad.cpp
similarity index 87%
rename from oneflow/core/autograd/variable_grad.cpp
rename to oneflow/core/job_completer/variable_grad.cpp
index 63b111ce4..e3df77bd8 100644
--- a/oneflow/core/autograd/variable_grad.cpp
+++ b/oneflow/core/job_completer/variable_grad.cpp
@@ -1,4 +1,4 @@
-#include "oneflow/core/autograd/autograd.h"
+#include "oneflow/core/job_completer/autograd.h"
 
 namespace oneflow {
 
diff --git a/oneflow/core/operator/op_conf.proto b/oneflow/core/operator/op_conf.proto
index e8f06c718..3fb3aeef8 100644
--- a/oneflow/core/operator/op_conf.proto
+++ b/oneflow/core/operator/op_conf.proto
@@ -1446,3 +1446,10 @@ message OpNameSet {
 message OpNameRelations {
   map<string, string> src_op_name2dst_op_name = 1;
 }
+
+message OpNameGroups {
+  message OpNameGroup {
+    repeated string op_name = 1;
+  }
+  repeated OpNameGroup op_name_group = 2;
+}
diff --git a/oneflow/core/register/logical_blob_id.proto b/oneflow/core/register/logical_blob_id.proto
index 6bc43b560..ed9f4eb49 100644
--- a/oneflow/core/register/logical_blob_id.proto
+++ b/oneflow/core/register/logical_blob_id.proto
@@ -15,4 +15,11 @@ message LogicalBlobIdPair {
 
 message LogicalBlobIdPairs {
   repeated LogicalBlobIdPair pair = 1;
-}
\ No newline at end of file
+}
+
+message LogicalBlobIdGroups {
+  message LogicalBlobIdGroup {
+    repeated LogicalBlobId lbi = 1;
+  }
+  repeated LogicalBlobIdGroup lbi_group = 2;
+}
-- 
GitLab