AMD HIP 编程指南
一份关于异构计算接口可移植性(HIP)的综合性技术手册。它提供了 C++ 运行时 API 和内核语言,使开发者能够从单一源代码创建可在 AMD 和 NVIDIA GPU 上运行的可移植应用程序。本指南涵盖安装、环境配置、编程模型、内存分配以及将 CUDA 代码迁移至 HIP 的工具。
课程概述
📚 内容概要
一份关于异构计算可移植性接口(HIP)的综合性技术手册。它提供了一套 C++ 运行时 API 和内核语言,使开发者能够仅通过单一源代码,创建适用于 AMD 与 NVIDIA GPU 的可移植应用程序。本指南涵盖安装、环境配置、编程模型、内存分配以及将 CUDA 代码迁移至 HIP 的工具。
掌握可移植的 GPU 编程:一套源码,适配 AMD 与 NVIDIA 平台。
作者: 超威半导体公司(AMD)
致谢: AMD、AMD Arrow 标志、AMD Instinct、Radeon、ROCm 及其组合均为超威半导体公司(AMD)的商标。Linux 是林纳斯·托瓦兹的注册商标。PCIe 是 PCI-SIG 公司的注册商标。
🎯 学习目标
- 定义 HIP 框架的主要特性及其价值主张。
- 展示如何使用系统工具访问和查询 HIP 环境。
- 解释 HIP 可移植性与其编译器技术之间的架构关系。
- 执行针对 NVIDIA 与 AMD 环境的平台特定安装。
- 协调多仓库构建流程,从源码编译 HIP。
- 使用系统配置和验证工具确认安装成功。
- 配置和管理 GPU 内存,包括 HIP 内存分配、一致性控制以及零拷贝主机内存可见性。
- 使用 HIP 特有的函数/变量限定符、向量类型和同步原语开发高性能内核。
- 利用线程束洗牌、投票、投票位图和协作组功能实现高级并行算法。
- 使用 HIPIFY 工具自动化将 CUDA 代码转换为 HIP,并管理就地项目转换。
课程 共 4 课时 · 预计 12.0h
课程
Lesson
This lesson introduces the multi-vendor dilemma in high-performance computing, where hardware heterogeneity and proprietary APIs create software fragmentation and maintenance debt. Students will learn how the HIP framework addresses these challenges by enabling performance portability and simplifying the transition between different GPU architectures.
This lesson covers the installation and configuration of the Heterogeneous-compute Interface for Portability (HIP) environment, focusing on the single-source paradigm for cross-platform GPU development. Students will learn how to manage environment variables like CUDA_PATH and HIP_PATH to enable the hipcc compiler to route code effectively across NVIDIA and AMD hardware architectures.
AI022: HIP Programming Model and API Deep Dive (Lesson 3) explores the architectural foundations of the HIP ecosystem, focusing on the ROCm stack, hardware discovery, and the porting workflow from CUDA to AMD architectures. Students will learn to utilize the hipify-perl and hipcc toolchains, manage low-level HSA runtime initialization, and implement effective memory mapping for GPU resource orchestration.
This lesson explores the Heterogeneous-compute Interface for Portability (HIP), a C++ runtime API designed to enable cross-platform GPU development by abstracting hardware layers for both NVIDIA and AMD systems. Students will learn how to configure the HIP environment, utilize the hipcc compiler, and apply functional mappings to migrate legacy CUDA applications to a unified, portable codebase.