kparzysz-quic commented on PR #11181:
URL: https://github.com/apache/tvm/pull/11181#issuecomment-1119095386

   > Change the index of tbaa to be based on "underlying datatype` inspired by 
#6046, or fallback to byte. Tag node on buffer dtype is removed because it 
seems that there should not exist type tree paths of different dtype tag on the 
same buffer.
   
   Before the "typed buffers" were introduced, it was possible to use all kinds 
of types to access the memory (for example by redeclaring buffers with the same 
buffer variable, but with different types).  So, you could read/write 
`float32`, then access the same storage with `int16` (not necessarily using the 
same BufferNode, though), etc.  As per some older comments, the TBAA annotation 
code was borrowed from Halide, and I can speculate that the dtype was added to 
TBAA to indicate that data with one underlying type will not be accessed via 
another underlying type.  So, you could reuse buffers, but if you stored 
`float32` you'd better not be trying to read it as `int32`, which follows the 
C/C++ type based aliasing rules.  We don't have any specific aliasing rules in 
TIR that I'm aware of, but removing the type tag will make all accesses to the 
same buffer be aliased.  This may be a good thing because it's safe, but we 
need to make that a deliberate decision (and document it somewhere 
 if it isn't yet).


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