Volver a los cursos
AI024 Profesional

Introducción a la programación con ROCm y HIP: Una tutorial práctico

Una guía práctica y moderna sobre programación para GPU de AMD con ROCm y HIP. Cubre toda la pila de software, instalación, flujos de compilación, programación de kernels, gestión de memoria, ingeniería de rendimiento, uso de bibliotecas, migración desde CUDA y prácticas de depuración en producción.

5.0
30.0h
361 estudiantes
10 lessons
0 me gusta
Inteligencia Artificial
Comenzar a aprender

Descripción del curso

📚 Resumen del Contenido

Una guía práctica y moderna sobre programación de GPU AMD con ROCm e HIP. Cubre toda la pila de software, instalación, flujos de compilación, programación de kernels, gestión de memoria, ingeniería de rendimiento, uso de bibliotecas, migración desde CUDA y prácticas de depuración en producción.

Domina la programación de GPU AMD y la portabilidad de CUDA a HIP con esta profundización técnica.

Autor: EvoClass

Agradecimientos: Documentación oficial de AMD sobre ROCm e HIP, incluyendo proyectos como ROCm, HIP y ROCm LLVM.

🎯 Objetivos de Aprendizaje

  1. Definir HIP y su papel dentro del ecosistema ROCm en una sola oración concisa.
  2. Distinguir entre ROCm (plataforma), HIP (interfaz) y bibliotecas ROCm (bloques de construcción).
  3. Identificar las capas jerárquicas de la arquitectura ROCm desde el hardware hasta los marcos de aplicación.
  4. Definir la relación entre el SDK de HIP y la plataforma ROCm en diferentes sistemas operativos.
  5. Ejecutar un flujo de instalación sistemático, incluyendo verificación de matriz de compatibilidad y configuración de rutas tras la instalación.
  6. Compilar y ejecutar un programa mínimo de verificación para solucionar problemas comunes de controladores y acceso al entorno.
  7. Comprender por qué una estrategia de compilación sólida es esencial para reconciliar la portabilidad del código fuente con el rendimiento específico de la arquitectura.
  8. Implementar lanzamientos de kernels portables usando la macro hipLaunchKernelGGL como alternativa a la sintaxis de triple corchete de CUDA.
  9. Configurar proyectos CMake de nivel productivo que apunten a arquitecturas ROCm específicas y gestionen dependencias de bibliotecas externas.
  10. Definir la anatomía de un kernel HIP y aplicar la fórmula básica de ejecución para el indexado de hilos.

Lecciones

Lesson

This lesson introduces the ROCm platform and the HIP programming model as a bridge for porting CUDA applications to AMD hardware. Students will learn how to use automated tools like hipify to migrate code while understanding the importance of architecture-aware tuning to achieve optimal performance.

This lesson covers the essential steps for installing and configuring the ROCm software stack, including dependency management, environment variable setup, and user permission requirements. Students will learn how to verify their system environment and ensure successful hardware-software communication through diagnostic tools and proper configuration.

This lesson explores the distinction between source portability and binary performance in the ROCm ecosystem, emphasizing that while HIP code is functionally portable, achieving peak throughput requires architecture-specific compilation. Students will learn to utilize the hipcc toolchain and CMake to manage build configurations that optimize code for specific hardware instruction sets.

This lesson introduces the HIP programming model, focusing on the transition from sequential CPU iteration to spatial GPU parallelism using the Parallel Pivot approach. Students will learn to map independent data tasks to thread grids, manage memory, and implement kernel execution with proper boundary checks and error handling.

AI024: Memory Management and Data Patterns (Lesson 5) explores the memory-centric nature of GPU performance, focusing on the Roofline Model and the critical importance of minimizing data movement between host and device. Students will learn to distinguish between memory-bound and compute-bound kernels while mastering strategies to optimize data residence and bandwidth utilization.

This lesson explores the transition from synchronous to asynchronous GPU execution, focusing on how to use HIP streams to decouple CPU and GPU tasks. Students will learn to optimize performance by implementing non-blocking memory transfers and kernel launches to maximize hardware utilization and eliminate execution bottlenecks.

This lesson introduces a systematic, data-driven approach to performance engineering on AMD GPUs, emphasizing the use of tools like rocprofv3 to identify bottlenecks rather than relying on intuition. Students will learn to follow a six-step scientific workflow to optimize memory access, instruction throughput, and hardware utilization while avoiding common performance "superstitions."

This lesson introduces the Library-First Engineering Principle, which emphasizes using optimized ROCm libraries like rocBLAS and rocFFT to reduce technical debt and ensure hardware portability. Students will learn to prioritize these vendor-tuned solutions over custom kernel development to achieve better performance and easier maintenance across evolving GPU architectures.

AI024: Porting CUDA Applications to HIP (Lesson 9) covers the systematic, incremental migration of CUDA code to the HIP platform using tools like HIPIFY-Clang and HIPIFY-Perl. Students will learn to distinguish between mechanical API translations and architectural optimizations, such as adjusting for warp-size differences, to ensure functional and performance parity on AMD ROCm hardware.

This lesson explores the GPU Developer’s Creed, which prioritizes functional correctness and architectural isolation over raw performance when working with ROCm and HIP. Students will learn to implement systematic debugging, testing, and CI/CD practices to ensure stable, reproducible, and accurate GPU kernel deployments.