This is an archive of the discontinued LLVM Phabricator instance.

Add an example of integration test invoking MLIR source with Memref from C
ClosedPublic

Authored by mehdi_amini on Jan 11 2022, 6:14 PM.

Diff Detail

Event Timeline

mehdi_amini created this revision.Jan 11 2022, 6:14 PM
mehdi_amini requested review of this revision.Jan 11 2022, 6:14 PM
ftynse accepted this revision.Jan 12 2022, 12:31 AM
ftynse added inline comments.
mlir/test/Integration/Dialect/Memref/memref_abi.c
61

Nit: I'd use intptr_t that better reflects what index is lowered to.

This revision is now accepted and ready to land.Jan 12 2022, 12:31 AM
bondhugula accepted this revision.Jan 12 2022, 12:42 AM
bondhugula added a subscriber: bondhugula.

Nice! Some minor comments below.

mlir/test/Integration/Dialect/Memref/memref_abi.c
50

will be in MLIR -> in MLIR LLVM dialect will be

76

Nit: descriptor -> memref_descriptor

76–81

Shouldn't we expose a struct memref_descriptor from include/mlir-c/?

77

Nit: Place these on separate lines consistent with the remaining three fields.

ftynse added inline comments.Jan 12 2022, 12:46 AM
mlir/test/Integration/Dialect/Memref/memref_abi.c
76–81

We already have it in ExecutionEngine/CRunnerUtils.h. I like the self-containedness of this example, otherwise we make it look like one must include a header from MLIR to interface with memrefs.

mehdi_amini marked 5 inline comments as done.

Address comments

mlir/test/Integration/Dialect/Memref/memref_abi.c
76–81

Yes I really tried to provide a minimalist example without any dependency so folks can really see the mechanism at hand.

We likely should invest in C runtime, we discussed it in the past...