<div dir="ltr">Hi John,<div><br></div><div>Thank you for the comments. I am addressing some of them bellow.</div><div><br></div><div>Regards,</div><div>Samuel</div><div class="gmail_extra"><br><br><div class="gmail_quote">
2014-08-11 9:36 GMT-04:00 John Leidel (jleidel) <span dir="ltr"><<a href="mailto:jleidel@micron.com" target="_blank">jleidel@micron.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Sergey [<a href="http://et.al" target="_blank">et.al</a>], thanks for putting this proposal together.  Overall, this looks like a pretty solid approach to providing relatively hardware agnostic omp target functionality.  I had several comments/questions as summarized below:<br>

<br>
Pros:<br>
- We [local colleagues and myself] like the concise target API.  We’re big fans of KISS development principles.<br>
- We believe this provides a good basis for future work in heterogeneous OMP support<br>
<br>
Comments/Questions:<br>
- There doesn’t seem to be any mention of how mutable each runtime function is with respect to its target execution region.  The core OMP spec document notes in several places that certain user-visible runtime calls have “implementation defined” behavior depending upon where/how they’re used.  For example, what happens if the host runtime issues a __tgt_target_data_update() while the target is currently executing (__tgt_rtl_run_target_region() )?  Is this implementation defined?  I’m certainly ok with that answer, but I believe we need to explicitly state what the behavior is.<br>
</blockquote><div><br></div><div>In my view the user-visible OpenMP calls that apply to target regions depend on the state kept in libtarget.so, and are therefore device-type independent. What is device dependent is how the OpenMP terminology is mapped. For example, get_num_teams() would operate on top of the state kept in libtarget.so but how the device interpret a team is device dependent and deviced by the target dependent runtime.</div>
<div> </div><div>A different issue is how the RTL implementation for calls that are common for target and host (i.e. the kmpc_ calls) should be implemented. I think it is a good idea to have some flexibility in the codegen to tune the generation of these calls if the default interface is not suitable for a given target. But in general, the kmpc_ library implementation should be known to the toolchain of that target so it can properly drive the linking.  </div>
<div><br></div><div>About the specific example you mentioned. If I understand it correctly, following the current version of the spec tgt_rtl_run_target_region() has to be blocking so libtarget.so would have to wait for the update to be issued.  The actions in libtarget.so would have to be sequential exactly has the codegeneration expects. If for some reason these constraints change in future specs, both codegeneration and libtarget.so implementation would have to be made consistent.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
- I noticed that Alexandre Eichenberger was one of the authors.  Has he mentioned any support/compatibility with the profiling interfaces he (JMC, <a href="http://et.al" target="_blank">et.al</a>.) proposed?  How does one integrate the proposed profiling runtime logic with a target region (specifically the dispatch & data movement interfaces)?  This would be very handy.<br>

<br>
- I don’t see any mention of an interface to query the physical details of a device.  I know this strays a bit from the notion of portability, but it would be nice to have a simple interface (similar to ‘omp_get_max_threads’).  I stop short of querying information as detailed as provided by hwloc, but it would be nice for the user to have the ability to query the targets and see which ones are appropriate for execution.  This would essentially provide you the ability to build different implementations of a kernel and make a runtime decision on which one to execute.  EG,<br>

if( /* target of some specific type present */ ){<br>
    /* use the omp target interface */<br>
}else{<br>
   /* use the normal worksharing or tasking interfaces */<br>
}<br>
<br>
(I realize this is more of an OMP spec question)<br></blockquote><div><br></div><div>I agree this is more of an OMP spec issue. The fact we are addressing different device-types is already an extension to the spec which poses some issues. One of them, somehow related with this, is how the device ids are mapped to device types. Should this depend on flags passed to the compiler ( e.g. omptargets=A,B with ids 0-1 assigned to A and 2-3 to B given that the runtime identified in the system two devices of each), or should it depend on the environment? In the current proposal, libtarget.so abstracts a single target made of several targets, do we want to let the user prioritize which exact device to use? Should this be decided at compile time or runtime? </div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
- It would be nice to define a runtime and/or environment mechanism that permits the user to enable/disable specific targets.  For example, if a system had four GPUs, but you only wanted to enable two, it would be convenient to do so using an environment variable.  I realize that one could do this using actual runtime calls in the code with some amount of intelligence, but this somewhat defeats the purpose of portability.  Again, this is more related to the 4.x spec, but it does have implications in the lower-level runtime.<br>

<br></blockquote><div><br></div><div>I think this can be solved by the target dependent RTL alone by returning the number of available devices to libtarget.so based on some env variable specified by the RTL.</div><div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
cheers<br>
john<br>
<div><div class="h5"><br>
<br>
On Aug 8, 2014, at 5:22 PM, Sergey Ostanevich <<a href="mailto:sergos.gnu@gmail.com">sergos.gnu@gmail.com</a>> wrote:<br>
<br>
> Hello everybody!<br>
><br>
> I would like to present a proposal for implementation of OpenMP<br>
> offloading in LLVM. It was created by a list of authors and covers the<br>
> runtime part at most and at a very high level. I believe it will be<br>
> good to have input from community at this early stage before moving<br>
> deeper in details.<br>
><br>
> The driver part is intentionally not touched, since we have no clear<br>
> vision on how one can use 3rd party compiler for target code<br>
> generation and incorporate its results into the final host link phase.<br>
> I hope to hear from you more on this.<br>
><br>
> I invite you to take part in discussion of the document. Critics,<br>
> proposals, updates - all are welcome!<br>
><br>
> Thank you,<br>
> Sergey Ostanevich<br>
> Open Source Compilers<br>
> Intel Corporation<br>
</div></div>> <offload-proposal.pdf>_______________________________________________<br>
<div class=""><div class="h5">> LLVM Developers mailing list<br>
> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</div></div></blockquote></div><br></div></div>