Hip Rocm logo

Hip Rocm

Community
mohitmishra786
hip-rocm

HIP and ROCm skill for AMD GPU programming. Use when writing HIP kernels with hipcc, porting CUDA code via HIPIFY, profiling with rocprof, debugging with rocgdb, or optimizing for MI300X. Activates on queries about HIP, ROCm, hipify, hipcc, rocprof, or CUDA to AMD porting.

Overview

Publishermohitmishra786
Repositorylow-level-dev-skills
Skill namehip-rocm
Stars
266
Forks
31
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by mohitmishra786 on GitHub. Read the source before you install it.

Installation

Install the Hip Rocm AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/mohitmishra786/low-level-dev-skills/tree/main/skills/gpu/hip-rocm
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/mohitmishra786/low-level-dev-skills.git /tmp/low-level-dev-skills
mkdir -p .claude/skills
cp -r /tmp/low-level-dev-skills/skills/gpu/hip-rocm .claude/skills/hip-rocm
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Hip Rocm in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Hip Rocm on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Hip Rocm is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

HIP / ROCm

Purpose

Guide agents through AMD GPU programming with HIP: the HIP runtime API, hipcc compilation, porting CUDA code with HIPIFY (hipify-perl, hipify-clang), ROCm toolchain setup, profiling with rocprof, debugging with rocgdb, HIP-vs-CUDA API mapping, and MI300X-specific optimizations.

When to Use

  • Porting an existing CUDA codebase to AMD GPUs
  • Setting up ROCm on Linux for MI200/MI300 hardware
  • Writing native HIP kernels for AMD data center GPUs
  • Profiling HIP applications with rocprof or rocprofiler-sdk
  • Debugging device faults with rocgdb or compute sanitizers
  • Building multi-vendor GPU code with HIP portability macros

Workflow

1. ROCm installation and verification

bash
# Ubuntu/Debian (check ROCm docs for your distro version)
sudo apt install rocm-dev rocm-libs hip-dev

# Verify
rocminfo | head -30
hipconfig --version
hipcc --version

# List devices
rocm-smi

Set GPU target for compilation:

bash
export AMDGPU_TARGETS=gfx942   # MI300X
export HIP_PLATFORM=amd

2. Minimal HIP kernel

cpp
// vector_add.hip
#include <hip/hip_runtime.h>
#include <stdio.h>

__global__ void vector_add(const float *a, const float *b, float *c, int n) {
    int i = blockIdx.x * blockDim.x + threadIdx.x;
    if (i < n)
        c[i] = a[i] + b[i];
}

int main(void) {
    const int n = 1 << 20;
    size_t bytes = n * sizeof(float);
    float *d_a, *d_b, *d_c;

    hipMalloc(&d_a, bytes);
    hipMalloc(&d_b, bytes);
    hipMalloc(&d_c, bytes);

    int threads = 256;
    int blocks = (n + threads - 1) / threads;
    hipLaunchKernelGGL(vector_add, dim3(blocks), dim3(threads), 0, 0,
                       d_a, d_b, d_c, n);
    hipDeviceSynchronize();

    hipFree(d_a); hipFree(d_b); hipFree(d_c);
    return 0;
}
bash
hipcc -O3 --offload-arch=gfx942 -o vector_add vector_add.hip
./vector_add

3. CUDA → HIP porting with HIPIFY

bash
# Perl-based batch converter (quick port)
hipify-perl cuda_kernel.cu > cuda_kernel.hip

# Clang-based (more accurate, preserves structure)
hipify-clang cuda_project/ -o hip_project/ --cuda-path=/usr/local/cuda

# Convert single file in place
hipify-clang -inplace --cuda-path=/usr/local/cuda main.cu

Common API mappings:

CUDAHIP
cudaMallochipMalloc
cudaMemcpyhipMemcpy
cudaMemcpyAsynchipMemcpyAsync
cudaStream_thipStream_t
<<<grid, block>>>hipLaunchKernelGGL or <<<>>> (HIP supports CUDA syntax)
__syncthreads()__syncthreads() (same)
threadIdx / blockIdxSame builtins

Portability header for dual compilation:

cpp
#ifdef __HIP_PLATFORM_AMD__
#include <hip/hip_runtime.h>
#else
#include <cuda_runtime.h>
#define hipMalloc cudaMalloc
#define hipMemcpy cudaMemcpy
// ... more macros
#endif

4. hipcc flags

