You are here: Developer Tools > Desktop Developer Tools > NVIDIA Nsight Visual Studio Edition > PTX and SASS Assembly Debugging

PTX is a low-level parallel-thread execution virtual machine and instruction set architecture (ISA). PTX exposes the GPU as a parallel computing device.

In addition, PTX provides a stable programming model and instruction set for general purpose parallel programming, and is designed to be efficient on NVIDIA GPUs. High-level language compilers for languages such as CUDA and C/C++ generate PTX instructions, which are optimized for and translated to native target-architecture instructions.

SASS is the low-level assembly language that compiles to binary microcode, which executes natively on NVIDIA GPU hardware.

With NVIDIA Nsight 4.7, PTX and SASS assembly debugging is now available. To utilize this feature, use the following tutorial.

To enable PTX/SASS assembly debugging:

  1. In Visual Studio, go to Tools > Options > Debugging.
    Select both Enable Address Level Debugging, as well as the sub-option, Show disassembly if source is not available.

    Currently, this only works with CUDA applications that have debug symbolics (i.e., that are built with –G0).

    In addition, this displays only one CUDA function for the current stopped kernel. The user cannot scroll to other CUDA kernels in the module.
  2. Once the CUDA Debugger is stopped, you can open the Visual Studio Disassembly document through one of the following methods:
    1. The Visual Studio source view's Go to Disassembly command.
    2. The call stack's Go to Disassembly command.
    3. The breakpoint view's Go to Disassembly command.
    4. Using the Visual Studio menu Debug > Windows > Disassembly.

      This can only work when stopped in a CUDA kernel via a breakpoint. There is no static or offline disassembly in the Visual Studio disassembly view.
  3. When going to disassembly, there may be multiple associated addresses. In this case, Visual Studio will pop up a dialog asking you to choose which address you want to view.

  4. The Visual Studio options that are supported in the disassembly document window include the following:
    1. Show Source Code;
    2. Show Code Bytes;
    3. Show Line Numbers;
    4. Show Toolbar;
    5. Show Address.

      Note that the Show Symbols option is currently not supported.
  5. You can choose to view the CUDA disassembly as PTX, SASS, or a PTX and SASS combination.
    This is located in the top-right of the Visual Studio Disassembly view, and controls which disassembly is shown.

    The number in brackets [0090] in the Visual Studio Disassembly View is the PTX line number.
Address Breakpoints

With the CUDA Debugger PTX and SASS assembly debugging feature, address breakpoints are supported. Standard Visual Studio controls for adding and removing breakpoints can be seen in the breakpoint column of the disassembly.

A few items to note with address breakpoints:

  1. Visual Studio disables address breakpoints after each debug session.
  2. These breakpoints may use any of the advanced breakpoint conditionals.
  3. Some instructions are not able to be patched (i.e., breakpoints cannot be set on them). When this happens, the breakpoint will be moved to the previous patchable breakpoint instruction.
  4. The address of a source breakpoint can be seen in the Address column of the Visual Studio breakpoint’s view.
  5. The address breakpoints are always set at a SASS address.
Run Control

When using run control with the CUDA Debugger PTX and SASS assembly debugging, stepping in / out / over all work normally as expected. This follows the Visual Studio Source, Statement, and Instruction control. Stepping in the last line of a kernel will continue the program.

When stepping instructions (which is the default for disassembly) and SASS is showing, the CUDA Debugger will always step at the SASS level.

  1. PTX > Steps only PTX instructions.
  2. SASS > Steps only SASS instructions.
  3. PTX + SASS > Also steps SASS instructions.
Note that there is no control for stepping PTX when SASS is showing.

Additional information on PTX can be found in the CUDA documentation:

NVIDIA GPU Computing Toolkit installation path\CUDA\<version number>\doc\  


NVIDIA GameWorks Documentation Rev. 1.0.150630 ©2015. NVIDIA Corporation. All Rights Reserved.