debug-cuda-crash

Diagnose CUDA crashes by analyzing FlashInfer API logs in PyTorch workloads.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/sunxxuns/flashinfer --skill debug-cuda-crash
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: debug-cuda-crash
Source: https://github.com/sunxxuns/flashinfer/tree/main/.claude/skills/debug-cuda-crash
Command: npx skills add https://github.com/sunxxuns/flashinfer --skill debug-cuda-crash

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a guided approach to diagnosing CUDA crashes by enabling and analyzing FlashInfer's API logs, turning cryptic failures into actionable insights.

Core Features & Use Cases

  • API-based debugging: Capture, log, and inspect API calls and tensor metadata when a CUDA crash occurs.
  • Reproducible workflows: Step-by-step instructions to reproduce crashes in PyTorch CUDA workloads across single or multi-GPU setups.
  • Targeted diagnostics: Quickly identify offending inputs, shapes, and steps leading to illegal memory accesses, NaN/Inf, or out-of-bounds errors.

Quick Start

  • Enable basic logging: export FLASHINFER_LOGLEVEL=1; export FLASHINFER_LOGDEST=stdout
  • Run a CUDA-enabled PyTorch script that exercises a FlashInfer API (e.g., batch_decode_with_padded_kv_cache) to reproduce the crash
  • Open the logs to locate the API call trace and the tensor metadata that point to the root cause

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 a CUDA crash in PyTorch?

Debug a CUDA crash by enabling FlashInfer API logs to capture and inspect API calls and tensor metadata, revealing the root cause of memory errors or illegal accesses.

What environment variables do I need to diagnose illegal memory accesses in FlashInfer?

Diagnose illegal memory accesses by setting FLASHINFER_LOGLEVEL to 1 and FLASHINFER_LOGDEST to stdout before running your PyTorch CUDA workload to generate actionable logs.

Can I trace NaN and Inf issues during multi-GPU PyTorch runs?

Trace NaN and Inf issues across multi-GPU runs by enabling FlashInfer API logging to capture tensor metadata and identify offending inputs and shapes at the failing step.

Does this approach work with the batch_decode_with_padded_kv_cache API?

This approach works with batch_decode_with_padded_kv_cache by logging API call traces and tensor metadata to quickly identify out-of-bounds errors and offending shapes.

What is the best way to reproduce a CUDA crash to capture diagnostic logs?

Reproduce a CUDA crash by configuring the FlashInfer logging environment variables, then executing a CUDA-enabled PyTorch script that exercises the failing API to generate the trace.

Why does my CUDA workload fail with a cryptic error instead of a readable trace?

Your CUDA workload fails cryptically because API logging is disabled; enabling FlashInfer logs turns these failures into actionable insights by recording the API call trace and tensor metadata.