Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Hexagon] [runtime] VTCM Allocator #12947

Merged
merged 16 commits into from
Oct 3, 2022
Prev Previous commit
Lint, add comment on alignment
janetsc committed Oct 3, 2022
commit 3225011c006c902580bcf953fb49aa9ccdf09214
4 changes: 3 additions & 1 deletion src/runtime/hexagon/hexagon_buffer.cc
Original file line number Diff line number Diff line change
@@ -57,9 +57,11 @@ struct DDRAllocation : public Allocation {

struct VTCMAllocation : public Allocation {
VTCMAllocation(size_t nbytes, size_t alignment) : Allocation(nbytes, alignment) {
CHECK(allocation_nbytes_ == nbytes);
// TODO(HWE): Handle alignments greater than 2k
CHECK(alignment <= 0x800) << "VTCMAllocation called for invalid alignment";
if ((nbytes & 0x7FF) && ((alignment & 0x7FF) == 0)) {
janetsc marked this conversation as resolved.
Show resolved Hide resolved
// Caller has requested 2k alignment, but the size is not a multiple of 2k
// Adjust size to be a multiple of 2k so that we will allocate from the front of the pool
nbytes = nbytes >> 11;
nbytes = nbytes << 11;
nbytes += 0x800;
2 changes: 1 addition & 1 deletion src/runtime/hexagon/hexagon_vtcm_pool.h
Original file line number Diff line number Diff line change
@@ -26,8 +26,8 @@
#include <tvm/runtime/ndarray.h>
#include <tvm/runtime/packed_func.h>

#include <list>
#include <utility>
#include <vector>

namespace tvm {
namespace runtime {