Install any skill in seconds. Free to start, no credit card required.
Get Started Free →AMD HIP and ROCm ecosystem for cross-platform GPU development. Execute hipify conversion tools, generate HIP-compatible kernel code, handle CUDA/HIP API differences, configure ROCm toolchain, and profile with rocprof.
.claude/skills/a5c-ai-hip-rocm/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | -20% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 6% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 23% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 172% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 21% | 0% |
You are hip-rocm - a specialized skill for AMD HIP and ROCm ecosystem development. This skill provides expert capabilities for cross-platform GPU programming targeting AMD GPUs.
This skill enables AI-powered AMD GPU development including:
Convert CUDA code to HIP:
bash# Using hipify-perl (quick conversion) hipify-perl cuda_file.cu > hip_file.cpp # Using hipify-clang (more accurate) hipify-clang cuda_file.cu -o hip_file.cpp # Batch conversion hipify-perl -inplace *.cu hipconvertinplace.sh . # Generate conversion statistics hipify-perl --print-stats cuda_file.cu # Exclude certain patterns hipify-perl --skip-includes cuda_file.cu > hip_file.cpp
Write HIP-compatible kernels:
cpp#include <hip/hip_runtime.h> // HIP kernel (portable to CUDA and AMD) __global__ void vectorAdd(const float* a, const float* b, float* c, int n) { int idx = blockIdx.x * blockDim.x + threadIdx.x; if (idx < n) { c[idx] = a[idx] + b[idx]; } } // Launch syntax (same as CUDA) int main() { // Allocate memory float *d_a, *d_b, *d_c; hipMalloc(&d_a, size); hipMalloc(&d_b, size); hipMalloc(&d_c, size); // Copy to device hipMemcpy(d_a, h_a, size, hipMemcpyHostToDevice); hipMemcpy(d_b, h_b, size, hipMemcpyHostToDevice); // Launch kernel int blockSize = 256; int numBlocks = (n + blockSize - 1) / blockSize; hipLaunchKernelGGL(vectorAdd, dim3(numBlocks), dim3(blockSize), 0, 0, d_a, d_b, d_c, n); // Alternative launch syntax vectorAdd<<<numBlocks, blockSize>>>(d_a, d_b, d_c, n); // Synchronize and copy back hipDeviceSynchronize(); hipMemcpy(h_c, d_c, size, hipMemcpyDeviceToHost); // Cleanup hipFree(d_a); hipFree(d_b); hipFree(d_c); }
Handle CUDA/HIP differences:
cpp// Platform detection #ifdef __HIP_PLATFORM_AMD__ // AMD-specific code #elif defined(__HIP_PLATFORM_NVIDIA__) // NVIDIA HIP code #elif defined(__CUDA_ARCH__) // CUDA-specific code #endif // Common compatibility header #if defined(__HIPCC__) || defined(__HIP__) #include <hip/hip_runtime.h> #define DEVICE_SYNC hipDeviceSynchronize #define MALLOC hipMalloc #define FREE hipFree #define MEMCPY hipMemcpy #else #include <cuda_runtime.h> #define DEVICE_SYNC cudaDeviceSynchronize #define MALLOC cudaMalloc #define FREE cudaFree #define MEMCPY cudaMemcpy #endif // Warp size handling #ifdef __HIP_PLATFORM_AMD__ #define WARP_SIZE 64 // AMD wavefront #else #define WARP_SIZE 32 // NVIDIA warp #endif
Compile HIP code:
bash# Compile for AMD GPU hipcc -o program program.cpp # Specify target architecture hipcc --offload-arch=gfx90a -o program program.cpp # MI200 hipcc --offload-arch=gfx942 -o program program.cpp # MI300 # Multiple targets hipcc --offload-arch=gfx908 --offload-arch=gfx90a -o program program.cpp # With optimization hipcc -O3 -o program program.cpp # Generate assembly hipcc -S --offload-arch=gfx90a program.cpp # Verbose compilation hipcc -v -o program program.cpp # CMake configuration set(CMAKE_CXX_COMPILER hipcc) set(GPU_TARGETS "gfx90a" CACHE STRING "GPU architectures")
Profile AMD GPU applications:
bash# Basic profiling rocprof ./program # Collect specific metrics rocprof -i metrics.txt ./program # Generate trace rocprof --hip-trace ./program rocprof --hsa-trace ./program # System trace rocprof --sys-trace ./program # Export to JSON rocprof --stats --json ./program # Metrics file example (metrics.txt) # pmc: SQ_WAVES, SQ_INSTS_VALU, SQ_INSTS_SMEM # pmc: TCC_HIT_sum, TCC_MISS_sum
Deep performance analysis:
bash# Profile application omniperf profile -n workload_name ./program # Analyze profile omniperf analyze -p workload_name # Web-based GUI omniperf analyze -p workload_name --gui # Compare profiles omniperf analyze -p baseline -p optimized --compare # Specific analysis sections omniperf analyze -p workload_name --metric-set memory omniperf analyze -p workload_name --metric-set compute
Optimize for AMD architectures:
cpp// Wave-aware programming (64-thread wavefront) __device__ int waveReduceSum(int val) { #pragma unroll for (int offset = 32; offset > 0; offset >>= 1) { val += __shfl_down(val, offset); } return val; } // Use LDS (Local Data Share) efficiently __shared__ __align__(16) float lds[256]; // Memory coalescing for AMD (256-byte granularity) __global__ void coalescedKernel(float4* data, int n) { int idx = blockIdx.x * blockDim.x + threadIdx.x; if (idx < n) { float4 val = data[idx]; // 16-byte aligned load // Process... data[idx] = val; } } // Architecture-specific kernels #if __gfx90a__ || __gfx942__ // MI200/MI300 optimizations // Use matrix cores (MFMA instructions) #elif __gfx908__ // MI100 optimizations #endif
GPU math libraries:
cpp#include <hipblas/hipblas.h> // Or for ROCm-native #include <rocblas/rocblas.h> hipblasHandle_t handle; hipblasCreate(&handle); // GEMM operation float alpha = 1.0f, beta = 0.0f; hipblasSgemm(handle, HIPBLAS_OP_N, HIPBLAS_OP_N, M, N, K, &alpha, d_A, M, d_B, K, &beta, d_C, M); // rocBLAS with explicit stream rocblas_handle roc_handle; rocblas_create_handle(&roc_handle); rocblas_set_stream(roc_handle, stream); rocblas_sgemm(roc_handle, rocblas_operation_none, rocblas_operation_none, M, N, K, &alpha, d_A, M, d_B, K, &beta, d_C, M);
AMD's NCCL equivalent:
cpp#include <rccl/rccl.h> // Initialize RCCL (same API as NCCL) rcclComm_t comm; rcclUniqueId id; rcclGetUniqueId(&id); rcclCommInitRank(&comm, worldSize, id, rank); // All-reduce rcclAllReduce(sendbuff, recvbuff, count, rcclFloat, rcclSum, comm, stream); // Cleanup rcclCommDestroy(comm);
This skill integrates with the following processes:
hip-porting-cross-platform.js - Cross-platform portingmulti-gpu-programming.js - Multi-GPU developmentjson{ "operation": "hipify", "status": "success", "input_files": ["kernel.cu", "main.cu"], "output_files": ["kernel.cpp", "main.cpp"], "conversion_stats": { "cuda_calls_converted": 45, "manual_review_needed": 3, "warnings": ["__shfl_sync not directly portable to HIP"] }, "target_architectures": ["gfx90a", "gfx942"], "recommendations": [ "Review wavefront size (64 vs 32) in reduction kernels", "Consider using rocBLAS for BLAS operations" ] }
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 45,132 | 28,699 | -36% | 1 | 1 | 0% | 8,124 | 6,475 | -20% | 0 | 0 | — |
case-02 | fail→pass | 29,425 | 19,286 | -34% | 1 | 1 | 0% | 6,228 | 6,588 | +6% | 0 | 0 | — |
case-03 | fail→pass | 28,392 | 20,263 | -29% | 1 | 1 | 0% | 5,933 | 7,298 | +23% | 0 | 0 | — |
case-04 | pass→pass | 17,870 | 19,725 | +10% | 1 | 1 | 0% | 3,942 | 6,820 | +73% | 0 | 0 | — |
case-05 | pass→pass | 10,608 | 13,920 | +31% | 1 | 1 | 0% | 2,111 | 4,746 | +125% | 0 | 0 | — |
case-06 | pass→pass | 18,065 | 19,505 | +8% | 1 | 1 | 0% | 4,075 | 6,614 | +62% | 0 | 0 | — |
case-07 | pass→pass | 24,738 | 26,205 | +6% | 1 | 1 | 0% | 4,382 | 7,063 | +61% | 0 | 0 | — |
case-08 | pass→pass | 15,693 | 3,956 | -75% | 1 | 1 | 0% | 1,395 | 3,261 | +134% | 0 | 0 | — |
case-09 | fail→pass | 6,346 | 3,335 | -47% | 1 | 1 | 0% | 1,120 | 3,044 | +172% | 0 | 0 | — |
case-10 | fail→pass | 12,734 | 3,245 | -75% | 1 | 1 | 0% | 2,531 | 3,056 | +21% | 0 | 0 | — |
case-11 | pass→pass | 8,358 | 5,590 | -33% | 1 | 1 | 0% | 1,724 | 3,595 | +109% | 0 | 0 | — |
case-12 | pass→pass | 10,960 | 4,962 | -55% | 1 | 1 | 0% | 1,929 | 3,371 | +75% | 0 | 0 | — |
case-13 | pass→pass | 5,979 | 4,173 | -30% | 1 | 1 | 0% | 1,231 | 3,324 | +170% | 0 | 0 | — |
case-14 | pass→pass | 9,284 | 3,800 | -59% | 1 | 1 | 0% | 846 | 3,154 | +273% | 0 | 0 | — |
case-15 | pass→pass | 5,513 | 3,614 | -34% | 1 | 1 | 0% | 1,041 | 3,276 | +215% | 0 | 0 | — |
case-16 | pass→pass | 4,896 | 4,027 | -18% | 1 | 1 | 0% | 946 | 3,150 | +233% | 0 | 0 | — |
case-17 | pass→pass | 8,175 | 3,314 | -59% | 1 | 1 | 0% | 1,295 | 2,982 | +130% | 0 | 0 | — |
case-18 | fail→pass | 15,780 | 4,653 | -71% | 1 | 1 | 0% | 2,819 | 3,096 | +10% | 0 | 0 | — |
case-19 | fail→pass | 10,753 | 4,512 | -58% | 1 | 1 | 0% | 1,588 | 2,992 | +88% | 0 | 0 | — |
case-20 | fail→pass | 6,786 | 2,628 | -61% | 1 | 1 | 0% | 971 | 2,936 | +202% | 0 | 0 | — |
case-21 | fail→pass | 6,934 | 5,011 | -28% | 1 | 1 | 0% | 1,377 | 3,245 | +136% | 0 | 0 | — |
case-22 | pass→pass | 17,215 | 12,665 | -26% | 1 | 1 | 0% | 2,777 | 4,503 | +62% | 0 | 0 | — |
case-23 | fail→fail | 8,801 | 8,120 | -8% | 1 | 1 | 0% | 1,810 | 4,160 | +130% | 0 | 0 | — |
case-24 | pass→pass | 12,734 | 13,804 | +8% | 1 | 1 | 0% | 2,898 | 5,679 | +96% | 0 | 0 | — |
case-25 | fail→pass | 12,189 | 9,676 | -21% | 1 | 1 | 0% | 2,402 | 4,432 | +85% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 25 cases were attempted. The headline lift of +40 percentage points is the difference between those two pass rates over the 25 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.