[PATCH] D45782: [DEBUGINFO, NVPTX] Allow to disable debug info from command line.

via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 23 13:58:16 PDT 2018


I think David is suggesting that you add a new enumeration to DebugInfoKind, in clang/include/clang/Basic/DebugInfoOptions.h.  This would go between LocTrackingOnly (which remembers source locations but does not emit any debug sections) and DebugLineTablesOnly (which emits more than just the line tables, despite the name).
--paulr

From: llvm-commits [mailto:llvm-commits-bounces at lists.llvm.org] On Behalf Of Alexey Bataev via llvm-commits
Sent: Monday, April 23, 2018 2:19 PM
To: David Blaikie
Cc: reviews+d45782+public+181908537bbf2c34 at reviews.llvm.org; jholewinski at nvidia.com; llvm-commits at lists.llvm.org; Alexey Bataev
Subject: Re: [PATCH] D45782: [DEBUGINFO, NVPTX] Allow to disable debug info from command line.


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
23.04.2018 14:02, David Blaikie пишет:
Sounds like sort of "-gno-really-line-tables-only" (I kid, somewhat)

What's the end goal for this functionality? Does it make sense to plumb it through as another level alongside GMLT/limited/full?
On Wed, Apr 18, 2018 at 11:43 AM Alexey Bataev via Phabricator via llvm-commits <llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>> wrote:
ABataev created this revision.
ABataev added reviewers: tra, jlebar, echristo.
Herald added subscribers: JDevlieghere, aprantl, jholewinski.

For better support of the CUDA profiling tools with the optimized code
we should be able to emit `.target` directive without `debug` option.
This is required as `.line` and `.file` directives must be emitted, but
the DWARF sections should be ignored. ptxas does not support compilation
of the modules with the enabled debug info when optimization level is

> 0, but allows to emit linenumbers for the profilers.

`-no-cuda-debug` option disables emission of the `debug` option, but not
the emission of the debug info itself.


Repository:
  rL LLVM

https://reviews.llvm.org/D45782<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>

Files:
  lib/Target/NVPTX/NVPTXAsmPrinter.cpp
  test/DebugInfo/NVPTX/debug-info.ll


Index: test/DebugInfo/NVPTX/debug-info.ll
===================================================================
--- test/DebugInfo/NVPTX/debug-info.ll
+++ test/DebugInfo/NVPTX/debug-info.ll
@@ -1,4 +1,5 @@
-; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda | FileCheck %s
+; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda | FileCheck %s --check-prefixes=CHECK,DEBUG
+; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda -no-cuda-debug | FileCheck %s --check-prefixes=CHECK,NODEBUG

 ; // Bitcode int this test case is reduced version of compiled code below:
 ;__device__ inline void res(float x, float y, float *res) { *res = x + y; }
@@ -9,7 +10,8 @@
 ;    res(a * x[i], y[i], &y[i]);
 ;}

-; CHECK: .target sm_{{[0-9]+}}//, debug
+; DEBUG: .target sm_{{[0-9]+}}//, debug
+; NODEBUG: .target sm_{{[0-9]+$}}

 ; CHECK: .visible .entry _Z5saxpyifPfS_(
 ; CHECK: .param .u32 {{.+}},
Index: lib/Target/NVPTX/NVPTXAsmPrinter.cpp
===================================================================
--- lib/Target/NVPTX/NVPTXAsmPrinter.cpp
+++ lib/Target/NVPTX/NVPTXAsmPrinter.cpp
@@ -93,6 +93,11 @@

 #define DEPOTNAME "__local_depot"

+static cl::opt<bool>
+    NoCudaDebug("no-cuda-debug",
+                cl::desc("Do not mark ptx file as having debug info"),
+                cl::init(false));
+
 /// DiscoverDependentGlobals - Return a set of GlobalVariables on which \p V
 /// depends.
 static void
@@ -876,7 +881,7 @@
     O << ", texmode_independent";

   // FIXME: remove comment once debug info is properly supported.
-  if (MMI && MMI->hasDebugInfo())
+  if (MMI && MMI->hasDebugInfo() && !NoCudaDebug)
     O << "//, debug";

   O << "\n";


_______________________________________________
llvm-commits mailing list
llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits<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>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180423/2ec3470f/attachment.html>


More information about the llvm-commits mailing list