port-cuda-kernel-to-hip

port-cuda-kernel-to-hip is a skill for Claude Code, Codex from tensormux/kernel-skills. It costs 0 tokens per session (3,305 once invoked), scanned B, original, MIT.

A guide for translating CUDA GPU kernels to HIP, AMD’s programming model for ROCm hardware. It covers adapting execution, memory handling, and the AMD toolchain while preserving the original behavior and performance goals.

In plain words
What is it for?
Use it to port custom kernels to GPUs such as MI250, MI300X, and RDNA3, or to check a conversion made with hipify-perl or hipify-clang.
Why use it?
It helps identify and repair problems that automatic CUDA-to-HIP conversion tools may miss. It is also useful when one codebase must run on both NVIDIA and AMD GPUs.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to port custom kernels to GPUs such as MI250, MI300X, and RDNA3, or to check a conversion made with hipify-perl or hipify-clang.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tensormux/kernel-skills/port-cuda-kernel-to-hip
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add tensormux/kernel-skills --skill port-cuda-kernel-to-hip
Clone the repo
git clone --depth 1 https://github.com/tensormux/kernel-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for port-cuda-kernel-to-hip

README.md
[![agentmods](https://agentmods.dev/badge/skills/tensormux/kernel-skills/port-cuda-kernel-to-hip/github.svg)](https://agentmods.dev/skills/tensormux/kernel-skills/port-cuda-kernel-to-hip)
Your own site
<a href="https://agentmods.dev/skills/tensormux/kernel-skills/port-cuda-kernel-to-hip"><img src="https://agentmods.dev/badge/skills/tensormux/kernel-skills/port-cuda-kernel-to-hip/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for port-cuda-kernel-to-hip

Your own site · 80×15
<a href="https://agentmods.dev/skills/tensormux/kernel-skills/port-cuda-kernel-to-hip"><img src="https://agentmods.dev/badge/skills/tensormux/kernel-skills/port-cuda-kernel-to-hip.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,305 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.03305
Opus 5 $0.00000 $0.01653
Sonnet 5 $0.00000 $0.00661
Haiku 4.5 $0.00000 $0.00331

Measured 12d ago against content hash f55f922f50b9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade B, and why

port-cuda-kernel-to-hip scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Strips warnings and disclaimersmediumAnti-refusal

Omitting safety caveats hides risk from the user and is a common jailbreak preamble.

- [ ] Has the kernel been compiled with `hipcc --offload-arch=<target>` without warnings?
skills/portability/port-cuda-kernel-to-hip/SKILL.md · 137 lines

How it starts

The opening of the file, as written. The whole thing — 137 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Skill: Port a CUDA Kernel to HIP

Purpose

Guide the agent through translating a CUDA kernel to AMD HIP for ROCm-compatible hardware (MI250, MI300, RDNA), preserving correctness and performance intent while adapting to the HIP execution model, memory model, and AMD-specific toolchain.

Use this when

  • An existing, correct CUDA kernel needs to run on AMD GPUs (MI250, MI300X, RDNA3) via the ROCm stack.
  • Building a codebase that needs to support both NVIDIA and AMD hardware from a single source using HIP's compatibility layer.
  • Using hipify-perl or hipify-clang automated conversion and needing to audit and fix what the tool missed or got wrong.
  • The target is MI300X and performance parity with the CUDA original is required (not just functional correctness).

Do not use this when

  • The kernel uses CUDA features with no HIP equivalent and cannot be rewritten (e.g., NVLink-specific topology, NVIDIA Tensor Core PTX instructions for Hopper). In this case, write a backend-agnostic plan first.
  • The kernel is trivially expressed as a higher-level library call (rocBLAS, MIOpen, rocFFT) that already targets AMD platforms. Use the library rather than porting a custom kernel.
  • The goal is Triton instead of HIP — Triton's AMD backend (ROCm) is often a better path for compute-intensive kernels than manual HIP porting.

Inputs the agent should gather first

  • AMD hardware target: CDNA (MI250X, MI300X) for datacenter inference/training, or RDNA (RX 7900, etc.) for consumer. Wavefront size differs: CDNA and RDNA3 are 64-wide wavefronts by default, not 32-wide warps like CUDA.
  • ROCm version: ROCm 5.x vs 6.x — HIP API surface and library availability differs across versions.
  • CUDA features used: identify which features require attention — warp primitives (__shfl_*, __ballot_sync, __any_sync, __all_sync), Tensor Core intrinsics (WMMA/WGMMA), cooperative groups, dynamic parallelism, unified memory, NVTX, NCCL.
  • Performance requirements: is functional correctness sufficient (pass CI), or must performance match or exceed the CUDA original on comparable hardware?
  • Single-source or fork: will the code maintain one source base with #ifdef __HIP_PLATFORM_AMD__ guards, or will there be a separate HIP file?

Read the full file on GitHub · 137 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 137 lines · 0 tokens per session scan B f55f922f50b9

Subscribe to this mod's changes

port-cuda-kernel-to-hip is a skill published in the GitHub repository tensormux/kernel-skills (75 stars, last pushed 2mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,305 tokens. A static security scan graded it B with 1 finding (strips warnings and disclaimers). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

cuopt-developer

Modify, build, test, debug, and contribute to NVIDIA cuOpt (C++/CUDA, Python, server, CI). Use for solver internals, PRs, DCO, and code conventions.

NVIDIA/cuopt · 47 tokens

readable-cpp

Readable C/C++/Rust/CUDA code rules inspired by The Art of Readable Code. Use when writing, reviewing, or refactoring C, C++, Rust, or CUDA code. Enforces short functions, flat control flow, clear naming, readable structure, and idiomatic patterns.

crazyguitar/cppcheatsheet · 63 tokens

cutedsl_megamoe

Skill "cutedsl_megamoe" from flashinfer-ai/flashinfer, covering updating the cutedsl megamoe kernel src, layout, when the kernel team drops a new version of src/ and what not to update here.

flashinfer-ai/flashinfer · 0 tokens

swapab_cutedsl_megakernel

Skill "swapab_cutedsl_megakernel" from flashinfer-ai/flashinfer, covering updating the sm120 swap-ab cutedsl megamoe kernel src, layout, when the kernel team drops a new version of src/ and what not to update here.

flashinfer-ai/flashinfer · 0 tokens

cpp

Comprehensive C/C++ programming reference covering everything from C11-C23 and C++11-C++23, system programming, CUDA GPU computing, debugging tools, Rust interop, and advanced topics. Use for: C/C++ questions, C/C++ interview preparation, modern language features, RAII/memory management, templates/generics, CUDA…

crazyguitar/cppcheatsheet · 0 tokens

hip-kernel-optimization

This skill should be used when writing or tuning HIP kernels on AMD/NVIDIA GPUs, covering memory coalescing, shared-memory tiling, bank conflict avoidance, warp primitives, occupancy, vectorization, async ops, loop unrolling, and profiling.

AMD-AGI/Apex · 56 tokens