tqchen commented on code in PR #15517:
URL: https://github.com/apache/tvm/pull/15517#discussion_r1290307373


##########
src/tir/transforms/storage_rewrite.cc:
##########
@@ -1304,6 +1307,18 @@ class VectorTypeAccessChecker : public StmtExprVisitor {
       }
     }
 
+    if (detect_scalar_read_patterns_ && is_buffer_load && indices.size()) {
+      const PrimExpr last_dim_index = indices[indices.size() - 1];
+      if (last_dim_index.dtype().lanes() == 1) {
+        arith::ModularSet me = analyzer_.modular_set(last_dim_index);
+        if (me->coeff > 0) {
+          // When coeff == 0, the index is constant and doesn't need to be 
recorded since it can
+          // always be rewritten to shuffle.
+          var_info.access_dtype.insert(access_dtype.with_lanes(me->coeff));

Review Comment:
   i think we need a data structure that captures two things: 
   
   ```c++
   struct VarReadInfo {
      DataType access_dtype;
      // maintained as GCD of all coef of access index
      int64_t simd_coeff;
   };
   ```
   This is mainly to ensure that we don't end up use a very large vector 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: [email protected]

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

Reply via email to