Go to file
Han Ruobing 055de024df Empty-Commit 2022-05-04 09:04:53 -04:00
.github/workflows add CI 2022-01-13 13:30:45 -05:00
compilation add codebase for TACO submission 2022-05-04 08:59:38 -04:00
examples add codebase for TACO submission 2022-05-04 08:59:38 -04:00
runtime add codebase for TACO submission 2022-05-04 08:59:38 -04:00
.gitignore add CI 2022-01-13 13:30:45 -05:00
.pre-commit-config.yaml add CI 2022-01-13 13:30:45 -05:00
CMakeLists.txt add codebase for TACO submission 2022-05-04 08:59:38 -04:00
CONTRIBUTING.md add codebase for TACO submission 2022-05-04 08:59:38 -04:00
LICENSE add backbone, including basic features for compilation 2022-01-11 11:01:42 -05:00
README.md add codebase for TACO submission 2022-05-04 08:59:38 -04:00

README.md

COX: CUDA on X86

Introduction

This project consists of two parts: a series of LLVM passes that achieve a SPMD NVVM IR as input, and output the corresponding MPMD+SIMD version of LLVM IR which can be execute on CPU devices.

Install

Prerequisites

  • Linux: Verified on Ubuntu 18.04
  • LLVM10.0
  • NVIDIA CUDA-toolkit
  • x86 CPU
  • pthread
  • GCC 7.5.0

Installation

  1. Clone from github

    git clone https://github.com/drcut/open_source_template
    cd open_source_template
    
  2. Build the transformer for NVVM IR to LLVM IR for X86

    mkdir build && cd build
    cmake .. -DLLVM_CONFIG_PATH=`which llvm-config` # need path to llvm-config
    make
    

Run Vecadd samples

# Generate bitcode from human-readable LLVM IR
llvm-as ../compilation/examples/vecadd/kernel-cuda-nvptx64-nvidia-cuda-sm_61.ll
# use LLVM passes to transform NVVM IR (SPMD) to LLVM IR (MPMD+SIMD).
# NOTE: we hard-code the grid size (1, 1, 1)
# and block size (1024, 1, 1) into the generated LLVM IR
./compilation/nvvm2x86 \
    ../compilation/examples/vecadd/kernel-cuda-nvptx64-nvidia-cuda-sm_61.bc \
    kernel.bc 1 1 1 32 1 1
# generate object file from LLVM IR
llc --filetype=obj kernel.bc
# link generated kernel function
# with host function and generate excutable file
g++ ../compilation/examples/vecadd/host.cpp \
    kernel.o -lpthread -o vecadd_example
# execute the executable file
./vecadd_example

Author

Ruobing Han is a CS phd student in Georgia Institute Technology, under the supervision of Prof. Hyesoon Kim.