This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Linalg] Employ finer-grained control of C interface emission
ClosedPublic

Authored by nicolasvasilache on Apr 2 2020, 9:08 PM.

Details

Summary

Linalg makes it possible to interface codegen with externally precompiled HPC libraries. The mechanism to allow such interop uses a normalized ABI and the emission of C interface wrappers.

The mechanism controlling these C interface emission is too aggressive and makes it very easy to obtained undefined symbols for external function (e.g. the ones coming from libm).

This revision uses the newly introduced llvm.emit_c_interface function attribute which allows controlling this behavior at a function granularity. As a consequence LinalgToLLVM does not need to activate the C wrapper emission when adding the StdToLLVM patterns.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptApr 2 2020, 9:08 PM
mehdi_amini accepted this revision.Apr 2 2020, 9:32 PM
mehdi_amini added inline comments.
mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp
406

Can you add a comment explaining this?
This is obvious in the context of this diff, but I'm thinking about someone who does not know the detail of this dance and trying to read this code later.

This revision is now accepted and ready to land.Apr 2 2020, 9:32 PM
nicolasvasilache marked an inline comment as done.Apr 3 2020, 8:14 AM
ftynse accepted this revision.Apr 3 2020, 8:40 AM
This revision was automatically updated to reflect the committed changes.