By default, allocOps have their getAlignment() field set to 64 bytes due to most CPUs having a cache line size of 64 bytes.
Because snitch uses a scratchpad, we only needs align to the memref's element size.
In LowerAllocations.cpp here,
The following lines
uint64_t bitWidth = memRefType.getElementTypeBitWidth();
if (std::optional<uint64_t> alignment = allocOp.getAlignment())
offset = llvm::alignTo(offset, *alignment);
else
offset = llvm::alignTo(offset, llvm::divideCeil(bitWidth, 8));
should be replaced with
offset = llvm::alignTo(offset, llvm::divideCeil(bitWidth, 8));
Relevant Zulip conversation: #Convolve > xDSL Interpreter Cost Model @ 💬