[llvm-dev] Associating Clang Variable Names with Arguments to Offloading Runtime Functions in OpenMP CodeGen
Alexey.Bataev via llvm-dev
llvm-dev at lists.llvm.org
Thu Oct 8 12:12:31 PDT 2020
Hi,
Did you think about using something like Debugger API to translate
addresses to the var names?
-------------
Best regards,
Alexey Bataev
08.10.2020 11:38 AM, Huber, Joseph via llvm-dev пишет:
> Hello,
>
> A commonly requested feature in the OpenMP Target Runtime is to be
> able to associate offloaded pointers with their original variable
> names. We figured the most straightforward way to accomplish this is
> to make an additional argument to the mapper functions that contains
> an array of structs containing source information about the variables
> similar to how we pass in the size and offset already. This will only
> happen if debugging symbols are enabled, otherwise we'll probably just
> pass a null pointer. So, basically we're planning on turning this
>
> void __tgt_target_data_begin_mapper(int64_t device_id, int32_t arg_num,
> void **args_base, void **args,
> int64_t *arg_sizes, int64_t
> *arg_types,
> void **arg_mappers);
>
> Into something like this for better debugging.
>
> void __tgt_target_data_begin_mapper(ident_t *loc, int64_t device_id,
> int32_t arg_num,
> void **args_base, void **args,
> int64_t *arg_sizes,
> arg_info_struct **arg_info, int64_t *arg_types,
> void **arg_mappers);
>
> I figured we could trace back the original VarDecls used to create the
> mapper arguments and just build a struct using the names (if
> availible). There's a ValueDecl listed in the BasePointerInfo class at
> CGOpenMPRuntime.cpp:7048 but when I tried to access its fields it was
> just a nullptr when I was passing in a single variable. The method
> 'setDevicePtrDecl` is used to set it, but it's only called in a single
> location at CGOpenMPRuntime.cpp:8240 so I'm assuming this is not
> available in the general case.
>
> What do you think would be the best way to approach this? Basically
> just getting the name and line number of the variable declaration that
> was used to build the argument to the offload function.
>
> Thanks,
> Joseph Huber
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20201008/9149c054/attachment.html>
More information about the llvm-dev
mailing list