[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cfe-dev
Subject:    Re: [cfe-dev] [PROPOSAL] Reintroduce guards for Intel intrinsic headers
From:       Eric Christopher <echristo () gmail ! com>
Date:       2015-07-30 19:55:35
Message-ID: CALehDX7uV_MTaKC=oyzJPqi-czi-uJVNBkVWDpdMLsVqya3uEg () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


>
> KBS> ICC considers all intrinsics to be available in any environment,
> regardless of the compiler switches.  So, you can be generating code
> assuming you are targeting a plain old Pentium Processor and use AVX512
> intriniscs (for example).  We specifically choose this model, and consider
> that if such an intrinsic is used, it implies that the user has done the
> necessary checks to ensure that the processor they are running on, supports
> the intrinsics in use in whatever context that happens to be.  And we can
> propogate that "cpu assertion" around a bit in the control-flow-graph. We
> felt this model was necessary to allow code to be developed which did the
> following:
>
>
>
> if (some condition that is only set for a certain processor) {
>
>    // Use processor specific intrinsics to support optimized code for some
> algorithm based on the dynamic check above.
>
> }
>
>
>
> My understanding is that neither gcc nor clang/LLVM really support this
> type of usage.  Because in order to use say an AVX intrinsic,
>
> the whole module that the intrinsic is used in needs to be compiled with
> the compiler switch targeting AVX, potentially allowing AVX instructions
> outside the "safe" area.  Or for some intrinsics (if you get around of
> ifdef guards), you simply will lower them to a set of instructions that
> implements a similar operation, but without using the wider vector the user
> really intended.
>
>
We (recently) and gcc (in 4.4?) moved away from this and more to a method
that you've got. We both do it on a function by function basis rather than
in code blocks.

-eric


>
>
> Kevin B. Smith
>
>
>
> -- Sean Silva
>
>
>
>
>
>
> I'm just not 100% convinced that removing the header guards was necessary
> (which, I admit, could just be due to a lack of understanding on my part).
>
>
>
> Did the above help?
>
>
>
> -eric
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>

[Attachment #5 (text/html)]

<div dir="ltr"><br><div class="gmail_quote"><blockquote class="gmail_quote" \
style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div \
lang="EN-US" link="blue" vlink="purple"><br> </div><div lang="EN-US" link="blue" \
vlink="purple"><div><div><div><div><div><p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#1f497d">KBS&gt; \
ICC considers all intrinsics to be available in any environment, regardless of the \
compiler switches.   So, you can be generating code assuming you are targeting  a \
plain old Pentium Processor and use AVX512 intriniscs (for example).   We \
specifically choose this model, and consider that if such an intrinsic is used, it \
implies that the user has done the necessary checks to ensure that the processor they \
are running  on, supports the intrinsics in use in whatever context that happens to \
be.   And we can propogate that "cpu assertion" around a bit in the \
control-flow-graph. We felt this model was necessary to allow code to be developed \
which did the following:<u></u><u></u></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> \
<u></u></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#1f497d">if \
(some condition that is only set for a certain processor) {<u></u><u></u></span></p> \
<p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#1f497d"> \
// Use processor specific intrinsics to support optimized code for some algorithm \
based on the dynamic check above.<u></u><u></u></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#1f497d">}<u></u><u></u></span></p>
 <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> \
<u></u></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#1f497d">My \
understanding is that neither gcc nor clang/LLVM really support this type of usage.   \
Because in order to use say an AVX intrinsic,<u></u><u></u></span></p> <p \
class="MsoNormal"><span \
style="font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#1f497d">the \
whole module that the intrinsic is used in needs to be compiled with the compiler \
switch targeting AVX, potentially allowing AVX instructions outside the  "safe" area. \
Or for some intrinsics (if you get around of ifdef guards), you simply will lower \
them to a set of instructions that implements a similar operation, but without using \
the wider vector the user really intended.<u></u><u></u></span></p> <p \
class="MsoNormal"><span \
style="font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#1f \
497d"><u></u></span></p></div></div></div></div></div></div></blockquote><div><br></div><div>We \
(recently) and gcc (in 4.4?) moved away from this and more to a method that \
you&#39;ve got. We both do it on a function by function basis rather than in code \
blocks.</div><div><br></div><div>-eric</div><div>  </div><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div lang="EN-US" link="blue" \
vlink="purple"><div><div><div><div><div><p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#1f497d"> \
<u></u></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#1f497d">Kevin \
B. Smith<u></u><u></u></span></p> </div></div></div></div></div></div><div \
lang="EN-US" link="blue" vlink="purple"><div><div><div><div> <div>
<p class="MsoNormal"><u></u>  <u></u></p>
</div>
<div>
<p class="MsoNormal">-- Sean Silva<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">  <u></u><u></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in \
6.0pt;margin-left:4.8pt;margin-right:0in"> <div>
<div>
<div>
<p class="MsoNormal">  <u></u><u></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in \
6.0pt;margin-left:4.8pt;margin-right:0in"> <p class="MsoNormal" \
style="margin-bottom:12.0pt"><br> I&#39;m just not 100% convinced that removing the \
header guards was necessary (which, I admit, could just be due to a lack of \
understanding on my part).<u></u><u></u></p> </blockquote>
<div>
<p class="MsoNormal"><u></u>  <u></u></p>
</div>
<div>
<p class="MsoNormal">Did the above help?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="color:#888888"><u></u>  <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:#888888">-eric  <u></u><u></u></span></p>
</div>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" \
target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><u></u><u></u></p>
 </blockquote>
</div></div></div></div></div></blockquote></div></div>



_______________________________________________
cfe-dev mailing list
cfe-dev@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic