Skip to content
Snippets Groups Projects
Commit fee00e55 authored by Yifan Zhao's avatar Yifan Zhao
Browse files

NVPTX -> OpenCL

parent a750f6e8
No related branches found
No related tags found
No related merge requests found
Showing
with 14 additions and 14 deletions
...@@ -5,7 +5,7 @@ Compilation of an HPVM program involves the following steps: ...@@ -5,7 +5,7 @@ Compilation of an HPVM program involves the following steps:
2. `opt` takes (`main.ll`) and invoke the GenHPVM pass on it, which converts the HPVM-C function calls to HPVM intrinsics. This generates the HPVM textual representation (`main.hpvm.ll`). 2. `opt` takes (`main.ll`) and invoke the GenHPVM pass on it, which converts the HPVM-C function calls to HPVM intrinsics. This generates the HPVM textual representation (`main.hpvm.ll`).
3. `opt` takes the HPVM textual representation (`main.hpvm.ll`) and invokes the following passes in sequence: 3. `opt` takes the HPVM textual representation (`main.hpvm.ll`) and invokes the following passes in sequence:
* BuildDFG: Converts the textual representation to the internal HPVM representation. * BuildDFG: Converts the textual representation to the internal HPVM representation.
* LocalMem and DFG2LLVM_NVPTX: Invoked only when GPU target is selected. Generates the kernel module (`main.kernels.ll`) and the portion of the host code that invokes the kernel into the host module (`main.host.ll`). * LocalMem and DFG2LLVM_OpenCL: Invoked only when GPU target is selected. Generates the kernel module (`main.kernels.ll`) and the portion of the host code that invokes the kernel into the host module (`main.host.ll`).
* DFG2LLVM_CPU: Generates either all, or the remainder of the host module (`main.host.ll`) depending on the chosen target. * DFG2LLVM_CPU: Generates either all, or the remainder of the host module (`main.host.ll`) depending on the chosen target.
* ClearDFG: Deletes the internal HPVM representation from memory. * ClearDFG: Deletes the internal HPVM representation from memory.
4. `clang` is used to to compile any remaining project files that would be later linked with the host module. 4. `clang` is used to to compile any remaining project files that would be later linked with the host module.
......
add_subdirectory(BuildDFG) add_subdirectory(BuildDFG)
add_subdirectory(ClearDFG) add_subdirectory(ClearDFG)
add_subdirectory(DFG2LLVM_NVPTX) add_subdirectory(DFG2LLVM_OpenCL)
add_subdirectory(DFG2LLVM_CPU) add_subdirectory(DFG2LLVM_CPU)
add_subdirectory(GenHPVM) add_subdirectory(GenHPVM)
add_subdirectory(LocalMem) add_subdirectory(LocalMem)
...@@ -1426,7 +1426,7 @@ void CGT_CPU::codeGen(DFLeafNode *N) { ...@@ -1426,7 +1426,7 @@ void CGT_CPU::codeGen(DFLeafNode *N) {
switch (N->getTag()) { switch (N->getTag()) {
case hpvm::GPU_TARGET: case hpvm::GPU_TARGET:
// A leaf node should not have an cpu function for GPU // A leaf node should not have an cpu function for GPU
// by design of DFG2LLVM_NVPTX backend // by design of DFG2LLVM_OpenCL backend
assert(!(N->hasCPUGenFuncForTarget(hpvm::GPU_TARGET)) && assert(!(N->hasCPUGenFuncForTarget(hpvm::GPU_TARGET)) &&
"Leaf node not expected to have GPU GenFunc"); "Leaf node not expected to have GPU GenFunc");
break; break;
......
...@@ -4,9 +4,9 @@ endif() ...@@ -4,9 +4,9 @@ endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DLLVM_BUILD_DIR=${PROJECT_BINARY_DIR}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DLLVM_BUILD_DIR=${PROJECT_BINARY_DIR}")
add_llvm_library( LLVMDFG2LLVM_NVPTX add_llvm_library( LLVMDFG2LLVM_OpenCL
MODULE MODULE
DFG2LLVM_NVPTX.cpp DFG2LLVM_OpenCL.cpp
DEPENDS DEPENDS
intrinsics_gen intrinsics_gen
......
;===- ./lib/Transforms/DFG2LLVM_NVPTX/LLVMBuild.txt ------------*- Conf -*--===; ;===- ./lib/Transforms/DFG2LLVM_OpenCL/LLVMBuild.txt ------------*- Conf -*--===;
; ;
; The LLVM Compiler Infrastructure ; The LLVM Compiler Infrastructure
; ;
...@@ -17,5 +17,5 @@ ...@@ -17,5 +17,5 @@
[component_0] [component_0]
type = Library type = Library
name = DFG2LLVM_NVPTX name = DFG2LLVM_OpenCL
parent = Transforms parent = Transforms
...@@ -65,7 +65,7 @@ ifeq ($(TARGET),seq) ...@@ -65,7 +65,7 @@ ifeq ($(TARGET),seq)
HPVM_OPTFLAGS += -hpvm-timers-cpu HPVM_OPTFLAGS += -hpvm-timers-cpu
else else
DEVICE = GPU_TARGET DEVICE = GPU_TARGET
HPVM_OPTFLAGS = -load LLVMBuildDFG.so -load LLVMLocalMem.so -load LLVMDFG2LLVM_NVPTX.so -load LLVMDFG2LLVM_CPU.so -load LLVMClearDFG.so -localmem -dfg2llvm-nvptx -dfg2llvm-cpu -clearDFG HPVM_OPTFLAGS = -load LLVMBuildDFG.so -load LLVMLocalMem.so -load LLVMDFG2LLVM_OpenCL.so -load LLVMDFG2LLVM_CPU.so -load LLVMClearDFG.so -localmem -dfg2llvm-nvptx -dfg2llvm-cpu -clearDFG
HPVM_OPTFLAGS += -hpvm-timers-cpu -hpvm-timers-ptx HPVM_OPTFLAGS += -hpvm-timers-cpu -hpvm-timers-ptx
endif endif
TESTGEN_OPTFLAGS += -hpvm-timers-gen TESTGEN_OPTFLAGS += -hpvm-timers-gen
......
...@@ -22,7 +22,7 @@ ifeq ($(TARGET),seq) ...@@ -22,7 +22,7 @@ ifeq ($(TARGET),seq)
HPVM_OPTFLAGS = -load LLVMBuildDFG.so -load LLVMDFG2LLVM_CPU.so -load LLVMClearDFG.so -dfg2llvm-cpu -clearDFG HPVM_OPTFLAGS = -load LLVMBuildDFG.so -load LLVMDFG2LLVM_CPU.so -load LLVMClearDFG.so -dfg2llvm-cpu -clearDFG
else else
DEVICE = GPU_TARGET DEVICE = GPU_TARGET
HPVM_OPTFLAGS = -load LLVMBuildDFG.so -load LLVMLocalMem.so -load LLVMDFG2LLVM_NVPTX.so -load LLVMDFG2LLVM_CPU.so -load LLVMClearDFG.so -localmem -dfg2llvm-nvptx -dfg2llvm-cpu -clearDFG HPVM_OPTFLAGS = -load LLVMBuildDFG.so -load LLVMLocalMem.so -load LLVMDFG2LLVM_OpenCL.so -load LLVMDFG2LLVM_CPU.so -load LLVMClearDFG.so -localmem -dfg2llvm-nvptx -dfg2llvm-cpu -clearDFG
endif endif
CFLAGS += -DDEVICE=$(DEVICE) CFLAGS += -DDEVICE=$(DEVICE)
......
...@@ -52,7 +52,7 @@ ifeq ($(TARGET),seq) ...@@ -52,7 +52,7 @@ ifeq ($(TARGET),seq)
HPVM_OPTFLAGS += -hpvm-timers-cpu HPVM_OPTFLAGS += -hpvm-timers-cpu
else else
DEVICE = GPU_TARGET DEVICE = GPU_TARGET
HPVM_OPTFLAGS = -load LLVMBuildDFG.so -load LLVMLocalMem.so -load LLVMDFG2LLVM_NVPTX.so -load LLVMDFG2LLVM_CPU.so -load LLVMClearDFG.so -localmem -dfg2llvm-nvptx -dfg2llvm-cpu -clearDFG HPVM_OPTFLAGS = -load LLVMBuildDFG.so -load LLVMLocalMem.so -load LLVMDFG2LLVM_OpenCL.so -load LLVMDFG2LLVM_CPU.so -load LLVMClearDFG.so -localmem -dfg2llvm-nvptx -dfg2llvm-cpu -clearDFG
HPVM_OPTFLAGS += -hpvm-timers-cpu -hpvm-timers-ptx HPVM_OPTFLAGS += -hpvm-timers-cpu -hpvm-timers-ptx
endif endif
TESTGEN_OPTFLAGS += -hpvm-timers-gen TESTGEN_OPTFLAGS += -hpvm-timers-gen
......
...@@ -56,7 +56,7 @@ ifeq ($(TARGET),seq) ...@@ -56,7 +56,7 @@ ifeq ($(TARGET),seq)
HPVM_OPTFLAGS += -hpvm-timers-cpu HPVM_OPTFLAGS += -hpvm-timers-cpu
else else
DEVICE = GPU_TARGET DEVICE = GPU_TARGET
HPVM_OPTFLAGS = -load LLVMBuildDFG.so -load LLVMLocalMem.so -load LLVMDFG2LLVM_NVPTX.so -load LLVMDFG2LLVM_CPU.so -load LLVMClearDFG.so -localmem -dfg2llvm-nvptx -dfg2llvm-cpu -clearDFG HPVM_OPTFLAGS = -load LLVMBuildDFG.so -load LLVMLocalMem.so -load LLVMDFG2LLVM_OpenCL.so -load LLVMDFG2LLVM_CPU.so -load LLVMClearDFG.so -localmem -dfg2llvm-nvptx -dfg2llvm-cpu -clearDFG
HPVM_OPTFLAGS += -hpvm-timers-cpu -hpvm-timers-ptx HPVM_OPTFLAGS += -hpvm-timers-cpu -hpvm-timers-ptx
endif endif
TESTGEN_OPTFLAGS += -hpvm-timers-gen TESTGEN_OPTFLAGS += -hpvm-timers-gen
......
; RUN: opt -load LLVMBuildDFG.so -load LLVMLocalMem.so -load LLVMDFG2LLVM_NVPTX.so -S -localmem -dfg2llvm-nvptx < %s | FileCheck %s ; RUN: opt -load LLVMBuildDFG.so -load LLVMLocalMem.so -load LLVMDFG2LLVM_OpenCL.so -S -localmem -dfg2llvm-nvptx < %s | FileCheck %s
; ModuleID = 'ThreeLevel.atomic.ll' ; ModuleID = 'ThreeLevel.atomic.ll'
source_filename = "ThreeLevel.constmem.c" source_filename = "ThreeLevel.constmem.c"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
......
; RUN: opt -load LLVMBuildDFG.so -load LLVMLocalMem.so -load LLVMDFG2LLVM_NVPTX.so -S -localmem -dfg2llvm-nvptx < %s | FileCheck %s ; RUN: opt -load LLVMBuildDFG.so -load LLVMLocalMem.so -load LLVMDFG2LLVM_OpenCL.so -S -localmem -dfg2llvm-nvptx < %s | FileCheck %s
; ModuleID = 'ThreeLevel.ll' ; ModuleID = 'ThreeLevel.ll'
source_filename = "ThreeLevel.c" source_filename = "ThreeLevel.c"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
......
; RUN: opt -load LLVMBuildDFG.so -load LLVMLocalMem.so -load LLVMDFG2LLVM_NVPTX.so -S -localmem -dfg2llvm-nvptx < %s | FileCheck %s ; RUN: opt -load LLVMBuildDFG.so -load LLVMLocalMem.so -load LLVMDFG2LLVM_OpenCL.so -S -localmem -dfg2llvm-nvptx < %s | FileCheck %s
; ModuleID = 'ThreeLevel.opt.ll' ; ModuleID = 'ThreeLevel.opt.ll'
source_filename = "ThreeLevel.opt.c" source_filename = "ThreeLevel.opt.c"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment