Debugging Tools Tim Purcell NVIDIA.

Slides:



Advertisements
Similar presentations
Debugging Tools Tim Purcell NVIDIA. Programming Soap Box Successful programming systems require at least three ‘tools’ Successful programming systems.
Advertisements

CS 450 MPX P ROJECT Introduction to Turbo C. W HY USE T URBO C? Many ANSI C compilers are available for free, however they lack certain features that.
GLSL Basics Discussion Lecture for CS 418 Spring 2015 TA: Zhicheng Yan, Sushma S Kini, Mary Pietrowicz.
Graphics Pipeline.
 The success of GL lead to OpenGL (1992), a platform-independent API that was  Easy to use  Close enough to the hardware to get excellent performance.
Control Flow Virtualization for General-Purpose Computation on Graphics Hardware Ghulam Lashari Ondrej Lhotak University of Waterloo.
The University of North Carolina - Chapel Hill COMP Spring GPGP - Background Lecture Graphics Pipelines, OpenGL, Fragment Programs, First.
A Crash Course on Programmable Graphics Hardware Li-Yi Wei 2005 at Tsinghua University, Beijing.
The IDE (Integrated Development Environment) provides a DEBUGGER for locating and correcting errors in program logic (logic errors not syntax errors) The.
GPU Simulator Victor Moya. Summary Rendering pipeline for 3D graphics. Rendering pipeline for 3D graphics. Graphic Processors. Graphic Processors. GPU.
The programmable pipeline Lecture 10 Slide Courtesy to Dr. Suresh Venkatasubramanian.
Some Things Jeremy Sugerman 22 February Jeremy Sugerman, FLASHG 22 February 2005 Topics Quick GPU Topics Conditional Execution GPU Ray Tracing.
GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware.
Ray Tracing and Photon Mapping on GPUs Tim PurcellStanford / NVIDIA.
CHAPTER 4 Window Creation and Control © 2008 Cengage Learning EMEA.
Programmable Pipelines. Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
Real-time Graphical Shader Programming with Cg (HLSL)
Integrated Development Environments (IDEs) CS 21a: Introduction to Computing I First Semester,
Geometric Objects and Transformations. Coordinate systems rial.html.
GPU Computation Strategies & Tricks Ian Buck Stanford University.
Chris Kerkhoff Matthew Sullivan 10/16/2009.  Shaders are simple programs that describe the traits of either a vertex or a pixel.  Shaders replace a.
Interactive Time-Dependent Tone Mapping Using Programmable Graphics Hardware Nolan GoodnightGreg HumphreysCliff WoolleyRui Wang University of Virginia.
Instructor Notes GPU debugging is still immature, but being improved daily. You should definitely check to see the latest options available before giving.
The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,
The programmable pipeline Lecture 3.
به نام خدا تنظیم کننده : فرانه حدادی استاد : مهندس زمانیان تابستان 92.
Tone Mapping on GPUs Cliff Woolley University of Virginia Slides courtesy Nolan Goodnight.
Debugging and Profiling With some help from Software Carpentry resources.
GPGPU Tools and Source Code Mark HarrisNVIDIA Developer Technology.
CS662 Computer Graphics Game Technologies Jim X. Chen, Ph.D. Computer Science Department George Mason University.
The Cg Runtime Cyril Zeller. Cg Pipeline Graphics programs are written in Cg and compiled to low-level assembly code... Cg Runtime API...
NVIDIA FX Composer 2 Shader Authoring for Everyone Philippe Rollin Aravind Kalaiah.
CSE 381 – Advanced Game Programming GLSL. Rendering Revisited.
Havok FX Physics on NVIDIA GPUs. Copyright © NVIDIA Corporation 2004 What is Effects Physics? Physics-based effects on a massive scale 10,000s of objects.
Ray Tracing using Programmable Graphics Hardware
GLSL I.  Fixed vs. Programmable  HW fixed function pipeline ▪ Faster ▪ Limited  New programmable hardware ▪ Many effects become possible. ▪ Global.
GPU Computing for GIS James Mower Department of Geography and Planning University at Albany.
An Introduction to the Cg Shading Language Marco Leon Brandeis University Computer Science Department.
COMP 175 | COMPUTER GRAPHICS Remco Chang1/XX13 – GLSL Lecture 13: OpenGL Shading Language (GLSL) COMP 175: Computer Graphics April 12, 2016.
Debugging using By: Samuel Ashby. What is debugging?  A bug is an error in either a program or the hardware itself.  Debugging is first locating and.
Debuggers. Errors in Computer Code Errors in computer programs are commonly known as bugs. Three types of errors in computer programs –Syntax errors –Runtime.
Our Graphics Environment Landscape Rendering. Hardware  CPU  Modern CPUs are multicore processors  User programs can run at the same time as other.
How to use a Pixel Shader CMT3317. Pixel shaders There is NO requirement to use a pixel shader for the coursework though you can if you want to You should.
Introduction to Algorithm. What is Algorithm? an algorithm is any well-defined computational procedure that takes some value, or set of values, as input.
Appendix A Barb Ericson Georgia Institute of Technology May 2006
COMPUTER GRAPHICS CHAPTER 38 CS 482 – Fall 2017 GRAPHICS HARDWARE
14 Compilers, Interpreters and Debuggers
Ying Zhu Georgia State University
Appendix A Barb Ericson Georgia Institute of Technology May 2006
Introduction to Visual Basic 2008 Programming
Programmable Pipelines
A Crash Course on Programmable Graphics Hardware
Graphics on GPU © David Kirk/NVIDIA and Wen-mei W. Hwu,
Graphics Processing Unit
Deferred Lighting.
Introduction to OpenGL
Chapter 6 GPU, Shaders, and Shading Languages
The Graphics Rendering Pipeline
Shading CMSC 435/634.
End-of-Term Winter Progress Report
UMBC Graphics for Games
Graphics Processing Unit
CSC235 - Visual Studio Tutorial
Computer Graphics Practical Lesson 10
Ray Tracing on Programmable Graphics Hardware
Computer Graphics Introduction to Shaders
CIS 441/541: Introduction to Computer Graphics Lecture 15: shaders
Introduction to OpenGL
Workshop for Programming And Systems Management Teachers
CIS 6930: Chip Multiprocessor: GPU Architecture and Programming
Presentation transcript:

