<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div><span class="pfptPreheader" style="visibility: hidden; font-size: 1px; line-height: 1px; max-height: 0px; max-width: 0px; opacity: 0; overflow: hidden; display: none !important;display:none!important; visibility:hidden; font-size:1px; color:#ffffff; line-height:1px; max-height:0px; max-width:0px; opacity:0; overflow:hidden">Hello, 
 A commonly requested feature in the OpenMP Target Runtime is to be able to...                                                                                                                                                                                     
</span></div>
<table width="100%" bgcolor="#9CA3A7" border="0" cellspacing="0" cellpadding="16" style="width:100%; border-radius:4px; margin-bottom:16px">
<tbody>
<tr>
<td align="center">
<table class="pfptMainWrapper" width="100%" cellspacing="0" cellpadding="0" border="0" align="center" style="width:100%">
<tbody>
<tr>
<td align="center" valign="top" style="border-radius:4px">
<table bgcolor="#9CA3A7" width="100%" cellspacing="0" cellpadding="0" border="0" align="center" style="max-width:100%; width:100%">
<tbody>
<tr>
<th class="pfptTableColumnLeft" valign="top" style="font-weight:normal; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; width:100%; height:auto">
<table width="100%" cellspacing="0" cellpadding="0" style="width:100%; height:auto; text-align:left; vertical-align:middle">
<tbody>
<tr>
<td><span class="pfptTitle" style="font-family:'Roboto','Helvetica','Arial',sans-serif; font-weight:bold; font-size:18px; line-height:20px; display:block; margin-bottom:4px; word-wrap:normal">This Message Is From an External Sender</span>
</td>
</tr>
<tr>
<td><span class="pfptSubtitle" style="font-weight:normal; font-family:'Roboto','Helvetica','Arial',sans-serif; font-size:13px; line-height:16px; display:block; word-wrap:normal">This message came from outside your organization.</span>
</td>
</tr>
</tbody>
</table>
</th>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hello, </div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
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<br>
<br>
void __tgt_target_data_begin_mapper(int64_t device_id, int32_t arg_num,
<div>                                    void **args_base, void **args,</div>
<div>                                    int64_t *arg_sizes, int64_t *arg_types,</div>
<div>                                    void **arg_mappers);</div>
<br>
Into something like this for better debugging.<br>
<br>
void __tgt_target_data_begin_mapper(ident_t *loc, int64_t device_id, int32_t arg_num,
<div>                                    void **args_base, void **args,</div>
<div>                                    int64_t *arg_sizes, arg_info_struct **arg_info, int64_t *arg_types,</div>
<div>                                    void **arg_mappers);</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
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.<br>
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
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.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Thanks,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Joseph Huber</div>
</body>
</html>