HIP: Heterogenous-computing Interface for Portability
Contributor Guidelines

Make Tips

ROCM_PATH is path where ROCM is installed. BY default ROCM_PATH is /opt/rocm. When building HIP, you will likely want to build and install to a local user-accessible directory (rather than <ROCM_PATH>). This can be easily be done by setting the -DCMAKE_INSTALL_PREFIX variable when running cmake. Typical use case is to set CMAKE_INSTALL_PREFIX to your HIP git root, and then ensure HIP_PATH points to this directory. For example

1 cmake .. -DCMAKE_INSTALL_PREFIX=..
2 make install
3 
4 export HIP_PATH=

After making HIP, don't forget the "make install" step !

Adding a new HIP API

- Add a translation to the hipify-clang tool ; many examples abound.
   - For stat tracking purposes, place the API into an appropriate stat category ("dev", "mem", "stream", etc).
- Add a inlined NVIDIA implementation for the function in include/hip/nvidia_detail/hip_runtime_api.h.
   - These are typically headers
- Add an HIP_ROCclr definition and Doxygen comments for the function in include/amd_detail/hip_runtime_api.h
   - Source implementation typically go in hip/rocclr/hip_*.cpp. The implementation involve calls to HIP runtime (ie for hipStream_t).

Check HIP-Clang version

In some cases new HIP-Clang features are tied to specified releases, and it can be useful to check the current version is sufficiently new enough to support the desired feature.

HIP runtime version

1 > cat <ROCM_PATH>/hip/bin/.hipVersion
2 # Auto-generated by cmake
3 HIP_VERSION_MAJOR=3
4 HIP_VERSION_MINOR=9
5 HIP_VERSION_PATCH=20345-519ef3f2

HIP-Clang compiler version

1 $ <ROCM_PATH>/llvm/bin/clang -v
2 clang version 11.0.0 (/src/external/llvm-project/clang 075fedd3fd2f4d9d8cca79d0cd51f64c5ef21432)
3 Target: x86_64-unknown-linux-gnu
4 Thread model: posix
5 InstalledDir: <ROCM_PATH>/llvm/bin
6 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
7 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
8 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
9 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
10 Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
11 Candidate multilib: .;@m64
12 Candidate multilib: 32;@m32
13 Candidate multilib: x32;@mx32
14 Selected multilib: .;@m64

Unit Testing Environment

HIP includes unit tests in the tests/src directory. When adding a new HIP feature, add a new unit test as well. See tests/README.md for more information.

Development Flow

Directed tests provide a great place to develop new features alongside the associated test.

For applications and benchmarks outside the directed test environment, developments should use a two-step development flow:

Environment Variables

Contribution guidelines

Features (ie functions, classes, types) defined in hip*.h should resemble CUDA APIs. The HIP interface is designed to be very familiar for CUDA programmers.

Differences or limitations of HIP APIs as compared to CUDA APIs should be clearly documented and described.

Coding Guidelines (in brief)

Presubmit Testing:

Before checking in or submitting a pull request, run all directed tests (see tests/README.md) and all Rodinia tests. Ensure pass results match starting point:

1 > cd examples/
2 > ./run_all.sh

Checkin messages

Follow existing best practice for writing a good Git commit message. Some tips: http://chris.beams.io/posts/git-commit/ https://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message

In particular :

Doxygen Editing Guidelines

Other Tips:

Markdown Editing

Recommended to use an offline Markdown viewer to review documentation, such as Markdown Preview Plus extension in Chrome browser, or Remarkable.