merrymercy commented on a change in pull request #5898:
URL: https://github.com/apache/incubator-tvm/pull/5898#discussion_r444294661



##########
File path: src/te/schedule/schedule_dataflow_rewrite.cc
##########
@@ -614,10 +614,74 @@ void InjectInline(ScheduleNode* sch) {
   }
 }
 
+void LegalizeInvalidAttach(ScheduleNode* sch) {

Review comment:
       ```suggestion
   void LegalizeInvalidAttach(ScheduleNode* sch) {
     // This legalizes the compute_at location if the target iterator of 
compute_at was split or fused.
     // Case 1: If the target of compute_at is split, we will move the 
compute_at location to the inner iterator.
     // Case 2: If the target of compute_at is fused, we will move the 
compute_at location to the newly fused iterator.
     // Note that case 2 can only happen if the target of compute_at is the 
innermost iterator of fuse operation.
   ```
   
   Document this function

##########
File path: src/arith/rewrite_simplify.cc
##########
@@ -133,6 +133,13 @@ PrimExpr RewriteSimplifier::Impl::VisitExpr_(const 
AddNode* op) {
     TVM_TRY_REWRITE(ramp(b1, s1, lanes) + broadcast(x, lanes), ramp(b1 + x, 
s1, lanes));
     TVM_TRY_REWRITE(broadcast(x, lanes) + ramp(b1, s1, lanes), ramp(x + b1, 
s1, lanes));
     TVM_TRY_REWRITE(broadcast(x, lanes) + broadcast(y, lanes), broadcast(x + 
y, lanes));
+    if ((x + broadcast(y, lanes)).Match(ret)) {

Review comment:
       We should rewrite this with FloatImm.

##########
File path: src/arith/rewrite_simplify.cc
##########
@@ -865,6 +900,28 @@ PrimExpr RewriteSimplifier::Impl::VisitExpr_(const 
FloorModNode* op) {
     TVM_TRY_REWRITE_IF(floormod(x + y * c1, c2), floormod(x, c2),
                        c2.Eval()->value > 0 && c1.Eval()->value % 
c2.Eval()->value == 0);
 
+    TVM_TRY_REWRITE_IF(floormod(x * c1 + y, c2), floormod(x, floordiv(c2, c1)) 
* c1 + y,
+                       c1.Eval()->value > 0 && c2.Eval()->value > 0 &&
+                           c2.Eval()->value % c1.Eval()->value == 0 &&
+                           CanProveGreaterEqual(-y.Eval(), -c1.Eval()->value + 
1));
+
+    // TODO(jcf94): For the next two rules, better use the max common factor
+    // of c1, c2, c3 to do the simplification

Review comment:
       Is it easy to do this?
   If it is not easy, we can just delete this todo. I think the current code is 
okay because we can recursively simplify the expression with all the three 
introduced rules.




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

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


Reply via email to