HIP编程笔记(一)

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代码有多少。

原文链接:https://rocmdocs.amd.com/en/latest/Programming_Guides/HIP-porting-guide.html#porting-a-new-cuda-project

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

 

 


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部