# Why is PrimFunc.buffer\_map cleared in MakePackedAPI

**URL:** <https://discuss.tvm.apache.org/t/why-is-primfunc-buffer-map-cleared-in-makepackedapi/10663>\
**Category:** Development\
**Created:** [July 29, 2021, 8:14pm UTC](https://discuss.tvm.apache.org/t/why-is-primfunc-buffer-map-cleared-in-makepackedapi/10663 "2021-07-29T20:14:37Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![tqchen](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/tqchen/32/5_2.png) [@tqchen](https://discuss.tvm.apache.org/u/tqchen)\
**Post date:** [July 30, 2021, 12:47am UTC](https://discuss.tvm.apache.org/t/why-is-primfunc-buffer-map-cleared-in-makepackedapi/10663/2 "2021-07-30T00:47:36Z")

</div>

The main reason is that buffer map represented a specific semantics of variable defs(eg the vars in the buffer).

MakePackedAPI desugars that into a low level form that uses load and intrinsics to define those vars. As a result, the buffer map information can now be stale(or duplicated with the desugared impl).

I would try to defer MakePackedAPI as late as possible and do most of the transformations before that, which allows us to take benefit of the high level mapping info.

---

_[View the full topic](https://discuss.tvm.apache.org/t/why-is-primfunc-buffer-map-cleared-in-makepackedapi/10663)._
