<div dir="ltr"><div dir="ltr">Hi Hal,<div><br></div><div>In this case (atomicInc) it's a target specific IR intrinsic but there are other cases where there is target-independent IR support but not clang. OpenCL memory fences for one.</div><div><br></div><div>So the general question is what do do about functions with IR/asm support but no clang builtins.</div><div><br></div><div>Thanks!</div><div><br></div><div>Jon</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 14, 2020 at 5:15 PM Finkel, Hal J. <<a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">



<div>
<p><br>
</p>
<div>On 1/14/20 10:37 AM, Jon Chesterfield via Openmp-dev wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Hello OpenMP dev,
<div><br>
</div>
<div>A motivating example is atomicInc for amdgcn. There is ISA support for this so a good implementation folds to a single instruction. There is no corresponding clang intrinsic, though there is an llvm intrinsic.</div>
</div>
</blockquote>
<p><br>
</p>
<p>Do you mean a target-specific intrinsic, or a target-independent intrinsic?</p>
<p> -Hal<br>
</p>
<p><br>
</p>
<blockquote type="cite">
<div dir="ltr">
<div>
<div><br>
<div>I see the following options:</div>
<div>- Implement it in IR, linked into deviceRTL</div>
<div>- Inline assembly</div>
<div>- Delay implementation until the intrinsic can be added to clang</div>
<div>- Implement in terms of CAS</div>
<div>- Your suggestion here</div>
<div><br>
</div>
<div>Adding atomicInc.ll to the source tree is the easy short term fix. It has drawbacks in terms of future ABI change, build complexity and limited precedent - libclc does this, but nowhere else.</div>
<div><br>
</div>
<div>Inline assembly works (modulo getting the syntax right) and hits the right instruction.</div>
<div><br>
</div>
<div>Implementing in terms of CAS means one can stay in HIP or OpenCL, but performance suffers.</div>
<div><br>
</div>
<div>What would the you prefer out of these options?<br>
</div>
<div><br>
</div>
<div>Thanks,</div>
<div><br>
</div>
<div>Jon</div>
</div>
</div>
</div>
<br>
<fieldset></fieldset>
<pre>_______________________________________________
Openmp-dev mailing list
<a href="mailto:Openmp-dev@lists.llvm.org" target="_blank">Openmp-dev@lists.llvm.org</a>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev</a>
</pre>
</blockquote>
<pre cols="72">-- 
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory</pre>
</div>

</blockquote></div></div>