Skip to content
srawat edited this page Feb 24, 2023 · 1 revision

Introduction to Compiler Reference Guide

ROCmCC is a Clang/LLVM-based compiler. It is optimized for high-performance computing on AMD GPUs and CPUs and supports various heterogenous programming models such as HIP, OpenMP, and OpenCL. ROCmCC is made available via the following two packages:

ROCm Compiler Interfaces

ROCm currently provides two compiler interfaces for compiling HIP programs:

  • /opt/rocm/bin/hipcc

  • /opt/rocm/bin/amdclang++ Both leverage the same LLVM compiler technology with the AMD GCN GPU support; however, they offer a slightly different user experience. The hipcc command-line interface aims to provide a more familiar user interface to users who are experienced in CUDA but relatively new to the ROCm/HIP development environment. On the other hand, amdclang++ provides a user interface identical to the clang++ compiler. It is more suitable for experienced developers who want to directly interact with the clang compiler and gain full control of their application’s build process.

    hipcc amdclang++
    Compiling HIP source files Treats all source files as HIP language source files Enables the HIP language support for files with the “.hip” extension or through the -x hip compiler option
    Automatic GPU architecture detection Auto-detects the GPUs available on the system and generates code for those devices when no GPU architecture is specified Defaults to the AMD GCN gfx803 architecture. The --offload-arch compiler option may be used to target other GPU architectures
    Finding a HIP installation Searches for HIP based on its own location and its knowledge about the ROCm directory structure First searches for HIP under the same parent directory as its own LLVM directory and then falls back on /opt/rocm. Users can use the --rocm-path option to instruct the compiler to use HIP from the specified ROCm installation.
    Linking to the HIP runtime library Links to the HIP runtime automatically from the detected HIP installation Requires the --hip-link flag to be specified to link to the HIP runtime. Alternatively, users can use the -l<dir> -lamdhip64 option to link to a HIP runtime library.
    Linking to a static library containing GPU code Supports linking to a static library Supports linking to a static library
    Device function inlining Inlines all GPU device functions, which provide greater performance and compatibility for codes that contain file scoped or device function scoped shared variables. However, it may increase compile time. Relies on inlining heuristics to control inlining. Users experiencing performance or compilation issues with code using file scoped or device function scoped shared variables could try -mllvm -amdgpu-early-inline-all=true -mllvm -amdgpu-function-calls=false to work around the issue. There are plans to address these issues with future compiler improvements.
    Source code location Developed at https://github.com/ROCm-Developer-Tools/HIPCC Developed at https://github.com/RadeonOpenCompute/llvm-project

Table 1: Comparison Between hipcc and amdclang++

Clone this wiki locally