Debugging Tools Tim Purcell NVIDIA

Motivation Everyone writes code with bugs For me personally, more often than I care to admit Debugging fragment programs is currently very painful

Programming Soap Box Successful programming systems require at least three ‘tools’ Compiler Cg, HLSL, GLSL, RTSL, Brook… Debugger Profiler

Debugging State of the Art ‘printf’ debugging MOV suspect register to output Comment out anything else writing to output Scale and bias as needed Recompile Display/readback frame buffer Check values Repeat until error is (hopefully) found

‘printf’ Debugging Examples

‘printf’ Debugging Examples

‘printf’ Debugging Examples

‘printf’ Debugging Examples

Ideal Fragment Program Debugger Automate ‘printf’ debugging Intuitive and easy to use interface Features over performance Debuggers don’t need to be fast Should still be interactive Easy to add to existing apps And remove Touch as little GPU state as possible Report actual hardware values No software simulations!

Debugger Features Per-pixel register watch Breakpoints Including interpolants, outputs, etc. Breakpoints Fragment program interpreter Single step forwards or backwards Execute modified code on the fly And save it

Debugger Features - Visualization Display register value at each pixel Color channel masking Arbitrary code for visualization Allows scale and bias of values Multiple visualization windows Visualize each source register and result MUL R2, R1, R0; = x

Debugging Options Today Graphic Remedy gDebugger Microsoft Shader Debugger Tool Apple OpenGL Shader Builder Imdebug – The Image Debugger [B. Baxter] GLIntercept - [D. Trebilco] Shadesmith – [T. Purcell, P. Sen]

Graphic Remedy gDebugger Pros Breakpoints, stepping Watch windows Performance analysis OpenGL 2.0 Cons OpenGL only Currently no program debugging

gDebugger

Microsoft Shader Debugger Tool Pros Direct3D debugging integrated into Visual Studio IDE Full featured Assembly and high level debugging Vertex and fragment programs Watches, breakpoints, etc. Cons Only works with software rasterizer Slow and painful D3D only Shader changes require recompilation

Apple OpenGL Shader Builder Pros Integrated development environment Handy reference guide, resource manager Texture editor On the fly edit and display of shader changes Cons Canned geometry Basically a shader tool (in the traditional sense) not GPGPU debugger ARB vertex/fragment programs only No vendor specific GL extensions support?

imdebug Printf-style debugger imdebug("rgb w=%d h=%d %p", 16, 17, testRGB); Readback memory (texture/frame buffer) and display in image window

imdebug

imdebug Pros Simple addition of single printf-style statement to programs Displays hardware computed values – not software generated values Scale and bias Source available for download Cons Can’t breakpoint shaders Can only watch what shader outputs

GLIntercept Pros Cons Track all OpenGL state Runtime shader edit and recompile Resource tracking and management Cons OpenGL only No shader debugging No direct support for visualizations

GLIntercept

Shadesmith Debugger in the spirit of imdebug Advanced features Simply add a debug statement when binding shaders Display window with scale, bias, component masking Advanced features Can watch any shader register contents without recompile Shader single stepping (forward and backward), breakpointing Shader source edit and reload without recompile

Shadesmith Implementation Insight Only one register modified per instruction Ignore CC for now Decompose fragment program into several smaller programs One program per assembly instruction Save register state on host Two approaches Load/store Iterative deepening

1. Load / Store Style ... ADD R0, R1, f[WPOS]; MAD R1, R0, R2, R3; TEX R2, R1, TEX0, RECT;

1. Load / Store Style Interferes with existing texture state ... ADD R0, R1, f[WPOS]; MAD R1, R0, R2, R3; TEX R2, R1, TEX0, RECT; TEX R0, f[WPOS], TEX0, RECT; TEX R2, f[WPOS], TEX1, RECT; TEX R3, f[WPOS], TEX2, RECT; MAD R1, R0, R2, R3; MOV o[COLR], R1; END Interferes with existing texture state

2. Iterative Deepening Style ... ADD R0, R1, f[WPOS]; MAD R1, R0, R2, R3; TEX R2, R1, TEX0, RECT;

2. Iterative Deepening Style ... ADD R0, R1, f[WPOS]; MAD R1, R0, R2, R3; TEX R2, R1, TEX0, RECT; ... ADD R0, R1, f[WPOS]; MAD R1, R0, R2, R3; MOV o[COLR], R1; END

2. Iterative Deepening Style ... ADD R0, R1, f[WPOS]; MAD R1, R0, R2, R3; TEX R2, R1, TEX0, RECT; ... ADD R0, R1, f[WPOS]; MAD R1, R0, R2, R3; TEX R2, R1, TEX0, RECT; MOV o[COLR], R2; END Later code more expensive than early code

Basic Shadesmith Flow Decompose program into smaller programs Use iterative deepening approach Run programs required to determine watch values One program per value watched Readback modified register to host Via glReadPixels() Display register values per pixel Visualization windows Per-pixel values on mouseover

Future Work Occlusions from multiple fragments GL trace playback debugging Reproducible bugs Eliminate need to ‘drive’ app. and debugger Vertex programs Branching