We are figuring out how to interact between mlir code and C code when using memrefs, so we tried to implement the C-compatible wrapper emission. However, we get some unexpected results from the example below:
The example starts in the main loop in C. It creates a 1D memref of size 10, and calls an MLIR function @retrieve_dim. The mlir function extracts the size of the memref using memref.dim, and calls the C function @print_index, to print out the retrieved dimension.
I would expect to get a final result of 10, but instead the memref.dim result is a pointer to the array where the size is stored. Is this expected behaviour or is there something wrong with the implementation of the memref wrapper?
Offsets, sizes and strides are stored as integer values, not pointers to values. I also assume you configured the lowering to use 32-bit integers for index and pointer size because the default width is 64 bit.
You can check out the default implementation of the memref structure, which is used in integration tests, here:
Great, thank you! The ODM meeting would be very interesting! However, it is still very early MLIR days for us, so for now there is not much to show. I think it would be more useful to do this at a later stage in our project, in a couple of months.
Our team (MICAS - KU Leuven) is more hardware-focused, and we’re designing a heterogeneous accelerator cluster platform. We’ve now started to design a compiler for this platform using MLIR, to implement our high-level scheduling algorithms.
We will definetly get back to you if we have something interesting to showcase!
I know it has grown into a being a conference-style “show-and-tell” venue, but ODM has been intended to be an open design meeting. It is perfectly fine, and even encouraged, to come to ODM with problems and questions rather than solutions and answers. It can be a group design exercise with input from experts! So don’t hesitate to schedule a slot earlier!