#include "Dialect/Pim/Transforms/Bufferization/Common.hpp"

using namespace mlir;

IntegerAttr onnx_mlir::pim::getMemRefSizeInBytesAttr(OpBuilder& builder, Value memref) {
  auto type = mlir::cast<MemRefType>(memref.getType());
  int32_t sizeInBytes = static_cast<int32_t>(type.getNumElements() * type.getElementTypeBitWidth() / 8);
  return builder.getI32IntegerAttr(sizeInBytes);
}
