You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "vinx13 (via GitHub)" <gi...@apache.org> on 2023/08/10 17:09:08 UTC

[GitHub] [tvm] vinx13 commented on a diff in pull request #15517: [TIR] Shuffle in PointerValueTypeRewrite for scalar reads

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


##########
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:
   access_dtype also contains dtype for write, so the result dtype will be eventually bound by the vectorization lanes of writes



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