iree-org / iree

A retargetable MLIR-based machine learning compiler and runtime toolkit.
http://iree.dev/
Apache License 2.0
2.85k stars 614 forks source link

Cleanup IREE runtime API definitions to have proper calling conventions #1203

Open benvanik opened 4 years ago

benvanik commented 4 years ago

There's a few missing bits to get our API really C compatible; or at least there are some places that are not 32-bit (x86) compatible.

Example: mismatched calling conventions:

[build] D:\Dev\iree\iree\vm\stack_test.cc(200): note: This conversion requires a reinterpret_cast, a C-style cast or function-style cast
[build] D:\Dev\iree\iree\vm\stack_test.cc(223): error C2440: '=': cannot convert from 'void (__cdecl *)(void *)' to 'iree_vm_ref_destroy_t'

Example: struct as result:

[build] D:\Dev\iree\iree/vm/module_abi_cc.h(84): error C2440: '=': cannot convert from 'iree_string_view_t (__cdecl *)(void *)' to 'iree_string_view_t (__stdcall *)(void *)'
[build] D:\Dev\iree\iree/vm/module_abi_cc.h(84): note: This conversion requires a reinterpret_cast, a C-style cast or function-style cast

Doing a scrub of these errors (found when compiling for x86 with msvc) would be good for all targets, and have the side-effect of allowing us to build on x86 (which is required to use msvc asan). It may also be a good time to review IREE_API_EXPORT/etc to make sure they do what we want (they are mostly placeholders).

allieculp commented 1 year ago

Sending to backlog due to the date of the issue - please reprioritize if needed.