hipify
by
rocm

Description: HIPIFY: Convert CUDA to Portable C++ Code

View rocm/hipify on GitHub ↗

Summary Information

Updated 1 hour ago
Added to GitGenius on August 31st, 2025
Created on March 2nd, 2020
Open Issues/Pull Requests: 25 (+0)
Number of forks: 104
Total Stargazers: 665 (+0)
Total Subscribers: 22 (+0)
Detailed Description

HIPify is a source-to-source translator developed by AMD, designed to automatically convert CUDA code to HIP (Heterogeneous-compute Interface for Portability). HIP is a C++-based programming language and runtime API that allows developers to write portable code that can run on a variety of hardware, including AMD GPUs, NVIDIA GPUs, and CPUs. The primary goal of HIPify is to reduce the effort required to port existing CUDA applications to the AMD ROCm platform, thereby broadening the potential user base for these applications and fostering a more open and competitive heterogeneous computing ecosystem.

At its core, HIPify operates by parsing CUDA source code and applying a series of transformations to replace CUDA-specific constructs with their HIP equivalents. This includes replacing CUDA runtime API calls (like `cudaMalloc`, `cudaMemcpy`) with corresponding HIP API calls (`hipMalloc`, `hipMemcpy`), modifying CUDA kernel launch syntax to align with HIP’s launch parameters, and handling differences in memory models and data types. It doesn't aim for a perfect, fully automated conversion; complex CUDA features or code heavily reliant on NVIDIA-specific extensions may require manual intervention after HIPify's initial pass. However, it significantly accelerates the porting process, handling the majority of common CUDA code patterns.

The repository contains the HIPify tool itself, written in Python, along with a suite of tests and examples. The tool utilizes clang as a frontend for parsing C++ code (CUDA is essentially a dialect of C++). It leverages clang’s Abstract Syntax Tree (AST) representation to identify CUDA constructs and apply the necessary transformations. The tests are crucial for verifying the correctness of the translations and ensuring that HIPify doesn't introduce regressions. The examples demonstrate how to use HIPify on various CUDA code snippets and projects, showcasing its capabilities and limitations. The repository also includes documentation detailing the installation process, usage instructions, and supported CUDA features.

HIPify’s functionality extends beyond simple API replacements. It addresses key differences between CUDA and HIP, such as the handling of shared memory, thread synchronization, and device properties. It attempts to automatically manage these differences, providing a more seamless transition for developers. Furthermore, HIPify supports different levels of conversion. It can perform a basic conversion, replacing only the most obvious CUDA API calls, or a more aggressive conversion that attempts to optimize the code for HIP and ROCm. The level of conversion can be controlled through command-line options.

The project is actively maintained and continuously improved. AMD regularly adds support for new CUDA features and addresses bugs reported by the community. Contributions from external developers are also welcome, fostering a collaborative environment for enhancing the tool's capabilities. HIPify is a vital component of the ROCm ecosystem, enabling developers to leverage the power of AMD GPUs without being locked into the NVIDIA CUDA platform. It represents a significant step towards achieving true portability in heterogeneous computing, allowing code to be written once and run efficiently on a diverse range of hardware.

hipify
by
rocmrocm/hipify

Repository Details

Fetching additional details & charts...