<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 04/26/2018 07:03 PM, Narayanaswamy,
      Ravi wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:BCFA27423AEC4E41B6CBD7B6A8C696B69B39C7AC@ORSMSX109.amr.corp.intel.com">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:"Times New Roman \,serif";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin-top:0in;
        margin-right:0in;
        margin-bottom:8.0pt;
        margin-left:0in;
        line-height:105%;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        line-height:105%;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        color:black;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        line-height:normal;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle22
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle23
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle24
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span style="color:#1F497D">Hi Hal,<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">   We are not
            trying to address issues where the object mapped are of
            different sizes between host and target with different ABI.
            <br>
          </span></p>
      </div>
    </blockquote>
    <br>
    Why are you not trying to address that issue?<br>
    <br>
     -Hal<br>
    <br>
    <blockquote type="cite"
cite="mid:BCFA27423AEC4E41B6CBD7B6A8C696B69B39C7AC@ORSMSX109.amr.corp.intel.com">
      <div class="WordSection1">
        <p class="MsoNormal"><span style="color:#1F497D"> The issue is
            when the objects are of same size like double which is
            8bytes on both 32bit and 64bit platform.  If a double is
            used in a first_private on a target clause,  the 64 bit side
            will pass it as value whereas on the 32bit side since the
            value does not fit in the argument it will be passed as
            pointer to a double. There will be a mis-match at the call
            site and entry site on this value.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">  The main
            reason for this change is that when we do backend outlining
            for target pragmas the targets information needs to be
            communicated to the backend to generate the tables with the
            right names.  Generate LLVM IR for passing this information
            is one mechanism and other is passing the command option to
            the backend.  For the later each pass which needs this info
            will have to change.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">Thanks<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">Ravi<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <div>
          <div style="border:none;border-top:solid #E1E1E1
            1.0pt;padding:3.0pt 0in 0in 0in">
            <p class="MsoNormal"
              style="margin-bottom:0in;margin-bottom:.0001pt;line-height:normal">
              <a name="_____replyseparator" moz-do-not-send="true"></a><b><span
                  style="color:windowtext">From:</span></b><span
                style="color:windowtext"> Hal Finkel [<a
                  href="mailto:hfinkel@anl.gov" moz-do-not-send="true">mailto:hfinkel@anl.gov</a>]
                <br>
                <b>Sent:</b> Wednesday, April 25, 2018 5:50 PM<br>
                <b>To:</b> Lin, Jin <<a
                  href="mailto:jin.lin@intel.com" moz-do-not-send="true">jin.lin@intel.com</a>>;
                Friedman, Eli <<a
                  href="mailto:efriedma@codeaurora.org"
                  moz-do-not-send="true">efriedma@codeaurora.org</a>>;
                '<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>' <<a
                  href="mailto:llvm-dev@lists.llvm.org"
                  moz-do-not-send="true">llvm-dev@lists.llvm.org</a>><br>
                <b>Subject:</b> Re: [llvm-dev] [LLVM][RFC] Representing
                the target device information in the LLVM IR<o:p></o:p></span></p>
          </div>
        </div>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p>Hi, Jin,<span style="font-size:12.0pt;line-height:105%"><o:p></o:p></span></p>
        <p>Can you please back up a bit and talk about the programming
          environment in which this problem manifests?<o:p></o:p></p>
        <p>If I have a host and a target with different ABIs, then it
          seems we have lots of problems. For one thing, the layouts of
          structures are different, the sizes of some integer types are
          different, the sizes of pointers are different, and so on. It
          seems like a solution in this space should address, somehow,
          this general translation problem. Fixing this particular
          problem with the dispatch function's parameters feels like
          only the tip of the iceberg. What if I'm passing a pointer to
          some structure, or a pointer to other pointers, etc.?<o:p></o:p></p>
        <p>I understand that OpenMP v5 is expected to have some custom
          "mappers" to handle deep copying and translation. Is this
          related to the design space here?<o:p></o:p></p>
        <p>Thanks again,<o:p></o:p></p>
        <p>Hal<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <div>
          <p class="MsoNormal">On 04/25/2018 07:22 PM, Lin, Jin via
            llvm-dev wrote:<o:p></o:p></p>
        </div>
        <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
          <p class="MsoNormal"><span style="color:#1F497D">For the
              firstprivate clause, the compiler generates code to pass
              it  by value or by reference to the outlined function. The
              reason the first private scalars is generally passed by
              value is for the performance reason.</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D">For this
              particular case, the compiler cannot generate code to pass
              the double @gg by value under i386-pc-linux-gnu since the
              value is 64 bit while the architecture is 32bit.
            </span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D">For the host
              compilation, the compiler generates the code to pass the
              data as well as the outlined function name to the OMP
              runtime.
            </span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D">For the
              target compilation, the compiler generates the outlined
              function so that it can be called by the OMP runtime. 
            </span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D">So, the
              compiler is required to generate a single call on the host
              to support all the targets. All the target versions must
              have the same interface. So the common interface of the
              outline function should be used. For this particular
              example, the variable @gcc should be passed by reference
              under x86_64-mic.</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D">Please let me
              know if you have more questions.</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D">Jin</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
          <div>
            <div style="border:none;border-top:solid #E1E1E1
              1.0pt;padding:3.0pt 0in 0in 0in">
              <p class="MsoNormal"
                style="margin-bottom:0in;margin-bottom:.0001pt;line-height:normal">
                <b><span style="color:windowtext">From:</span></b><span
                  style="color:windowtext"> Friedman, Eli [<a
                    href="mailto:efriedma@codeaurora.org"
                    moz-do-not-send="true">mailto:efriedma@codeaurora.org</a>]
                  <br>
                  <b>Sent:</b> Wednesday, April 25, 2018 4:14 PM<br>
                  <b>To:</b> Lin, Jin <a
                    href="mailto:jin.lin@intel.com"
                    moz-do-not-send="true"><jin.lin@intel.com></a>;
                  '<a href="mailto:llvm-dev@lists.llvm.org"
                    moz-do-not-send="true">llvm-dev@lists.llvm.org</a>'
                  <a href="mailto:llvm-dev@lists.llvm.org"
                    moz-do-not-send="true"><llvm-dev@lists.llvm.org></a><br>
                  <b>Subject:</b> Re: [llvm-dev] [LLVM][RFC]
                  Representing the target device information in the LLVM
                  IR</span><o:p></o:p></p>
            </div>
          </div>
          <p class="MsoNormal"> <o:p></o:p></p>
          <div>
            <p class="MsoNormal">On 4/25/2018 3:48 PM, Lin, Jin wrote:<o:p></o:p></p>
          </div>
          <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
            <p class="MsoNormal"><span style="color:#0070C0">Given a
                global variable @gg, the compiler has to generate code
                on the host to specify whether it is passed by value or
                passed by reference. In the following example, if the
                compiler generates the code for passing by value, the
                outlined function on the target </span><span
                style="font-family:&quot;color:#0070C0;border:none
                windowtext 1.0pt;padding:0in">i386-pc-linux-gnu</span><span
                style="color:#0070C0"> cannot get the correct value
                since it assumes the variable @gg is passed by
                reference.  </span><o:p></o:p></p>
            <p class="MsoNormal"><span style="color:#0070C0"> </span><o:p></o:p></p>
            <p class="MsoNormal"><span style="color:#0070C0">Here is the
                corresponding IR on the host side.</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="color:red">  %0 = load
                double, double* @gg, align 8, !tbaa !3</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="color:red">  %1 = bitcast
                double %0 to i64</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="color:#1F497D">   …</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="color:#0070C0">  %12 =
                getelementptr inbounds [4 x i8*], [4 x i8*]*
                %.offload_baseptrs, i32 0, i32 2</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="color:#0070C0">  %13 =
                bitcast i8** %12 to i64*</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="color:red">  store i64 %1,
                i64* %13, align 8</span><o:p></o:p></p>
          </blockquote>
          <p class="MsoNormal"
            style="margin-bottom:12.0pt;line-height:normal"><span
              style="font-size:12.0pt;font-family:"Times New Roman
              ,serif",serif"><br>
              Could you describe the overall process of calling an
              offloaded function in a bit more detail?  How do you
              describe the ABI of the called function to the OpenMP
              runtime?<br>
              <br>
              I suspect you shouldn't be trying to store things which
              aren't pointers into offload_baseptrs.<br>
              <br>
              -Eli<br>
              <br>
              <br>
            </span><o:p></o:p></p>
          <pre>-- <o:p></o:p></pre>
          <pre>Employee of Qualcomm Innovation Center, Inc.<o:p></o:p></pre>
          <pre>Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project<o:p></o:p></pre>
          <p class="MsoNormal"
            style="margin-bottom:12.0pt;line-height:normal"><span
              style="font-size:12.0pt;font-family:"Times New
              Roman",serif"><br>
              <br>
              <o:p></o:p></span></p>
          <pre>_______________________________________________<o:p></o:p></pre>
          <pre>LLVM Developers mailing list<o:p></o:p></pre>
          <pre><a href="mailto:llvm-dev@lists.llvm.org" moz-do-not-send="true">llvm-dev@lists.llvm.org</a><o:p></o:p></pre>
          <pre><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" moz-do-not-send="true">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><o:p></o:p></pre>
        </blockquote>
        <p class="MsoNormal"
          style="margin-bottom:12.0pt;line-height:normal"><span
            style="font-size:12.0pt;font-family:"Times New
            Roman",serif"><o:p> </o:p></span></p>
        <pre>-- <o:p></o:p></pre>
        <pre>Hal Finkel<o:p></o:p></pre>
        <pre>Lead, Compiler Technology and Programming Languages<o:p></o:p></pre>
        <pre>Leadership Computing Facility<o:p></o:p></pre>
        <pre>Argonne National Laboratory<o:p></o:p></pre>
      </div>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory</pre>
  </body>
</html>