moat-cuda-to-rocm
Port a CUDA project to ROCm/HIP for AMD GPUs and keep the port working. Covers strategy selection (CMake HIP language or PyTorch extension), the faults where…
от amd★ 523 звезды на GitHub
Установить moat-cuda-to-rocm в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
CUDA to ROCm/HIP
Accumulated across about a hundred real ports. This file routes; the knowledge is in
references/, one topic per file, loaded only when you need it.
Most porting bugs are not in symbol names. Hipify handles the renaming. The bugs are
semantic differences where AMD is strict and CUDA is lenient. Most surface at runtime on a
build that compiled cleanly, but a clean hipify is not a clean build either: hipify leaves
literals and types alone, so some idioms (a 32-bit *_sync mask is the common one) hipify
without complaint and then fail to compile under HIP.
Naming: ROCm or HIP?
- HIP is the programming model: the kernel dialect plus the
hipXxxruntime API, the analogue of CUDA C++ and the CUDA runtime. - ROCm is the platform: compiler, runtime, driver and the roc*/hip* libraries, the analogue of the CUDA Toolkit.
The CODE port is "to HIP"; the TARGET, build flag and libraries are "ROCm". Never call the
platform "HIP" or the kernel dialect "ROCm". Details: references/naming.md.
ROCm version numbers in this skill
Entries say where they were seen. The numbers compare the ordinary way: 7.2 < 7.13 < 7.14 < 10.0 < 10.1 < 10.2 < 10.3. Three things can mislead:
- Dates do not order them. The 7.2.x patch releases (7.2.1 to 7.2.4, March to May 2026) came out alongside 7.11, 7.12 and 7.13, so 7.13 (May 2026) is newer code than 7.2.4 (also May 2026).
- The major number jumps from 7 to 10. 7.14 was released in July 2026 (with a 7.14.1 patch in August), and the next releases are 10.0 (August 2026), 10.1 (October 2026) and 10.2 (November 2026). Nothing was released in between.
- A date suffix marks a nightly build, not a different series.
7.14.0a20260612is a pre-release build of 7.14 and10.3.0a20261118one of 10.3; every version has such builds before its release. An entry seen on a nightly says so, and may or may not hold on the release of the same number.
HIP has its own version number, which stayed on the 7.x line when ROCm's went to 10: ROCm
7.14 carries HIP 7.14, ROCm 10.1 carries HIP 7.16, and the 10.2 and 10.3 builds carry 7.17
and 7.18. So gate code on a feature test or on HIP_VERSION_*, never on the ROCm number. A
workaround tagged with a version or a date may have expired: re-check it on a newer ROCm
before carrying it.
Which strategy
Classify the build first; implementing the wrong strategy correctly is still wrong.
| build | strategy | shape |
|---|---|---|
| pure CMake | A (preferred) | one cuda_to_hip.h compat header, enable_language(HIP), set_source_files_properties(... LANGUAGE HIP); sources keep CUDA spelling |
| pytorch extension | B | rely on torch's build-time hipify; fix only what it cannot |
| anything else | neither | driver-API, runtime PTX, Go/cgo, qmake and codegen builds: references/platform-limits.md, "Runtime-compiled kernels" |
How to tell: find_package(Torch), torch.utils.cpp_extension, CUDAExtension, or a
torch dependency in setup.py/pyproject.toml means a pytorch extension, Strategy B.
Otherwise treat it as Strategy A, whatever the build system: a meson or Makefile project
ports Strategy-A-shaped, writing by hand what enable_language(HIP) would have given.
Strategy A is the minimal-footprint model: the compat header is a no-op on NVIDIA, so the
CUDA build is untouched. Where the project includes CUDA headers by name, prefer the
shim-header method (shadow headers on the HIP include path only), which leaves the sources
byte-identical to upstream. Recipes: references/strategy-a-cmake.md,
references/strategy-b-torch.md.
Before porting
Check whether an AMD port already exists and whether it is authoritative: an AMD-official
work in progress shifts the value to validating and improving it, while a one-off community
fork is a hint, never code to inherit. references/assess-existing-support.md.
Some CUDA has no HIP analogue to translate INTO (CUTLASS, CuTe, TensorRT, raw PTX), so
hipify succeeds at doing nothing and the port looks small. A reimplementation against an
AMD-native target is not the same verdict as "no target exists"; say which.
references/no-hip-equivalent.md.
Where to look
| you have | open |
|---|---|
wrong results, a hang or a fault on one wavefront width; code with warpSize, a literal 32, __shfl*, __ballot, lane masks |
references/faults-wavefront.md |
| a crash, a hang, stale or garbage data, an intermittent failure; streams, events, async copies, graph capture, managed memory, several GPUs | references/faults-memory-streams.md |
textures (also tex* compile errors on gfx94x), OpenGL or Vulkan interop |
references/faults-textures-interop.md |
numbers that differ from CUDA or the CPU: FMA contraction, rounding, min/max, half-precision GEMM, big-integer arithmetic |
references/faults-numerics.md |
a compile error, or code silently skipped: macros HIP does not define, includes, __CUDA_ARCH__, helper_math.h, C+ |
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- .federated.json
- assets/HipCxx23Shim.cmake
- assets/hip_link_win.py
- evals/evals.json
- references/assess-existing-support.md
- references/build-cmake-link.md
- references/build-headers-macros.md
- references/diagnosis.md
- references/faults-memory-streams.md
- references/faults-numerics.md
- references/faults-textures-interop.md
- references/faults-wavefront.md
- references/libraries.md
- references/linux-host-setup.md
- references/naming.md
- references/no-hip-equivalent.md
- references/platform-limits.md
- references/strategy-a-cmake.md
- references/strategy-b-torch.md
- references/upstream-sync.md
- references/validation.md
- references/windows.md
- skill-card.md
FAQ
Что делает скилл moat-cuda-to-rocm?
Port a CUDA project to ROCm/HIP for AMD GPUs and keep the port working. Covers strategy selection (CMake HIP language or PyTorch extension), the faults where AMD is strict and CUDA is lenient, wave32/wave64 wavefront portability, CUDA library substitutions and their gaps (cuBLAS, cuSOLVER, cuDNN, cuSPARSE, Thrust, NCCL, RAPIDS, nvJPEG, NVDEC), ROCm build and link problems on Linux and Windows (clang-cl, lld-link, DLL loading, the pip-installed ROCm SDK), and the validation bar. Use when planning, implementing, reviewing or validating a CUDA-to-HIP port, when a HIP build fails to compile or link, when it compiles but misbehaves at runtime, when a CUDA library has no obvious ROCm equivalent, or when syncing a ROCm port with upstream changes.
Как установить скилл moat-cuda-to-rocm?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл moat-cuda-to-rocm запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…