debug-cuda-crash

Diagnose CUDA crashes by capturing pre-crash API inputs with FlashInfer logging.

6.1k|1.3k|Updated Jul 22, 2023
One-click install
npx skills add https://github.com/flashinfer-ai/flashinfer --skill debug-cuda-crash-flashinfer-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: debug-cuda-crash
Source: https://github.com/flashinfer-ai/flashinfer/tree/main/.claude/skills/debug-cuda-crash
Command: npx skills add https://github.com/flashinfer-ai/flashinfer --skill debug-cuda-crash-flashinfer-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This tutorial helps developers diagnose CUDA crashes by using API logging to capture inputs before failures.

Core Features & Use Cases

  • API logging with @flashinfer_api to observe function calls and tensor metadata prior to crashes.
  • Step-by-step debugging workflow for illegal memory access, NaN/Inf, and memory errors on CUDA devices.
  • Guidance on reproducing crashes in controlled environments and extracting actionable input data.

Quick Start

Enable API logging with the appropriate environment settings and run your script to reproduce the crash and inspect the logged inputs.

Frequently Asked Questions about debug-cuda-crash

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I debug CUDA crashes caused by illegal memory access in PyTorch?

To debug CUDA crashes from illegal memory access, enable API logging with the @flashinfer_api decorator to capture pre-crash tensor inputs and metadata. Set the required FLASHINFER_LOGLEVEL and FLASHINFER_LOGDEST environment variables to record function calls before failure.

What is the best way to diagnose kernel failures and NaN/Inf errors on CUDA devices?

The best way to diagnose kernel failures and NaN/Inf errors is to use API logging to inspect input tensors prior to the crash. Applying the @flashinfer_api decorator captures function calls and tensor metadata, allowing you to reproduce crashes in controlled environments.

How do I capture PyTorch API inputs right before a CUDA kernel crash?

You can capture PyTorch API inputs before a CUDA kernel crash by enabling the @flashinfer_api logging decorator. Configure FLASHINFER_LOGLEVEL and FLASHINFER_LOGDEST to output detailed logs, then run your script to reproduce the crash and inspect the recorded inputs.

Do I need specific environment variables to log CUDA API calls for debugging?

Yes, you need to set the FLASHINFER_LOGLEVEL and FLASHINFER_LOGDEST environment variables to enable API logging for debugging. These settings control the verbosity and destination of your logs, allowing you to capture function calls and tensor metadata before a crash.

Why does my CUDA application crash and how can I reproduce it for debugging?

Your CUDA application may crash due to illegal memory access, NaN/Inf values, or kernel failures. You can reproduce the crash for debugging by running your script in a controlled environment with API logging enabled to observe function calls and extract actionable input data before failure.