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


##########
src/tir/transforms/storage_rewrite.cc:
##########
@@ -1081,19 +1088,24 @@ struct BufferVarInfo {
       return element_dtype;
     }
 
+    // When there are scalar reads and no writes, access_dtype can be empty 
and we should avoid
+    // rewriting.
+    if (access_dtype.empty()) {
+      return element_dtype;
+    }
     DataType preferred_base_type = *base_access_dtype.begin();
 
-    // If there is only one vectorizable size used to access the
-    // buffer, and if that access size is compatible with the array
-    // size, then the buffer is vectorizable.  In the future, this
-    // could be improved to allow vectorized buffer access of size
-    // GCD(*lanes_used), if necessary.

Review Comment:
   That makes sense, I've updated rewriting. Now the rewriting only trigger if 
there is one vector access dtype with lanes same as the coeff scalar access.



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