Mousius commented on code in PR #12891:
URL: https://github.com/apache/tvm/pull/12891#discussion_r981109968


##########
python/tvm/relay/backend/contrib/ethosu/tir_to_cs_translator.py:
##########
@@ -254,15 +255,19 @@ def extract_param_base_addresses(mod, buffer_info, 
scratch_region_map) -> List[u
     assert len(mod.functions.items()) == 1
     primfunc = mod.functions.items()[0][1]
 
+    buffer_map = tir_utils.collect_buffer_map(primfunc.body)
+
     base_addresses = list()
     idx = 0
+
     for param in primfunc.params:
         # constants are pooled together and handled specially
         # this will change after tir.allocate_const.
         # For now, we are skipping generating buffer addresses here
         if buffer_info[param].btype == BufferType.constant:
             continue
-        buffer = primfunc.buffer_map[param]
+

Review Comment:
   I've just chatted with @ekalda around this and we're not sure why the extra 
buffer appears, it appears to be an unused intermediary buffer and for the 
tests I ran this fixes it:
   
   ```suggestion
       if param not in buffer_map:
           base_addresses.append(
               util.BaseAddress(
                   param.name.replace("-", "_"),
                   idx,
                   _get_region(buffer_info[param].btype, param, 
scratch_region_map),
                   0,
               )
           )
           idx += 1
           continue
   ```
   
   I can tidy this loop up afterwards :smile_cat: 



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