<div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div><div><div>Hi guys,<br><br>I am understanding OpenCL compilation flow on GPU in order to develop OpenCL runtime for a new hardware.<br></div><br></div>I understood that OpenCL compiler is part of a vendor's runtime library which is the heart of OpenCL. Since OpenCL kernel is compiled at runtime, hence at high level its compilation takes place in two steps: <br>
</div><div>i. source code is first converted to intermediate code.<br></div><div>ii. intermediate code is then translated to targeted binary code.<br></div><div><br></div><div>let say for example, we have a OpenCL kernel source code vectorAdd_kernel.cl :<br>
</div>1. OpenCL compilation flow on Nvidia GPUs<br></div> a. vectorAdd_kernel.cl is first translated to LLVM IR using clang and <br></div><div> b. LLVM IR is converted into optimized LLVM IR using LLVM optimizer.<br>
</div>
<div> b. optimized LLVM IR is then translated to vectorAdd_kernel.ptx using Back-end<br></div> c. vectorAdd_kernel.ptx is then translated to vectorAdd_kernel.bin file using JIT. Nvidia uses JIT to get benefit in-case when next-generation GPUs are encounterd.<br>
<br></div>2. OpenCL compilation on AMD GPUs<br></div> a. vectorAdd_kernel.cl is first translated to LLVM IR using gcc/clang<br></div> b. LLVM IR is then converted into optimzed LLVM IR using LLVM optimizer.<br></div> c. optimized LLVM IR is then converted into AMD IL.<br>
</div> d. AMD IL is then converted into AMD ISA using shader compiler (GPU JIT). <br><br></div>I understand that AMD uses back-end compilation as part of JIT, instead Nvidia which uses back-end separate from JIT. <br><br>
</div>Is that correct? If it is so then what are the advantages of using JIT separate from back-end?<br><br>Thanks for your comments/opinions, <br></div>
-Gopal<br></div>