<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>1. The problem is that it does not produce errors, it leads to
the emission of some declaration that cannot be resolved by the
linker. This what I was trying to avoid.</p>
<p>2. Yes, I did not disable it on the host side, just for the
device side. I disabled it only for NVPTX target, which is the
device.<br>
</p>
<pre class="moz-signature" cols="72">-------------
Best regards,
Alexey Bataev</pre>
<div class="moz-cite-prefix">15.01.2020 12:49 PM, Artem Belevich
пишет:<br>
</div>
<blockquote type="cite"
cite="mid:CA+wKYkNFpfHkvQrAC398kLbYCmve5GiqKpuyt-Ku54fuNtBZHw@mail.gmail.com">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div class="gmail_default"
style="font-family:verdana,sans-serif">Thank you.</div>
<div class="gmail_default"
style="font-family:verdana,sans-serif"><br>
</div>
<div class="gmail_default"
style="font-family:verdana,sans-serif">In general, RTTI should
probably be treated similar to how we deal with inline
assembly and ignore errors if they are in the code that we're
not going to codegen during this side of compilation. E.g.
during host-side compilation we don't complain about GPU-side
registers in inline assembly that x86 target is not aware of. </div>
<div class="gmail_default"
style="font-family:verdana,sans-serif"><br>
</div>
<div class="gmail_default"
style="font-family:verdana,sans-serif">Disabling RTTI
altogether on device side makes it impossible to use in any
host-side CUDA because RTTI code will be seen by the
device-side compiler, which will promptly fail, which is
exactly what happened in this case -- host-side template that
relied on RTTI failed during device-side compilation:</div>
<div class="gmail_default"
style="font-family:verdana,sans-serif"><br>
</div>
<div class="gmail_default"
style="font-family:verdana,sans-serif"><a
href="https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/arena.h#L536"
moz-do-not-send="true">https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/arena.h#L536</a><br>
</div>
<div class="gmail_default"
style="font-family:verdana,sans-serif">google/protobuf/arena.h:536:15:
error: use of typeid requires -frtti<br>
AllocHook(RTTI_TYPE_ID(T), n);<br>
</div>
<div class="gmail_default"
style="font-family:verdana,sans-serif">...<br>
</div>
<div class="gmail_default"
style="font-family:verdana,sans-serif">2 errors generated when
compiling for sm_60.<br>
</div>
<div class="gmail_default"
style="font-family:verdana,sans-serif"><br>
</div>
<div class="gmail_default"
style="font-family:verdana,sans-serif">--Artem</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Wed, Jan 15, 2020 at 2:36
PM Alexey Bataev <<a href="mailto:a.bataev@outlook.com"
moz-do-not-send="true">a.bataev@outlook.com</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>Sure, will revert it ASAP.<br>
</p>
<pre cols="72">-------------
Best regards,
Alexey Bataev</pre>
<div>15.01.2020 12:26 PM, Artem Belevich пишет:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_default"
style="font-family:verdana,sans-serif">Alexey,</div>
<div class="gmail_default"
style="font-family:verdana,sans-serif"><br>
</div>
<div class="gmail_default"
style="font-family:verdana,sans-serif">This breaks
compilation of our cuda code which happens to
transitively include protobuf headers.</div>
<div class="gmail_default"
style="font-family:verdana,sans-serif">Can you,
please, revert it for now until we figure out how RTTI
should be handled?</div>
<div class="gmail_default"
style="font-family:verdana,sans-serif"><br>
</div>
<div class="gmail_default"
style="font-family:verdana,sans-serif">--Artem<br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Tue, Jan 14, 2020
at 3:15 PM Alexey Bataev via cfe-commits <<a
href="mailto:cfe-commits@lists.llvm.org"
target="_blank" moz-do-not-send="true">cfe-commits@lists.llvm.org</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"><br>
Author: Alexey Bataev<br>
Date: 2020-01-14T18:12:06-05:00<br>
New Revision: 23058f9dd4d7e18239fd63b6da52549514b45fda<br>
<br>
URL: <a
href="https://github.com/llvm/llvm-project/commit/23058f9dd4d7e18239fd63b6da52549514b45fda"
rel="noreferrer" target="_blank"
moz-do-not-send="true">https://github.com/llvm/llvm-project/commit/23058f9dd4d7e18239fd63b6da52549514b45fda</a><br>
DIFF: <a
href="https://github.com/llvm/llvm-project/commit/23058f9dd4d7e18239fd63b6da52549514b45fda.diff"
rel="noreferrer" target="_blank"
moz-do-not-send="true">https://github.com/llvm/llvm-project/commit/23058f9dd4d7e18239fd63b6da52549514b45fda.diff</a><br>
<br>
LOG: [OPENMP]Do not use RTTI by default for NVPTX
devices.<br>
<br>
NVPTX does not support RTTI, so disable it by default.<br>
<br>
Added: <br>
clang/test/Driver/openmp-offload-gpu.cpp<br>
<br>
Modified: <br>
clang/lib/Driver/ToolChain.cpp<br>
<br>
Removed: <br>
<br>
<br>
<br>
################################################################################<br>
diff --git a/clang/lib/Driver/ToolChain.cpp
b/clang/lib/Driver/ToolChain.cpp<br>
index cab97b1a601a..3ebbd30195b3 100644<br>
--- a/clang/lib/Driver/ToolChain.cpp<br>
+++ b/clang/lib/Driver/ToolChain.cpp<br>
@@ -68,7 +68,8 @@ static ToolChain::RTTIMode
CalculateRTTIMode(const ArgList &Args,<br>
}<br>
<br>
// -frtti is default, except for the PS4 CPU.<br>
- return (Triple.isPS4CPU()) ? ToolChain::RM_Disabled
: ToolChain::RM_Enabled;<br>
+ return (Triple.isPS4CPU() || Triple.isNVPTX()) ?
ToolChain::RM_Disabled<br>
+ :
ToolChain::RM_Enabled;<br>
}<br>
<br>
ToolChain::ToolChain(const Driver &D, const
llvm::Triple &T,<br>
<br>
diff --git a/clang/test/Driver/openmp-offload-gpu.cpp
b/clang/test/Driver/openmp-offload-gpu.cpp<br>
new file mode 100644<br>
index 000000000000..9da7308506ae<br>
--- /dev/null<br>
+++ b/clang/test/Driver/openmp-offload-gpu.cpp<br>
@@ -0,0 +1,20 @@<br>
+///<br>
+/// Perform several driver tests for OpenMP
offloading<br>
+///<br>
+<br>
+// REQUIRES: clang-driver<br>
+// REQUIRES: x86-registered-target<br>
+// REQUIRES: powerpc-registered-target<br>
+// REQUIRES: nvptx-registered-target<br>
+<br>
+///
###########################################################################<br>
+<br>
+/// PTXAS is passed -c flag by default when
offloading to an NVIDIA device using OpenMP<br>
+/// Check that the flag is passed when
-fopenmp-relocatable-target is used.<br>
+// RUN: %clangxx -### -fopenmp=libomp
-fopenmp-targets=nvptx64-nvidia-cuda \<br>
+// RUN: -save-temps -no-canonical-prefixes
%s -x c++ -c 2>&1 \<br>
+// RUN: | FileCheck -check-prefix=CHK-RTTI %s<br>
+<br>
+// CHK-RTTI: clang{{.*}}" "-triple"
"nvptx64-nvidia-cuda"<br>
+// CHK-RTTI-SAME: "-fno-rtti"<br>
+<br>
<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org"
target="_blank" moz-do-not-send="true">cfe-commits@lists.llvm.org</a><br>
<a
href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits"
rel="noreferrer" target="_blank"
moz-do-not-send="true">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote>
</div>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr">
<div dir="ltr">--Artem Belevich</div>
</div>
</blockquote>
</div>
</blockquote>
</div>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr" class="gmail_signature">
<div dir="ltr">--Artem Belevich</div>
</div>
</blockquote>
</body>
</html>