Skip to content
Agentmart
Submit a tool

gfxgraph-integration

Integrate gfxGRAPH into PyTorch or SGLang projects on AMD ROCm (RDNA2/gfx1030).

Skill by carlosfundora

IndexedMIT★ 1
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/carlosfundora-gfxgraph-integration

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Integrate gfxGRAPH into PyTorch or SGLang projects on AMD ROCm (RDNA2/gfx1030). Provides drop-in CUDA Graph parity, eager fallback, shape bucketing, and VRAM safety. USE FOR: enable CUDA graphs on AMD, integrate gfxGRAPH, configure gfxGRAPH for SGLang, fix graph capture failures on ROCm, RDNA2 CUDA graph compatibility, gfx1030 graph support, HIP graph bridge, monkey-patch torch.cuda.CUDAGraph, shape bucketing for dynamic batches. DO NOT USE FOR: developing or extending gfxGRAPH internals (use gfxgraph-development), general PyTorch ROCm issues unrelated to graph capture.

Use cases: ml

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/gfxgraph-integration

What's inside

Skill name
gfxgraph-integration
Description
Integrate gfxGRAPH into PyTorch or SGLang projects on AMD ROCm (RDNA2/gfx1030). Provides drop-in CUDA Graph parity, eager fallback, shape bucketing, and VRAM safety. USE FOR: enable CUDA graphs on AMD, integrate gfxGRAPH, configure gfxGRAPH for SGLang, fix graph capture failures on ROCm, RDNA2 CUDA graph compatibility, gfx1030 graph support, HIP graph bridge, monkey-patch torch.cuda.CUDAGraph, shape bucketing for dynamic batches. DO NOT USE FOR: developing or extending gfxGRAPH internals (use gfxgraph-development), general PyTorch ROCm issues unrelated to graph capture.
License
MIT
Instructions
225 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# gfxGRAPH Integration Guide

Use gfxGRAPH to enable transparent CUDA Graph capture/replay on AMD RDNA2 GPUs (gfx1030/gfx1031)
where native HIP Graph support has parity gaps. gfxGRAPH is a drop-in replacement — existing
`torch.cuda.CUDAGraph` code works unchanged after `gfxgraph.enable()`.

## Quick Start

### Installation

```bash
# From source (editable — recommended for development)
pip install -e /path/to/gfxGRAPH/python/

# Standard install
pip install /path/to/gfxGRAPH/python/
```

### Verify Installation

```python
import gfxgraph
print(gfxgraph.__version__)       # → "0.3.4"
print(gfxgraph.health_check())    # → {'ok': True, 'gpu': 'AMD Radeon RX 6700 XT', ...}
```

### Enable (Standalone PyTorch)

```python
import gfxgraph
gfxgraph.enable()  # patches torch.cuda.CUDAGraph globally

# All existing CUDA graph code now works on RDNA2:
graph = torch.cuda.CUDAGraph()  # actually BridgedCUDAGraph
```

### Enable (SGLang)

Set environment variables before launching:

```bash
export SGLANG_RDNA2_KERNELS=1           # activates gfxGRAPH in SGLang
export HSA_OVERRIDE_GFX_VERSION=10.3.0  # required for gfx1031 → gfx1030 mapping
export PYTORCH_ROCM_ARCH=gfx1030
export AMD_SERIALIZE_KERNEL=3
export AMD_SERIALIZE_COPY=3

python3 -m sglang.launch_server --model-path <model> ...
```

### Enable (Environment Variable)

```bash
GFXGRAPH=1 python3 my_script.py         # standard mode
GFXGRAPH=debug python3 my_script.py     # verbose logging
GFXGRAPH=validate python3 my_script.py  # correctness checking mode
```

## Core API

### `gfxgraph.enable(**kwargs)`

Monkey-patches `torch.cuda.CUDAGraph` → `BridgedCUDAGraph`. Options:
- `debug=True` — verbose logging (also via `HGB_LOG_LEVEL=debug`)
- `validate=True` — compares graph output vs eager to catch silent bugs (PyTorch #155684)

### `gfxgraph.disable()`

Restores original `torch.cuda.CUDAGraph`. Safe to call even if not enabled.

### `gfxgraph.stats()`

Thread-safe performance counters:
```python
{'enabled_at': 1712..., 'capture_count': 32, 'replay_count': 1847,
 'fallback_count': 0, 'validation_failures': 0, 'avg_replay_us': 42.3}
```

### `gfxgraph.health_check()`

Quick GPU smoke test — captures and replays a trivial graph:
```python
{'ok': True, 'gpu': 'AMD Radeon RX 6700 XT', 'rocm': 'gfx1030',
 'native_bridge': False, 'vram_total_mb': 12288, 'vram_free_mb': 10240,
 'details': 'Graph capture/replay OK, output verified'}
```

## BridgedCUDAGraph

Drop-in replacement for `torch.cuda.CUDAGraph`. Supports both high-level and low-level APIs.

### Low-Level API (SGLang/vLLM compatible)

```python
from hipgraph_bridge import BridgedCUDAGraph

g = BridgedCUDAGraph()
g.capture_begin()
# ... operations ...
g.capture_end()
g.replay()
g.pool()  # returns mempool id
```

### High-Level API (shape bucketing + eager fallback)

```python
g = BridgedCUDAGraph()
with g.capture(dynamic_shapes=True, buckets=[1, 4, 8, 16, 32], model_fn=my_model):
    output = my_model(static_input)
g.replay(batch_size=12)  # auto-selects bucket 16, pads input
```

### Eager Fallback Behavior

When graph capture fails (common on RDNA2 for certain operations):
1. gfxGRAPH logs a warning
2. Sets `_eager_fallback = True`
3. Subsequent `replay()` calls execute the model eagerly via `model_fn`

From carlosfundora/gfxGRAPH, MIT.

More from carlosfundora/gfxGRAPH

Signals

Stars
1
Forks
2
Open issues
0
Last commit (this folder)
Jun 12, 2026 (4 months ago)
Last release
Jun 15, 2026 (4 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from carlosfundora

Cite this page

gfxgraph-integration skill. Agent Mart. https://agentmart.dev/skills/carlosfundora-gfxgraph-integration (last updated 2026-10-24)