Supporting CUDA for an extended RISC-V GPU architecture
Transcript of Supporting CUDA for an extended RISC-V GPU architecture
![Page 1: Supporting CUDA for an extended RISC-V GPU architecture](https://reader034.fdocuments.net/reader034/viewer/2022051922/62855ba29e31fe4bbe3b168f/html5/thumbnails/1.jpg)
Reporter: Ruobing Han
Date: 05/30/2021
Supporting CUDA for an extended RISC-V GPU architecture
co-author: Blaise Tine, Jaewon Lee, Jaewoong Sim, Hyesoon Kim
![Page 2: Supporting CUDA for an extended RISC-V GPU architecture](https://reader034.fdocuments.net/reader034/viewer/2022051922/62855ba29e31fe4bbe3b168f/html5/thumbnails/2.jpg)
Motivation
High-level programmers
Low-level programmers
![Page 3: Supporting CUDA for an extended RISC-V GPU architecture](https://reader034.fdocuments.net/reader034/viewer/2022051922/62855ba29e31fe4bbe3b168f/html5/thumbnails/3.jpg)
Pipeline for running CUDA on the RISC-V GPU
Features:
• Lightweight
• Scalable
• Open-Source
Optional:
Reference: "Bringing OpenCL to Commodity RISC-V CPUs" CARRV 2021
![Page 4: Supporting CUDA for an extended RISC-V GPU architecture](https://reader034.fdocuments.net/reader034/viewer/2022051922/62855ba29e31fe4bbe3b168f/html5/thumbnails/4.jpg)
Background: code migration
source: https://www.khronos.org/spir/
• HIPIFY: Only for CUDA->HIP
• SYCL: Re-implement CUDA programs by SYCL libraries
Background: SPIR
![Page 5: Supporting CUDA for an extended RISC-V GPU architecture](https://reader034.fdocuments.net/reader034/viewer/2022051922/62855ba29e31fe4bbe3b168f/html5/thumbnails/5.jpg)
OVERVIEW OF THE PIPELINE: CUDA->NVVM IR
![Page 6: Supporting CUDA for an extended RISC-V GPU architecture](https://reader034.fdocuments.net/reader034/viewer/2022051922/62855ba29e31fe4bbe3b168f/html5/thumbnails/6.jpg)
OVERVIEW OF THE PIPELINE: NVVM IR->SPIR-V IR
Github link:
![Page 7: Supporting CUDA for an extended RISC-V GPU architecture](https://reader034.fdocuments.net/reader034/viewer/2022051922/62855ba29e31fe4bbe3b168f/html5/thumbnails/7.jpg)
Example for NVVM-SPIR-V translation
For device independent instructions (load, store, binaryOp...): use OpenCL-SPIR-V translator
For NVVM special built-in function (llvm.nvvm.read.ptx.sreg.tid.x()...): use NVVM-SPIR-V translator
![Page 8: Supporting CUDA for an extended RISC-V GPU architecture](https://reader034.fdocuments.net/reader034/viewer/2022051922/62855ba29e31fe4bbe3b168f/html5/thumbnails/8.jpg)
OVERVIEW OF THE PIPELINE: SPIR-V->OpenCL IR
SPIRV-LLVM-Translator: https://github.com/KhronosGroup/SPIRV-LLVM-Translator
SPIR-V OpenCL IR
![Page 9: Supporting CUDA for an extended RISC-V GPU architecture](https://reader034.fdocuments.net/reader034/viewer/2022051922/62855ba29e31fe4bbe3b168f/html5/thumbnails/9.jpg)
OVERVIEW OF THE PIPELINE: OpenCL->Object file
POCL for Vortex: https://github.com/vortexgpgpu/pocl
Vortex: https://github.com/vortexgpgpu/vortex
![Page 10: Supporting CUDA for an extended RISC-V GPU architecture](https://reader034.fdocuments.net/reader034/viewer/2022051922/62855ba29e31fe4bbe3b168f/html5/thumbnails/10.jpg)
Experiments
Rodinia: https://github.com/yuhc/gpu-rodinia
Analysis:
• Support built-in function is the key to
support general programs
• Well support for primitive instructions
• For new features, need to modify both
translators and RISC-V library for
Vortex
Version:Vortex-pocl: commit log 6272e2
Vortex: v0.2.2NVPTX-SPIR-V translator: v0.1.0
![Page 11: Supporting CUDA for an extended RISC-V GPU architecture](https://reader034.fdocuments.net/reader034/viewer/2022051922/62855ba29e31fe4bbe3b168f/html5/thumbnails/11.jpg)
Support feature (NVPTX-SPIR-V translator: version v0.1.0, Vortex: version v0.2.0)
• Memory hierarchy
• Synchronization
• Some mathematics operations (square root, log, absolute value)
![Page 12: Supporting CUDA for an extended RISC-V GPU architecture](https://reader034.fdocuments.net/reader034/viewer/2022051922/62855ba29e31fe4bbe3b168f/html5/thumbnails/12.jpg)
• We propose and implement a lightweight, scalable pipeline for running CUDA source code on an open-source RISC-V GPU
• We build a translator to convert from NVVM IR to SPIR-V IR
• We can execute most of sample in a widely used benchmark
Conclusion
contact information:[email protected]