<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
I don't have anything against making this a target-independent
IR-level, as long as no-one complains about it being a core pass.
Perhaps the pass could only execute if a target explicitly enables a
flag. Something like "preferNonGenericPointers". The default could
be 'false', and the pass would only modify the IR if the target sets
it to 'true'. Of course, this also assumes address space 0 is
generic. This is currently true for the in-tree targets and
CUDA/OpenCL support in Clang, but I don't believe its a set rule
anywhere.<br>
<br>
<div class="moz-cite-prefix">On 03/24/2014 02:28 PM, Jingyue Wu
wrote:<br>
</div>
<blockquote
cite="mid:CAMROOrHx3ATKjqXzXG4oUt2Xh1t2jF3egwq47-kbw7ONQKZFUg@mail.gmail.com"
type="cite">
<div dir="ltr">I agree with your concern. However, both CUDA and
OpenCL (two most popular users of addrspacecast I believe)
support generic address space, and could benefit from this
optimization Would we end up with duplicated code (at least one
for CUDA one for opencl) if we put it in the back-end?
<div>
<br>
</div>
<div>Jingyue</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Mon, Mar 24, 2014 at 11:22 AM,
Justin Holewinski <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:jholewinski@nvidia.com" target="_blank">jholewinski@nvidia.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> The hard part would
be making this optimization general enough to be
target-independent. Optimizing to non-zero address spaces
may not make sense for all targets (or even all future
versions of PTX). I agree that there should be an
IR-level optimization for this, but perhaps its too
target-specific and should actually live in the back-end.
<div>
<div class="h5"><br>
<br>
<div>On 03/24/2014 01:05 PM, Jingyue Wu wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Right. We are aware of this issue,
and think it should be addressed in the IR
optimizer (similar to InstCombineLoadCast and
InstCombineStoreToCast) instead of clang. Do you
think this is an appropriate approach? Is this
optimization general enough to stay in the IR
optimizer or target-dependent?
<div> <br>
</div>
<div>Jingyue</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Mon, Mar 24, 2014 at
4:54 AM, Justin Holewinski <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:justin.holewinski@gmail.com"
target="_blank">justin.holewinski@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0
0 0 .8ex;border-left:1px #ccc
solid;padding-left:1ex">
<div dir="ltr">Hi Jingyue,
<div><br>
</div>
<div>I committed the addrspacecast isel
patterns to NVPTX. Also, I wanted to
point out that your changes in the last
test case in this patch (<a
moz-do-not-send="true"
href="http://address-spaces.cu"
target="_blank">address-spaces.cu</a>)
represent changes that may lead to
performance degradation. Specific address
spaces should be used whenever possible
for loads/stores. Casting everything to a
generic address is still correct, but may
lead to additional indirections for the
hardware.</div>
</div>
<div class="gmail_extra">
<div>
<div><br>
<br>
<div class="gmail_quote">On Fri, Mar 21,
2014 at 2:25 PM, Justin Holewinski <span
dir="ltr"><<a
moz-do-not-send="true"
href="mailto:jholewinski@nvidia.com"
target="_blank">jholewinski@nvidia.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote"
style="margin:0 0 0
.8ex;border-left:1px #ccc
solid;padding-left:1ex">
<div bgcolor="#FFFFFF"
text="#000000">
<div>addrspacecast support in
NVPTX is on my todo list. I'll
try to put something together in
the next few days.
<div>
<div><br>
<br>
On 3/21/14, 2:20 PM, Jingyue
Wu wrote:<br>
</div>
</div>
</div>
<div>
<div>
<blockquote type="cite">
<div dir="ltr">Hi,
<div><br>
</div>
<div>Static local
variables in CUDA can be
declared with address
space qualifiers, such
as __shared__.
Therefore, the codegen
needs to potentially
addrspacecast a static
local variable to the
type expected by its
declaration. Peter did
something similar for
global variables in
r157167. </div>
<div><br>
</div>
<div>All clang tests
passed. </div>
<div><br>
</div>
<div>Justin: The NVPTX
backend support for
addrspacecast seems not
complete. We can send
you follow-up patches
once this one gets in. </div>
<div><br>
</div>
<div> Jingyue</div>
</div>
</blockquote>
<br>
<br>
</div>
</div>
<span><font color="#888888">
<pre cols="72">--
Thanks,
Justin Holewinski</pre>
<div>
<hr> </div>
<div>This email message is for
the sole use of the intended
recipient(s) and may contain
confidential information.
Any unauthorized review,
use, disclosure or
distribution is prohibited.
If you are not the intended
recipient, please contact
the sender by reply email
and destroy all copies of
the original message. </div>
<div>
<hr> </div>
</font></span></div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
</div>
</div>
<span><font color="#888888">-- <br>
<br>
<div>Thanks,</div>
<div><br>
</div>
<div>Justin Holewinski</div>
</font></span></div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
</body>
</html>