masahi commented on code in PR #11341:
URL: https://github.com/apache/tvm/pull/11341#discussion_r885061880


##########
python/tvm/topi/x86/injective.py:
##########
@@ -132,5 +130,37 @@ def vectorize(sch, tensor, vectorize_limit):
     return s
 
 
+def schedule_concatenate_cpu(outs):
+    """X86 schedule for concatenate op.
+    Parameters
+    ----------
+    outs: Array of Tensor
+          The computation graph description of injective in the format

Review Comment:
   not injective



##########
python/tvm/topi/x86/injective.py:
##########
@@ -60,14 +62,12 @@ def schedule_injective_from_existing(sch, out):
 
 
 def schedule_injective(outs):
-    """X86 schedule for injective op.
-
+    """X86 reference schedule for injective op.

Review Comment:
   Remove this diff



##########
src/te/schedule/schedule_dataflow_rewrite.cc:
##########
@@ -511,6 +511,29 @@ void InjectInline(ScheduleNode* sch, bool 
feature_extraction_mode) {
   std::vector<bool> changed(sch->stages.size(), false);
   std::vector<Stmt> new_hybrid_body(sch->stages.size());
   std::vector<bool> hybrid_changed(sch->stages.size(), false);
+  // (sshtin): this workaround allows to inline extern ops.

Review Comment:
   Is this referring to "inline into extern ops", or "inline extern ops into 
their consumer"?



##########
src/te/schedule/schedule_dataflow_rewrite.cc:
##########
@@ -511,6 +511,29 @@ void InjectInline(ScheduleNode* sch, bool 
feature_extraction_mode) {
   std::vector<bool> changed(sch->stages.size(), false);
   std::vector<Stmt> new_hybrid_body(sch->stages.size());
   std::vector<bool> hybrid_changed(sch->stages.size(), false);
+  // (sshtin): this workaround allows to inline extern ops.
+  // All inputs for extern op should not be inlined because inlining happens
+  // before generation of TE script for particular extern op. That may lead to

Review Comment:
   What do you mean by TE scripts?



##########
src/te/schedule/schedule_dataflow_rewrite.cc:
##########
@@ -511,6 +511,29 @@ void InjectInline(ScheduleNode* sch, bool 
feature_extraction_mode) {
   std::vector<bool> changed(sch->stages.size(), false);
   std::vector<Stmt> new_hybrid_body(sch->stages.size());
   std::vector<bool> hybrid_changed(sch->stages.size(), false);
+  // (sshtin): this workaround allows to inline extern ops.
+  // All inputs for extern op should not be inlined because inlining happens
+  // before generation of TE script for particular extern op. That may lead to
+  // crash during lowering or building stages.
+  // The problem description:
+  // In case of operations fuzing arguments inlining
+  // prevents creation of ProducerNode for extern operation.
+  // Instead of the creation it supposed to use operation argument as inlined 
buffer

Review Comment:
   it is supposed to



##########
tests/python/unittest/test_micro_model_library_format.py:
##########
@@ -418,14 +419,24 @@ def test_export_byoc_c_module():
         with tf.extractfile("./metadata.json") as f:
             metadata = json.load(f)
         main_md = metadata["memory"]["functions"]["main"]
-        assert main_md == [
-            {
-                "constants_size_bytes": 0,
-                "device": 1,
-                "io_size_bytes": 4800,
-                "workspace_size_bytes": 800,
-            }
-        ]
+        if platform.architecture()[0] == "64bit":
+            assert main_md == [
+                {
+                    "constants_size_bytes": 0,
+                    "device": 1,
+                    "io_size_bytes": 4800,
+                    "workspace_size_bytes": 1264,
+                }
+            ]
+        else:
+            assert main_md == [
+                {
+                    "constants_size_bytes": 0,
+                    "device": 1,
+                    "io_size_bytes": 4800,
+                    "workspace_size_bytes": 1248,
+                }

Review Comment:
   Why does this change affect `workspace_size_bytes`?



##########
src/te/schedule/schedule_dataflow_rewrite.cc:
##########
@@ -511,6 +511,29 @@ void InjectInline(ScheduleNode* sch, bool 
feature_extraction_mode) {
   std::vector<bool> changed(sch->stages.size(), false);
   std::vector<Stmt> new_hybrid_body(sch->stages.size());
   std::vector<bool> hybrid_changed(sch->stages.size(), false);
+  // (sshtin): this workaround allows to inline extern ops.
+  // All inputs for extern op should not be inlined because inlining happens
+  // before generation of TE script for particular extern op. That may lead to
+  // crash during lowering or building stages.
+  // The problem description:
+  // In case of operations fuzing arguments inlining

Review Comment:
   fusing



##########
src/te/schedule/schedule_dataflow_rewrite.cc:
##########
@@ -525,8 +548,13 @@ void InjectInline(ScheduleNode* sch, bool 
feature_extraction_mode) {
         for (auto iv : compute->axis) {
           args.push_back(iv->var);
         }
+        if (ext_ops.find(stage->op) != ext_ops.end()) {
+          // sshtin: The extern op can try to get access to the input tensors 
as a row data,
+          // that can lead to error in TE scripts.

Review Comment:
   What do you mean by `TE scripts`?



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