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

 

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值