Skip to main content

Differential debugger for CUDA/Triton GPU kernels

Project description

PRLX

Differential debugger for CUDA/Triton GPU kernels. Records per-warp execution traces, diffs them, tells you exactly where, who, what, and why two runs diverged.

What It Does

Run your kernel twice with different inputs. PRLX captures branch decisions, active masks, comparison operands (per-lane), and value history. The differ pinpoints divergences down to the warp level:

Site: 0xfbe6edc1 (2 warps affected)
  Warp 1 @ event 1: Branch Direction
    Trace A: TAKEN
    Trace B: NOT-TAKEN
    Per-Lane Operand Snapshot (icmp sgt):
    Lane       A:lhs       A:rhs       B:lhs       B:rhs
       0          32          10          32          64 <<<
       1          33          10          33          64 <<<
      ...

Installation

pip install prlx

Requirements: CUDA Toolkit 12.0+ and LLVM 18, 19, or 20 on your system.

Building from source
# Build native components
cmake -B build && cmake --build build
cd differ && cargo build --release && cd ..

# Install in development mode
pip install -e .

Requires: CMake 3.20+, LLVM/Clang 18-20, CUDA Toolkit 12.0+, Rust (stable).

Quick Start

CUDA C Kernels

# Compile with automatic instrumentation
./prlx compile my_kernel.cu -o my_kernel

# Capture two traces
PRLX_TRACE=a.prlx PRLX_SNAPSHOT_DEPTH=32 ./my_kernel --good-input
PRLX_TRACE=b.prlx PRLX_SNAPSHOT_DEPTH=32 ./my_kernel --bad-input

# Diff
./prlx diff a.prlx b.prlx --history

Triton Kernels

import prlx
prlx.enable()   # hooks Triton's compilation pipeline

@triton.jit
def my_kernel(...):
    ...  # branches auto-instrumented, no code changes needed

os.environ["PRLX_TRACE"] = "a.prlx"
my_kernel[grid](...)

os.environ["PRLX_TRACE"] = "b.prlx"
my_kernel[grid](...)

Interactive TUI

./prlx diff a.prlx b.prlx --tui

Environment Variables

Variable Default Description
PRLX_TRACE trace.prlx Output trace path
PRLX_SNAPSHOT_DEPTH 0 Per-lane operand capture (ring size)
PRLX_HISTORY_DEPTH 0 Time-travel value history (ring size)
PRLX_SAMPLE_RATE 1 Record 1-in-N events
PRLX_COMPRESS 0 zstd compression
PRLX_ENABLED 1 Kill switch

Project Structure

lib/pass/          LLVM pass — instruments NVPTX modules
lib/runtime/       Device-side recording + host pre/post launch hooks
lib/nvbit_tool/    NVBit binary instrumentation (closed-source kernels)
differ/            Rust differ + TUI
python/prlx/       Triton integration + trace reader
prlx               CLI driver (compile, diff, run, check, triton)
examples/          Demo kernels

Runtime Requirements

Dependency Needed For Install
CUDA Toolkit 12.0+ Kernel compilation + tracing apt install nvidia-cuda-toolkit or NVIDIA
LLVM 18, 19, or 20 prlx compile and Triton hook apt install llvm-20 or via apt.llvm.org

The prlx-diff differ and Python API work without any external dependencies.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prlx-0.1.0-py3-none-manylinux_2_28_x86_64.whl (1.2 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

File details

Details for the file prlx-0.1.0-py3-none-manylinux_2_28_x86_64.whl.

File metadata

  • Download URL: prlx-0.1.0-py3-none-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: Python 3, manylinux: glibc 2.28+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for prlx-0.1.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d9ed94f29f04b773094ccf65e41c7c8ab834836ad91d1cb43e54cd9668f344b6
MD5 699bc2fdd699fb981ea7db1521f285ff
BLAKE2b-256 bea6918b5ac670db1fc305703fdd4fc009ee11fc4696fa04031814a4a5db8b05

See more details on using hashes here.

Provenance

The following attestation bundles were made for prlx-0.1.0-py3-none-manylinux_2_28_x86_64.whl:

Publisher: release.yml on Khushiyant/parallax

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page