Skip to content

Commit afd09f2

Browse files
authored
Merge pull request #21903 from singam-sanjay/USE_POLLY_ACC-withGPURuntimeHeader
Introduce USE_POLLY_ACC
2 parents d3bc329 + 628ab6d commit afd09f2

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

Make.inc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,12 @@ BUILD_LLVM_CLANG := 0
237237
# set to 1 to get lldb (often does not work, no chance with llvm3.2 and earlier)
238238
# see http://lldb.llvm.org/build.html for dependencies
239239
BUILD_LLDB := 0
240+
241+
# Options to enable Polly and its code-generation options
240242
USE_POLLY := 0
241-
USE_POLLY_OPENMP := 0
243+
USE_POLLY_OPENMP := 0 # Enable OpenMP code-generation
244+
USE_POLLY_ACC := 0 # Enable GPU code-generation
245+
CUDALIB_INCLUDE_DIR := # Path to CUDA header files
242246

243247
# Cross-compile
244248
#XC_HOST := i686-w64-mingw32

deps/llvm.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ LLVM_CXXFLAGS += $(CXXFLAGS)
6666
LLVM_CPPFLAGS += $(CPPFLAGS)
6767
LLVM_LDFLAGS += $(LDFLAGS)
6868
LLVM_CMAKE += -DLLVM_TARGETS_TO_BUILD:STRING="$(LLVM_TARGETS)" -DCMAKE_BUILD_TYPE="$(LLVM_CMAKE_BUILDTYPE)"
69+
ifeq ($(USE_POLLY_ACC),1)
70+
LLVM_CMAKE += -DPOLLY_ENABLE_GPGPU_CODEGEN=ON
71+
endif
6972
LLVM_CMAKE += -DLLVM_TOOLS_INSTALL_DIR=$(shell $(JULIAHOME)/contrib/relative_path.sh $(build_prefix) $(build_depsbindir))
7073
LLVM_CMAKE += -DLLVM_BINDINGS_LIST="" -DLLVM_INCLUDE_DOCS=Off -DLLVM_ENABLE_TERMINFO=Off -DHAVE_HISTEDIT_H=Off -DHAVE_LIBEDIT=Off
7174
LLVM_FLAGS += --disable-profiling --enable-static --enable-targets=$(LLVM_TARGETS)

src/Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ FLAGS += -DUSE_POLLY
6464
ifeq ($(USE_POLLY_OPENMP),1)
6565
FLAGS += -fopenmp
6666
endif
67+
ifeq ($(USE_POLLY_ACC),1)
68+
LLVMLINK += -lPollyPPCG
69+
FLAGS += -DUSE_POLLY_ACC
70+
ifeq ($(CUDALIB_INCLUDE_DIR),)
71+
$(error CUDALIB_INCLUDE_DIR not set: If compiling with USE_POLLY_ACC, user must provide the path to CUDA header files)
72+
endif
73+
FLAGS += -I$(CUDALIB_INCLUDE_DIR)
74+
FLAGS += -I$(shell $(LLVM_CONFIG_HOST) --src-root)/tools/polly/tools
75+
endif
6776
endif
6877
else
6978
SRCS += anticodegen

src/jitlayers.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
#include <polly/RegisterPasses.h>
2626
#include <polly/LinkAllPasses.h>
2727
#include <polly/CodeGen/CodegenCleanup.h>
28+
#if defined(USE_POLLY_ACC)
29+
#include <polly/Support/LinkGPURuntime.h>
30+
#endif
2831
#endif
2932

3033
#include <llvm/Transforms/IPO.h>

0 commit comments

Comments
 (0)