[PATCH] D123471: [CUDA] Create offloading entries when using the new driver

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 6 11:06:35 PDT 2022


jhuber6 added a comment.

In D123471#3497169 <https://reviews.llvm.org/D123471#3497169>, @tra wrote:

>> Type struct __tgt_offload_entry {
>>
>>   void    *addr;      // Pointer to the offload entry info.
>>                       // (function or global)
>>   char    *name;      // Name of the function or global.
>>   size_t  size;       // Size of the entry info (0 if it a function).
>>   int32_t flags;
>>   int32_t reserved;
>>
>> };
>
> One thing you need to consider is that this introduces a new ABI. 
> This structure may change over time and we will need to be able to deal with libraries compiled with potentially different version of clang which may use a different format for the entries.
> I think we may need some sort of version stamp.
> We could use the section name for this purpose and rename it when we change the struct format, but that would be a bit more fragile as it's easier to forget to update the name if/when the struct format changes.
> Also, format mismatch would looks like offload section is missing, which would need special handling when we diagnose the problem to distinguish incompatible offload table from the missing offload table.

It's a little tough, I chose that format because it's exactly the same as we use with OpenMP with a few different flags. I wish whoever initially designed the struct made the ``reserved`` field 64-bits so it could conceivably hold a pointer to some additional information, but that ship has sailed. I originally chose to have this match the OpenMP struct because it will heavily simplify things if every language uses this same method for registering their globals. I would like to change it, but I'm not sure how well it would be received considering backwards compatibility. I'm not sure what the best path forward is on that front.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123471/new/

https://reviews.llvm.org/D123471



More information about the cfe-commits mailing list