tensorflow/mlir-hlo

MHLO CAPI is not actually a CAPI

stellaraccident opened this issue · 4 comments

Example:

In file included from /home/stella/src/iree/third_party/mlir-hlo/python/MlirHloModule.cpp:15:
/home/stella/src/iree/third_party/mlir-hlo/include/mlir-hlo-c/Attributes.h:186:32: warning: 'mlirMhloComparisonDirectionAttrGetDirection' has C-linkage specified, but returns user-defined type 'std::string' (aka 'basic_string<char>') which is incompatible with C [-Wreturn-type-c-linkage]
MLIR_CAPI_EXPORTED std::string mlirMhloComparisonDirectionAttrGetDirection(

Suggest adding a dummy .c test which at least includes all of the public headers and will hard fail on such situations.

+1, hitting this in my build too.

There are many functions like that so it results in a wall of build spew.

Any update on this? In certain contexts this is illegal, and in others, it spews warnings. I think that we should delete these offending functions, which are clearly incorrect.

Thank you, Stella! We'll look into this shortly.

Status update: @lipracer has kindly fixed the problems in tensorflow/tensorflow#55888, and we landed the fix in yesterday in 9d95d60. Thank you so much!

To prevent similar issues in the future, we'll add a dummy .c test, as proposed by @stellaraccident, and will connect it to CI to make sure that the CAPI actually stays a CAPI.