You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/09/28 20:31:26 UTC

[GitHub] [tvm] vinx13 opened a new pull request #9145: [TIR][LowerMatchBuffer] Fix lowering strides when source region has higher dimension than the buffer

vinx13 opened a new pull request #9145:
URL: https://github.com/apache/tvm/pull/9145


   This PR fixed a bug in lowering strides when source region has higher dimension than the buffer. Also fixed printing error message in checking `elem_offset` by using the value used in `Bind` (instead of the variable `buffer->elem_offset`)
   
   @Hzfengsy 


-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] vinx13 merged pull request #9145: [TIR][LowerMatchBuffer] Fix lowering strides when source region has higher dimension than the buffer

Posted by GitBox <gi...@apache.org>.
vinx13 merged pull request #9145:
URL: https://github.com/apache/tvm/pull/9145


   


-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] junrushao1994 commented on a change in pull request #9145: [TIR][LowerMatchBuffer] Fix lowering strides when source region has higher dimension than the buffer

Posted by GitBox <gi...@apache.org>.
junrushao1994 commented on a change in pull request #9145:
URL: https://github.com/apache/tvm/pull/9145#discussion_r718167878



##########
File path: src/tir/transforms/lower_match_buffer.cc
##########
@@ -188,25 +188,25 @@ class MatchBufferLower : public StmtExprMutator {
       Load load = Downcast<Load>(source_buffer.vload(indices, source_buffer->dtype));
       Bind(buffer->elem_offset, load->index, buffer->name + ".elem_offset");
       CHECK(analyzer_.CanProve(truncmod(buffer->elem_offset, buffer->offset_factor) == 0))
-          << "The source elem_offset " << buffer->elem_offset
-          << " does not satisfy the offset_factor " << buffer->offset_factor << ".";
+          << "The source elem_offset " << load->index << " does not satisfy the offset_factor "
+          << buffer->offset_factor << ".";
     }
 
     // Step 2.3. Check and update strides
     // Check if target buffer strides are defined
+    ICHECK(source->region.size() >= buffer->shape.size());
+    size_t offset = source->region.size() - buffer->shape.size();

Review comment:
       nit: Let’s avoid size_t here as a general principle (although it’s safe here being guard by a CHECK)




-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] vinx13 merged pull request #9145: [TIR][LowerMatchBuffer] Fix lowering strides when source region has higher dimension than the buffer

Posted by GitBox <gi...@apache.org>.
vinx13 merged pull request #9145:
URL: https://github.com/apache/tvm/pull/9145


   


-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] junrushao1994 commented on a change in pull request #9145: [TIR][LowerMatchBuffer] Fix lowering strides when source region has higher dimension than the buffer

Posted by GitBox <gi...@apache.org>.
junrushao1994 commented on a change in pull request #9145:
URL: https://github.com/apache/tvm/pull/9145#discussion_r718167878



##########
File path: src/tir/transforms/lower_match_buffer.cc
##########
@@ -188,25 +188,25 @@ class MatchBufferLower : public StmtExprMutator {
       Load load = Downcast<Load>(source_buffer.vload(indices, source_buffer->dtype));
       Bind(buffer->elem_offset, load->index, buffer->name + ".elem_offset");
       CHECK(analyzer_.CanProve(truncmod(buffer->elem_offset, buffer->offset_factor) == 0))
-          << "The source elem_offset " << buffer->elem_offset
-          << " does not satisfy the offset_factor " << buffer->offset_factor << ".";
+          << "The source elem_offset " << load->index << " does not satisfy the offset_factor "
+          << buffer->offset_factor << ".";
     }
 
     // Step 2.3. Check and update strides
     // Check if target buffer strides are defined
+    ICHECK(source->region.size() >= buffer->shape.size());
+    size_t offset = source->region.size() - buffer->shape.size();

Review comment:
       Let’s avoid size_t here

##########
File path: src/tir/transforms/lower_match_buffer.cc
##########
@@ -188,25 +188,25 @@ class MatchBufferLower : public StmtExprMutator {
       Load load = Downcast<Load>(source_buffer.vload(indices, source_buffer->dtype));
       Bind(buffer->elem_offset, load->index, buffer->name + ".elem_offset");
       CHECK(analyzer_.CanProve(truncmod(buffer->elem_offset, buffer->offset_factor) == 0))
-          << "The source elem_offset " << buffer->elem_offset
-          << " does not satisfy the offset_factor " << buffer->offset_factor << ".";
+          << "The source elem_offset " << load->index << " does not satisfy the offset_factor "
+          << buffer->offset_factor << ".";
     }
 
     // Step 2.3. Check and update strides
     // Check if target buffer strides are defined
+    ICHECK(source->region.size() >= buffer->shape.size());
+    size_t offset = source->region.size() - buffer->shape.size();

Review comment:
       nit: Let’s avoid size_t here as a general principle (although it’s safe here being guard by a CHECK)




-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] junrushao1994 commented on a change in pull request #9145: [TIR][LowerMatchBuffer] Fix lowering strides when source region has higher dimension than the buffer

Posted by GitBox <gi...@apache.org>.
junrushao1994 commented on a change in pull request #9145:
URL: https://github.com/apache/tvm/pull/9145#discussion_r718167878



##########
File path: src/tir/transforms/lower_match_buffer.cc
##########
@@ -188,25 +188,25 @@ class MatchBufferLower : public StmtExprMutator {
       Load load = Downcast<Load>(source_buffer.vload(indices, source_buffer->dtype));
       Bind(buffer->elem_offset, load->index, buffer->name + ".elem_offset");
       CHECK(analyzer_.CanProve(truncmod(buffer->elem_offset, buffer->offset_factor) == 0))
-          << "The source elem_offset " << buffer->elem_offset
-          << " does not satisfy the offset_factor " << buffer->offset_factor << ".";
+          << "The source elem_offset " << load->index << " does not satisfy the offset_factor "
+          << buffer->offset_factor << ".";
     }
 
     // Step 2.3. Check and update strides
     // Check if target buffer strides are defined
+    ICHECK(source->region.size() >= buffer->shape.size());
+    size_t offset = source->region.size() - buffer->shape.size();

Review comment:
       Let’s avoid size_t here




-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org