spcl / open-earth-compiler

development repository for the open earth compiler
https://arxiv.org/abs/2005.13014
Other
72 stars 14 forks source link

problem about laplace example in readme #44

Open lethean1 opened 2 years ago

lethean1 commented 2 years ago

I saw that I should call void _mlir_ciface_laplace(MemRefType3D *input, MemRefType3D *output); in my main.c, but I wonder how can I build a MemRefType3D* type argument in C file?

gysit commented 2 years ago

for example, as follows:

// mlir array type
template <typename Elem, size_t Rank> struct MemRef {
  Elem *allocatedPtr;
  Elem *alignedPtr;
  int32_t offset;
  std::array<int32_t, Rank> sizes;   
  std::array<int32_t, Rank> strides; 
};
typedef MemRef<ElementType, 1> MemRefType1D;
typedef MemRef<ElementType, 2> MemRefType2D;
typedef MemRef<ElementType, 3> MemRefType3D;

Edit: Deleted the index operators since they are only there for convenience,

lethean1 commented 2 years ago

I got it. Thank you!