HIP支持的API:
-
Devices (hipSetDevice(), hipGetDeviceProperties())
-
Memory management (hipMalloc(), hipMemcpy(), hipFree())
-
Streams (hipStreamCreate(),hipStreamSynchronize(), hipStreamWaitEvent())
-
Events (hipEventRecord(), hipEventElapsedTime())
-
Kernel launching (hipLaunchKernel is a standard C/C++ function that replaces <<< >>>)
-
HIP Module API to control when adn how code is loaded.
-
CUDA-style kernel coordinate functions (threadIdx, blockIdx, blockDim, gridDim)
-
Cross-lane instructions including shfl, ballot, any, all - Most device-side math built-ins.
-
Error reporting (hipGetLastError(), hipGetErrorString())
What is HCC?
HCC is AMD’s compiler driver which compiles the heterogeneous C++ code into HSAIL or GCN device code for AMD GPUs. It is an open-source compiler based on recent versions of CLANG/LLVM.
In ROCM v3.5 release, HCC compiler is deprecated and HIP-Clang compiler is introduced to compile HIP programs.
What is HIP-Clang?
HIP-Clang is new compiler to emphasize its capability to compile HIP programs which can run on AMD platform.
核函数启动:
hipLaunchKernel(vAdd, dim3(1024), dim3(1), 0, 0, Ad)
移植分析工具:
hipexamine-perl.sh用来分析项目中的cuda代码有多少。
The hipexamine-perl.sh tool will scan a source directory to determine which files contain CUDA code and how much of that code can be automatically hipified
Use bin/hipconvertinplace-perl.sh to hipify all code files in the CUDA source directory.
The hipexamine-perl.sh tool will scan a source directory to determine which files contain CUDA code and how much of that code can be automatically hipified.
备注:有用的脚本可以看到都是在$HIP_DIR/bin/hipexamine-perl.sh
hipconvertinplace-perl.sh MY_SRC_DIR 将路径下的代码全部转为HIP