Make the logic around linking to CPU runtime functions less error-prone.
The way we link to CPU runtime functions from code generated by LLVM is problematic in a few ways: 1. Forgetting to add lookup code in the ORC JIT's resolver for a new builtin does not break JIT tests in obvious ways. JIT tests will usually continue to work because of the way we build our unit tests. 2. There are ways to break the AOT link in ways that don't show up in when JITing by naming the extern "C" symbols incorrectly. This change addresses the above by: - Preventing SimpleResolver from dlsym'ing symbols that start with __xla_cpu_runtime_. This way tests don't just "happen to work" if we forget to add a runtime function to the list. - Using a C++ macro to make sure the C++ symbol names line up correctly with the IR symbol names. This way we know that if the JIT is able to link to a symbol, code generated by the AOT compiler will be able to as well. PiperOrigin-RevId: 162980962
Loading
Please sign in to comment