<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<pre class="moz-signature" cols="72">Cuda does not allow to compile code at optimization level >0 with debug info, but you can compile code at O1-3 with lineinfo only (i.e. when you have just `.loc` and `.file` directives in the PTX files).
The lineinfo is required for the nvprof, the CUDA profiler. So, our purpose is to emit these directives but without DWARF sections.
Actually, we can live with the DWARF sections in the code for now, the only thing we actually need is just to disable emission of the `,debug` option in the `.target` directive.
But it would be good to disable emission of the DWARF sections. It is required because CUDA tools include the PTX(assembler) file in the resulting binary, thus increasing its final size. 
-------------
Best regards,
Alexey Bataev</pre>
<div class="moz-cite-prefix">23.04.2018 14:02, David Blaikie пишет:<br>
</div>
<blockquote type="cite" cite="mid:CAENS6EvQisP8Zj743kcqXXV0zCfXZVMccLbxfPT-oXxGWQ7AKQ@mail.gmail.com">
<div dir="ltr">Sounds like sort of "-gno-really-line-tables-only" (I kid, somewhat)<br>
<br>
What's the end goal for this functionality? Does it make sense to plumb it through as another level alongside GMLT/limited/full?<br>
<br>
<div class="gmail_quote">
<div dir="ltr">On Wed, Apr 18, 2018 at 11:43 AM Alexey Bataev via Phabricator via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" moz-do-not-send="true">llvm-commits@lists.llvm.org</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
ABataev created this revision.<br>
ABataev added reviewers: tra, jlebar, echristo.<br>
Herald added subscribers: JDevlieghere, aprantl, jholewinski.<br>
<br>
For better support of the CUDA profiling tools with the optimized code<br>
we should be able to emit `.target` directive without `debug` option.<br>
This is required as `.line` and `.file` directives must be emitted, but<br>
the DWARF sections should be ignored. ptxas does not support compilation<br>
of the modules with the enabled debug info when optimization level is<br>
<br>
> 0, but allows to emit linenumbers for the profilers.<br>
<br>
`-no-cuda-debug` option disables emission of the `debug` option, but not<br>
the emission of the debug info itself.<br>
<br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Freviews.llvm.org%2FD45782&data=02%7C01%7C%7C6d63caffde494d491d6608d5a9446866%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636601033622234770&sdata=TtvUF%2Fc4kvsg1Fi%2B5SiDYofzUUzBo%2BkLIRYSwclIP4g%3D&reserved=0" originalsrc="https://reviews.llvm.org/D45782" shash="aUhI0Qq9BctJ3daajF+zkDMsFrhQWKhXzicMbzl9T68SRWGl9KWZEXdb13hS/GkN7IMXIaGN1mNPhRZioFcp0H2Rtg9UaijSXMunthS2eqxWOXn+RxbVngPr2gCNAouaCjj93rb9UJs59lRCL5G+ozU9mLYv77ns/I/nVkUzFFU=" rel="noreferrer" target="_blank" moz-do-not-send="true">https://reviews.llvm.org/D45782</a><br>
<br>
Files:<br>
  lib/Target/NVPTX/NVPTXAsmPrinter.cpp<br>
  test/DebugInfo/NVPTX/debug-info.ll<br>
<br>
<br>
Index: test/DebugInfo/NVPTX/debug-info.ll<br>
===================================================================<br>
--- test/DebugInfo/NVPTX/debug-info.ll<br>
+++ test/DebugInfo/NVPTX/debug-info.ll<br>
@@ -1,4 +1,5 @@<br>
-; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda | FileCheck %s<br>
+; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda | FileCheck %s --check-prefixes=CHECK,DEBUG<br>
+; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda -no-cuda-debug | FileCheck %s --check-prefixes=CHECK,NODEBUG<br>
<br>
 ; // Bitcode int this test case is reduced version of compiled code below:<br>
 ;__device__ inline void res(float x, float y, float *res) { *res = x + y; }<br>
@@ -9,7 +10,8 @@<br>
 ;    res(a * x[i], y[i], &y[i]);<br>
 ;}<br>
<br>
-; CHECK: .target sm_{{[0-9]+}}//, debug<br>
+; DEBUG: .target sm_{{[0-9]+}}//, debug<br>
+; NODEBUG: .target sm_{{[0-9]+$}}<br>
<br>
 ; CHECK: .visible .entry _Z5saxpyifPfS_(<br>
 ; CHECK: .param .u32 {{.+}},<br>
Index: lib/Target/NVPTX/NVPTXAsmPrinter.cpp<br>
===================================================================<br>
--- lib/Target/NVPTX/NVPTXAsmPrinter.cpp<br>
+++ lib/Target/NVPTX/NVPTXAsmPrinter.cpp<br>
@@ -93,6 +93,11 @@<br>
<br>
 #define DEPOTNAME "__local_depot"<br>
<br>
+static cl::opt<bool><br>
+    NoCudaDebug("no-cuda-debug",<br>
+                cl::desc("Do not mark ptx file as having debug info"),<br>
+                cl::init(false));<br>
+<br>
 /// DiscoverDependentGlobals - Return a set of GlobalVariables on which \p V<br>
 /// depends.<br>
 static void<br>
@@ -876,7 +881,7 @@<br>
     O << ", texmode_independent";<br>
<br>
   // FIXME: remove comment once debug info is properly supported.<br>
-  if (MMI && MMI->hasDebugInfo())<br>
+  if (MMI && MMI->hasDebugInfo() && !NoCudaDebug)<br>
     O << "//, debug";<br>
<br>
   O << "\n";<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank" moz-do-not-send="true">llvm-commits@lists.llvm.org</a><br>
<a href="https://nam03.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.llvm.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fllvm-commits&data=02%7C01%7C%7C6d63caffde494d491d6608d5a9446866%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636601033622234770&sdata=xFD8D4h0WRTTPYapBJ3jXszJOPDasL59Us0PwB4ZyyU%3D&reserved=0" originalsrc="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" shash="ZBmgFIPh4bxqpTJ68rDSUtST/Zuu99Zjwfy23m2cWsDf9897WdF7Ukv4BB5hhoIELmpSlZ8o6MwmTDrjeS3hNv/i/mrYe2VaEz4O44XH8uP7gKhgN6iRLHaH3vqlWTR66TcYs6svMNW971x4G4gfebJY0WOmSWvXySUF92KH9c8=" rel="noreferrer" target="_blank" moz-do-not-send="true">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote>
</div>
</div>
</blockquote>
<br>
</body>
</html>