tqchen commented on code in PR #15517:
URL: https://github.com/apache/tvm/pull/15517#discussion_r1297129843
##########
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:
How about we only trigger rewriting if:
- there is vector write
- original dtype was float4
- there is only scalar read access
In a sense that comparing to original case, the only difference is that we
allow scalar read from vector write
--
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]