csullivan commented on code in PR #11254:
URL: https://github.com/apache/tvm/pull/11254#discussion_r869378345


##########
src/tir/transforms/storage_rewrite.cc:
##########
@@ -661,9 +661,11 @@ class StoragePlanRewriter : public StmtExprMutator {
                                   e->allocs[0]->condition, Evaluate(0));
           if (IsSpecialTaggedMemory(e->scope)) {
             MemoryInfo info = GetMemoryInfo(e->scope.to_string());
-            uint64_t total_elem = e->const_nbits / e->elem_type.bits();
-            ICHECK_LE(total_elem * e->elem_type.bits(), info->max_num_bits)
-                << "Allocation exceed bound of memory tag " << 
e->scope.to_string();
+            if (info.defined()) {
+              uint64_t total_elem = e->const_nbits / e->elem_type.bits();
+              ICHECK_LE(total_elem * e->elem_type.bits(), info->max_num_bits)
+                  << "Allocation exceed bound of memory tag " << 
e->scope.to_string();
+            }

Review Comment:
   As structured, MemoryInfo is not well defined for Nd-memory like 
global.texture. If MemoryInfo is a concept we want to keep around (it's being 
used in two places and there exists only one definition of a MemoryInfo in the 
repo), then we should consider an additional PR to update its semantics. In 
it's current state, a warning would be applicable, I did not do that because 
MemoryInfo is used in other places in storage rewrite without issuing a warning 
when undefined and guarded with `if (info.defined()) {`.
   
   I can update GetMemoryInfo to issue a warning when it returns a default 
constructed MemoryInfo().



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