bash
# Target specific GPU architecture
hipcc --offload-arch=gfx942 -O3 -o app main.hip

# Multiple architectures
hipcc --offload-arch=gfx90a --offload-arch=gfx942 -o app main.hip

# Debug
hipcc -g -O0 --offload-arch=gfx942 -o app_debug main.hip

# Link with rocBLAS
hipcc -lrocblas -o app main.hip

5. rocprof profiling

bash
# Basic kernel trace
rocprof --stats ./app

# CSV metrics output
rocprof -i input.csv -o output.csv ./app

# input.csv example:
# pmc: SQ_INSTS_VALU_ADD_F32,SQ_INSTS_VALU_MUL_F32,GRBM_COUNT
bash
# ROCm 6.x rocprofiler-sdk (preferred for new projects)
rocprofv3 --kernel-trace -- ./app

Key metrics (AMD terminology):

  • VALU utilization — compute unit activity
  • LDS bank conflicts — shared memory (LDS) stalls
  • Memory throughput — HBM bandwidth utilization

6. rocgdb debugging

bash
# Build with debug symbols
hipcc -g -O0 --offload-arch=gfx942 -o app_debug main.hip

rocgdb ./app_debug
gdb
(rocgdb) break vector_add
(rocgdb) run
(rocgdb) info rocm kernels
(rocgdb) rocm thread 0 0 0
(rocgdb) print i

AMD also supports compute-sanitizer equivalents via ROCm's roc-obj-extract and memory checking tools where available.

7. MI300X optimizations

bash
# Enable MFMA (matrix fused multiply-add) instructions
hipcc --offload-arch=gfx942 -munsafe-fp-atomics -O3 -o app main.hip
OptimizationMI300X note
Matrix opsUse rocBLAS/hipBLASLt for GEMM; MFMA intrinsics for custom
HBM bandwidth~5.3 TB/s peak (MI300X) — maximize memory coalescing to approach it
Wavefront size64 threads (vs CUDA warp 32) — adjust reduction patterns
LDS (shared mem)64 KB per CU; watch bank conflicts

Wavefront-aware reduction:

cpp
__device__ float warp_reduce_sum(float val) {
    // AMD wavefront = 64 lanes
    for (int offset = 32; offset > 0; offset >>= 1)
        val += __shfl_down(val, offset);
    return val;
}

8. Library ecosystem

NVIDIAAMD ROCm
cuBLASrocBLAS / hipBLAS
cuDNNMIOpen
NCCLrccl
ThrusthipCUB (portable)
cuFFTrocFFT
bash
hipcc -lrocblas -o gemm_test gemm.hip

Common Problems

SymptomCauseFix
hipErrorNoDeviceROCm driver not loadedCheck rocm-smi; add user to render group
Wrong architecture binaryMismatched gfx* targetrocminfo → set --offload-arch
hipify incomplete portCUDA-specific APIsManual fix: cooperative groups, texture refs
Slower than CUDA referenceWavefront 64 vs warp 32Tune block size to multiples of 64
HSA_STATUS_ERRORGPU busy or OOMrocm-smi --showmeminfo; reduce allocation
rocprof empty outputNo kernels launchedVerify hipGetLastError() after launch

Related Skills

  • skills/gpu/cuda — source CUDA patterns being ported
  • skills/gpu/cuda-profiling — Nsight concepts map to rocprof
  • skills/gpu/gpu-memory-model — wavefront vs warp, coalescing rules
  • skills/gpu/triton-lang — Triton supports AMD via ROCm backend
  • skills/compilers/llvm — HIP uses Clang/LLVM toolchain

Frequently asked questions

What does the Hip Rocm AI skill do?

HIP and ROCm skill for AMD GPU programming. Use when writing HIP kernels with hipcc, porting CUDA code via HIPIFY, profiling with rocprof, debugging with rocgdb, or optimizing for MI300X. Activates on queries about HIP, ROCm, hipify, hipcc, rocprof, or CUDA to AMD porting.

Why use Hip Rocm on TypingMind?

Because you install it once and use it with any model. Hip Rocm is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Hip Rocm in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/mohitmishra786/low-level-dev-skills/tree/main/skills/gpu/hip-rocm. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Hip Rocm?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Hip Rocm?

As many as you like. As long as a model supports skills, you can use Hip Rocm with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Hip Rocm AI skill free?

Yes. It is published on GitHub by mohitmishra786 under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