Skip to content

Commit 1876823

Browse files
authored
Merge pull request #28 from iotamudelta/master
Document constants and mappings.
2 parents ca3b5ed + 4cffc18 commit 1876823

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

tools/amd_build/pyHIPIFY/constants.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
""" Constants for annotations in the mapping.
2+
The constants defined here are used to annotate the mapping tuples in cuda_to_hip_mappings.py.
3+
They are based on
4+
https://github.com/ROCm-Developer-Tools/HIP/blob/master/hipify-clang/src/Statistics.h
5+
and fall in three categories: 1) type of mapping, 2) API of mapping, 3) unsupported
6+
mapping.
7+
"""
8+
19
CONV_VERSION = 0,
210
CONV_INIT = 1
311
CONV_DEVICE = 2

tools/amd_build/pyHIPIFY/cuda_to_hip_mappings.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
from constants import *
22

3+
""" Mapping of CUDA functions, include files, constants, and types to ROCm/HIP equivalents
4+
5+
This closely follows the implementation in hipify-clang
6+
https://github.com/ROCm-Developer-Tools/HIP/blob/master/hipify-clang/src/CUDA2HipMap.cpp
7+
and its structure.
8+
There are different maps for fundamental names, include files, identifies, sparse, and
9+
PyTorch specific translations.
10+
Each of the entries in these maps translates a CUDA string to a tuple containing the
11+
ROCm/HIP string, a type and API annotation and - optionally - an annotation if it is not
12+
supported in ROCm/HIP yet.
13+
"""
14+
315
CUDA_TYPE_NAME_MAP = {
416
"CUresult": ("hipError_t", CONV_TYPE, API_DRIVER),
517
"cudaError_t": ("hipError_t", CONV_TYPE, API_RUNTIME),

0 commit comments

Comments
 (0)