gfxgraph-development
Develop and extend gfxGRAPH internals — add gap bridges, fix HIP/ROCm issues, debug graph capture failures, and understand the architecture.
Skill by carlosfundora
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-development
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.
About
Use cases: writing
Reviews
Write a reviewNo 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-development
What's inside
- Skill name
gfxgraph-development- Description
- Develop and extend gfxGRAPH internals — add gap bridges, fix HIP/ROCm issues, debug graph capture failures, and understand the architecture. Covers BridgedCUDAGraph, ShapeBucketPool, ConditionalGraph, native bridge, and the monkey-patch system. USE FOR: extend gfxGRAPH, add new gap bridge, fix gfxGRAPH bug, understand gfxGRAPH architecture, modify BridgedCUDAGraph, add gfxGRAPH feature, debug graph capture internals, improve gfxGRAPH performance, gfxGRAPH C++ native bridge, write gfxGRAPH tests. DO NOT USE FOR: just using gfxGRAPH in a project (use gfxgraph-integration), general ROCm issues.
- License
- MIT
- Instructions
- 297 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# gfxGRAPH Development Guide
This skill provides deep knowledge of gfxGRAPH internals for agents who need to modify,
extend, or debug the library itself.
## Repository Layout
```
gfxGRAPH/
├── python/
│ ├── gfxgraph/ # Public package (user-facing)
│ │ ├── __init__.py # Re-exports + auto-enable via GFXGRAPH env var
│ │ ├── __main__.py # CLI: python -m gfxgraph <script.py>
│ │ └── _enable.py # enable()/disable()/stats()/health_check()
│ ├── hipgraph_bridge/ # Internal implementation (the actual bridge)
│ │ ├── __init__.py # Exports BridgedCUDAGraph, ShapeBucketPool
│ │ ├── graph_manager.py # BridgedCUDAGraph — core drop-in replacement
│ │ ├── shape_bucketing.py # ShapeBucketPool — multi-bucket graph pool
│ │ ├── conditional.py # ConditionalGraph — per-branch dispatch (Gap 51)
│ │ ├── compile_backend.py # torch.compile backend registration
│ │ ├── ops.py # Custom torch.library ops (conditional_select)
│ │ └── _C.py # ctypes bindings to native .so (optional)
│ └── pyproject.toml
├── src/ # C/HIP native bridge source
│ └── hipgraph_bridge/
│ └── bridge.hip # Gap bridges 52, 54 (device-side launch, nested capture)
├── include/ # C headers
├── tests/ # HIP C++ tests + Python integration test
├── benchmarks/ # Performance benchmarks
├── docs/
│ ├── hipgraph-bridge-design.md # Full design specification
│ └── torch-hip-rocm-graph.md # CUDA Graph parity matrix (HIP/Torch/MIGraphX)
├── CMakeLists.txt # Native build (requires ROCm SDK)
└── .github/
├── workflows/ # CI
└── skills/ # These skill files
```
## Architecture
### Two-Package Design
- **`gfxgraph`** — Public API package. Users `import gfxgraph` and call `gfxgraph.enable()`.
This package re-exports from `hipgraph_bridge` and manages the monkey-patch lifecycle.
- **`hipgraph_bridge`** — Internal implementation. Contains `BridgedCUDAGraph`, `ShapeBucketPool`,
`ConditionalGraph`, the native `.so` bindings, and all bridge logic.
This separation means `hipgraph_bridge` can be imported directly by code that needs
specific classes without triggering auto-enable behavior.
### Monkey-Patch System (`_enable.py`)
`gfxgraph.enable()` does:
1. Stashes original `torch.cuda.CUDAGraph` in `_originals["CUDAGraph"]`
2. Replaces `torch.cuda.CUDAGraph` with `BridgedCUDAGraph`
3. Optionally registers the `hipgraph_bridge` torch.compile backend
4. Sets up atexit cleanup handler
5. Optionally enables validation mode (graph-vs-eager comparison)
`gfxgraph.disable()` restores originals. Thread-safe stats via `_stats_lock`.
### BridgedCUDAGraph (`graph_manager.py`)
The core class. Key design decisions:
**Low-Level API Compatibility:**
Methods `capture_begin()`, `capture_end()`, `replay()`, `pool()` delegate directly to a
real `_OriginalCUDAGraph` instance. This makes BridgedCUDAGraph a true drop-in for SGLang's
`cuda_graph_runner.py` which uses the low-level API.
**`_OriginalCUDAGraph` Reference:**
Captured at module load time BEFORE any monkey-patching:
```python
_OriginalCUDAGraph = torch.cuda.CUDAGraph
```
This ensures BridgedCUDAGraph always creates real CUDAGraph instances internally,
even after `torch.cuda.CUDAGraph` has been patched.
**Eager Fallback:**
When graph capture fails, `_eager_fallback = True` is set, and subsequent `replay()` calls
execute `model_fn` eagerly. This is the HIGH-LEVEL API path only. The low-level API
(used by SGLang) does NOT fall back — it raises exceptions that the caller handles.
**SIGABRT Prevention (CRITICAL):**
The `_CaptureContext.__exit__` must properly end HIP stream capture BEFORE dropping the
graph reference. Without this:
1. `self.parent._graph = None` triggers Python GC
2. `_OriginalCUDAGraph.__del__` → `at::cuda::CUDAGraph::~CUDAGraph()`
3. C++ destructor calls `hipStreamEndCapture` on stream still in capture mode
4. C++ exception in destructor → `std::terminate()` → SIGABRT
**Fix pattern (apply to ALL error paths in capture):**
```python
graph = self.parent._graph
if graph is not None:
try:
graph.capture_end()
except Exception:
pass
try:
torch.cuda.synchronize()
except Exception:
pass
self.parent._graph = None # NOW safe
```
### ShapeBucketPool (`shape_bucketing.py`)
- Uses `bisect.bisect_left` to find smallest bucket ≥ input size
- Lazy capture: only captures a bucket graph when first needed
- VRAM safety: checks `torch.cuda.mem_get_info()` vs `GFXGRAPH_VRAM_CAP` before capture
- Per-bucket failure tracking: failed buckets use eager fallback permanently
### ConditionalGraph (`conditional.py`)
Gap 51 bridge. Uses per-branch dispatch (separate CUDAGraph per branch) rather than
`hipGraphNodeSetEnabled` (unreliable on gfx1030 for child graph nodes).
### Native Bridge (`_C.py` + `src/`)From carlosfundora/gfxGRAPH, MIT.
More from carlosfundora/gfxGRAPH
- 0.499score
rocm-vram-profiler-diagnostic
carlosfundora
Core runbook for diagnosing memory ceiling limits on AMD's ROCm toolkit natively.
SkillCFreshness: C★ 1Claude Code +9 - 0.497score
gfxgraph-integration
carlosfundora
Integrate gfxGRAPH into PyTorch or SGLang projects on AMD ROCm (RDNA2/gfx1030).
SkillCFreshness: C★ 1Claude Code +9 - 0.496score
rocm-atom-inference
carlosfundora
Guide and resources for deployment and development using the ROCm/AMD ATOM (AiTer Optimized Model) inference backend.
SkillCFreshness: C★ 1Claude Code +9 - 0.494score
gfxgraph-install-readiness
carlosfundora
Assess whether a target environment is ready for gfxGRAPH installation and surface blockers before any changes are made.
SkillCFreshness: C★ 1Claude Code +9 - 0.494score
rocm-ds-smi-science-tools
carlosfundora
Parent overview skill for ROCm Data Science (ROCm-DS) components and SMI tools.
SkillCFreshness: C★ 1Claude Code +9 - 0.491score
gfxgraph-install
carlosfundora
Install gfxGRAPH into a user-specified target directory or environment using the repo's supported uv-based workflow.
SkillCFreshness: C★ 1Claude Code +9 - 0.491score
gfxgraph-benchmarking
carlosfundora
Benchmark gfxGRAPH internals, run the public benchmark suite, and compare performance between Python and Rust.
SkillCFreshness: C★ 1Claude Code +9 - 0.491score
gfxgraph-configure
carlosfundora
Configure or reconfigure gfxGRAPH runtime behavior, environment variables, and replay modes after installation.
SkillCFreshness: C★ 1Claude Code +9 - 0.491score
gfxgraph-testing
carlosfundora
Test gfxGRAPH on real hardware and confirm it is functioning after install or configuration changes.
SkillCFreshness: C★ 1Claude Code +9
Signals
- Stars
- 1
- Forks
- 2
- Open issues
- 0
- Last commit (this folder)
- Jul 24, 2026 (3 months ago)
- Last release
- Jun 15, 2026 (4 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/carlosfundora/gfxGRAPH
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from carlosfundora
- 0.499score
rocm-vram-profiler-diagnostic
carlosfundora
Core runbook for diagnosing memory ceiling limits on AMD's ROCm toolkit natively.
SkillCFreshness: C★ 1Claude Code +9 - 0.497score
gfxgraph-integration
carlosfundora
Integrate gfxGRAPH into PyTorch or SGLang projects on AMD ROCm (RDNA2/gfx1030).
SkillCFreshness: C★ 1Claude Code +9 - 0.496score
rocm-atom-inference
carlosfundora
Guide and resources for deployment and development using the ROCm/AMD ATOM (AiTer Optimized Model) inference backend.
SkillCFreshness: C★ 1Claude Code +9 - 0.494score
gfxgraph-install-readiness
carlosfundora
Assess whether a target environment is ready for gfxGRAPH installation and surface blockers before any changes are made.
SkillCFreshness: C★ 1Claude Code +9 - 0.494score
rocm-ds-smi-science-tools
carlosfundora
Parent overview skill for ROCm Data Science (ROCm-DS) components and SMI tools.
SkillCFreshness: C★ 1Claude Code +9 - 0.491score
gfxgraph-install
carlosfundora
Install gfxGRAPH into a user-specified target directory or environment using the repo's supported uv-based workflow.
SkillCFreshness: C★ 1Claude Code +9
Cite this page
gfxgraph-development skill. Agent Mart. https://agentmart.dev/skills/carlosfundora-gfxgraph-development (last updated 2026-10-24)