This is an archive of the discontinued LLVM Phabricator instance.

[DEBUGINFO, NVPTX] Allow to disable debug info from command line.
AbandonedPublic

Authored by ABataev on Apr 18 2018, 11:42 AM.

Details

Summary

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.

Diff Detail

Event Timeline

ABataev created this revision.Apr 18 2018, 11:42 AM

Why can't you use the kind=NoDebug flag on DICompileUnit like the other profiling modes do?

Why can't you use the kind=NoDebug flag on DICompileUnit like the other profiling modes do?

We need to emit .loc and .file directives, NoDebug disables debug info completely.

What's the difference between that and -gline-tables-only?

What's the difference between that and -gline-tables-only?

-gline-table-only still emits .debug_info DWARF sections and because of that debug option is emitted. But it is not allowed to have debug options on .target directive when you need to optimize the code. Without debug option DWARF sections are just ignored.

tra added a comment.Apr 19 2018, 11:03 AM

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

I'm not sure I understand how removing ", debug" helps profiling tools. It does allow compiling PTX with -O1+ even if dwarf bits are present and that is useful, but I'm not sure how it's connected to profiling. Are you saying that nvprof (or something else) may look at the dwarf bits in the PTX?

If dwarf info is not going to make it to SASS, I think we'd be better off not generating dwarf at all.
What do I miss?

In D45782#1072425, @tra wrote:

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

I'm not sure I understand how removing ", debug" helps profiling tools. It does allow compiling PTX with -O1+ even if dwarf bits are present and that is useful, but I'm not sure how it's connected to profiling. Are you saying that nvprof (or something else) may look at the dwarf bits in the PTX?

If dwarf info is not going to make it to SASS, I think we'd be better off not generating dwarf at all.
What do I miss?

, debug should be removed to enable opt level > 0. I checked the ptxas, without , debug it just ignores DWARF sections, but with -lineinfo option it may generate correct data for the nvprof from .loc and .file directives.

tra added a comment.Apr 19 2018, 11:18 AM

, debug should be removed to enable opt level > 0. I checked the ptxas, without , debug it just ignores DWARF sections, but with -lineinfo option it may generate correct data for the nvprof from .loc and .file directives.

Are you saying that enabling lineinfo debug also produces DWARF sections now and that's why we need the flag to ignore them if optimizations are enabled? Previously there was no need because we were emitting only .loc and .file.

In D45782#1072437, @tra wrote:

, debug should be removed to enable opt level > 0. I checked the ptxas, without , debug it just ignores DWARF sections, but with -lineinfo option it may generate correct data for the nvprof from .loc and .file directives.

Are you saying that enabling lineinfo debug also produces DWARF sections now and that's why we need the flag to ignore them if optimizations are enabled? Previously there was no need because we were emitting only .loc and .file.

Yes, currently it is impossible to emit .loc and .file directives without the emission of the DWARF sections as we're using general DebugInfo codebase. Later we could try to disable emission of the DWARF sections if it is not required.

tra accepted this revision.Apr 19 2018, 11:52 AM

Yes, currently it is impossible to emit .loc and .file directives without the emission of the DWARF sections as we're using general DebugInfo codebase. Later we could try to disable emission of the DWARF sections if it is not required.

Got it. This should be included in the patch description. LGTM otherwise.

This revision is now accepted and ready to land.Apr 19 2018, 11:52 AM

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?

ABataev abandoned this revision.Apr 24 2018, 9:10 AM

Need to rework the solution after discussion with David Blaike and Paul Robinson.