[llvm] [SPIR-V] Expose an API call to initialize SPIRV target and translate input LLVM IR module to SPIR-V (PR #107216)
Nathan Gauër via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 9 08:45:01 PDT 2024
Keenuts wrote:
> The idea was to introduce a loose coupling between SPIRV BE and its user to achieve mainly two goals:
> avoid forcing a user to include one more header file that would describe this interface in C++ terms (like `struct BuildOptions` data type)
> allow to move development of SPIRV BE and its user library forward with different speed, meaning lack of synchronization with respect of supported and/or mandatory options.
Ok, so if I understand, you want the 3rd party library to be able to call the function on a newer LLVM version, without having to relink/recompile again with the updated headers.
So if in the future, we add another argument in the struct, then LLVM would read garbage on those new fields when called from the old library.
Vulkan already does something for that: the chain of structs, with the `pNext` argument.
An older version would have a linked list of struct with 2 nodes, one with the triple, one with the OptLevel, and last `pNext` is nullptr. Adding new fields means adding new nodes in the list, without breaking back-compat.
But once again, not very knowledgeable about the LLVM API interfaces, so maybe parsing command-line is accepted the way for this kind of back-compat.
https://github.com/llvm/llvm-project/pull/107216
More information about the llvm-commits
mailing list