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

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 23 14:38:31 PDT 2018


It sets the emission kind of the DICompileUnit to NoDebug - but it's still
a DICompileUnit that goes into the IR, which is distinct from the absence
of a DICompileUnit entirely.

No DICompileUnit means no debug info in the IR at all.
A DICompileUnit with NoDebug emission kind is debug info in the IR, but it
tells the backend of LLVM not to emit any debug info for this DICompileUnit
and the things inside it.

On Mon, Apr 23, 2018 at 2:35 PM Alexey Bataev <a.bataev at hotmail.com> wrote:

> Hmm, what I see in clang codegen that currently it just disables emission
> of any debug info, including debug locations.
>
> Best regards,
> Alexey Bataev
>
> 23 апр. 2018 г., в 17:32, David Blaikie <dblaikie at gmail.com> написал(а):
>
> It keeps the debug locations on instructions, but does not emit debug info.
>
> This is used for sample-based profile guided optimization. Optimizations
> can use the locations on instructions to associate the samples in a profile
> with those instructions.
>
> No debug info need be emitted in this case.
>
> On Mon, Apr 23, 2018 at 2:31 PM Alexey Bataev <a.bataev at hotmail.com>
> wrote:
>
>> But why do we need  LocTrackingOnly at all? If it just disables the
>> emission of the debug info completely?
>>
>> Best regards,
>> Alexey Bataev
>>
>> 23 апр. 2018 г., в 17:28, David Blaikie <dblaikie at gmail.com> написал(а):
>>
>> Yes, that's why Paul mentioned what you want is somewhere between
>> LocTrackingOnly and LineTablesOnly.
>>
>> On Mon, Apr 23, 2018 at 2:25 PM Alexey Bataev <a.bataev at hotmail.com>
>> wrote:
>>
>>> Yes, and I could use LocTrackingOnly, but just like I said it currently
>>> does not work at all, it does not allow to emit any debug info at all.
>>>
>>> Best regards,
>>> Alexey Bataev
>>>
>>> 23 апр. 2018 г., в 17:20, David Blaikie <dblaikie at gmail.com> написал(а):
>>>
>>> Yes, that's the purpose of LocTrackingOnly, which is why it doesn't
>>> sound like it'd do what you want? Sounds like you want the line table to be
>>> emitted for sample profiling?
>>>
>>> On Mon, Apr 23, 2018 at 2:01 PM Alexey Bataev <a.bataev at hotmail.com>
>>> wrote:
>>>
>>>> Actually, LocTrackingOnly might work, but currently it just disables
>>>> debug info completely and does not emit anything.
>>>>
>>>> Best regards,
>>>> Alexey Bataev
>>>>
>>>> 23 апр. 2018 г., в 16:58, "paul.robinson at sony.com" <
>>>> paul.robinson at sony.com> написал(а):
>>>>
>>>> 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
>>>> <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> 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
>>>> 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/fd844bb0/attachment.html>


More information about the llvm-commits mailing list