Heterogeneous Compilation

CUDA Compilation 不同在于

The tools used in the CUDA compilation are all closed source except gcc, g++ etc., for example fatbinary and nvlink. We need to substitue these tools to tools in clang system.

  1. Clang Offload Bundler is used to combined different code for different machine structurel.
  2. Clang Offload Packager is used to embed device code into host code.
  3. Clang Linker Wrapper is used to .

这里面最复杂的感觉是怎么处理链接关系,如果仅仅说代码嵌入,从 CUDA 的流程来看,在 cudafe1.cpp include stub.c 生成 .o 这一步中 host code 中就已经包含了 device code,如果仅仅说 embed 的话,这显然就已经完成了,但是为何 CUDA 还进行后续那么多步骤,因为这一步生成的 .o 显然是无法运行的,device code 都还只是一个 extern signal,还需要同 CUDA runtime library 进行链接,这个过程该怎么进行比较难想。

SIMD Extension

说明

SIMD Extension 的各种函数中参数的顺序以及各种函数的实现机制都是遵循着机器在实际存储时采用的小端序,注意在和数组混用时可能会产生一定思维上的混乱。

0%