diff --git a/polly/include/polly/CodeGen/PPCGCodeGeneration.h b/polly/include/polly/CodeGen/PPCGCodeGeneration.h index d003fb266c47..9a6c596e5f49 100644 --- a/polly/include/polly/CodeGen/PPCGCodeGeneration.h +++ b/polly/include/polly/CodeGen/PPCGCodeGeneration.h @@ -22,6 +22,12 @@ enum GPURuntime { CUDA, OpenCL }; namespace polly { extern bool PollyManagedMemory; -} + +/// Use for pass instantiation defaults. +/// @{ +extern GPURuntime GPURuntimeChoice; +extern GPUArch GPUArchChoice; +/// @} +} // namespace polly #endif // POLLY_PPCGCODEGENERATION_H diff --git a/polly/lib/CodeGen/PPCGCodeGeneration.cpp b/polly/lib/CodeGen/PPCGCodeGeneration.cpp index 0b959002cee1..53818a4097ee 100644 --- a/polly/lib/CodeGen/PPCGCodeGeneration.cpp +++ b/polly/lib/CodeGen/PPCGCodeGeneration.cpp @@ -117,6 +117,29 @@ static cl::opt cl::desc("Minimal number of compute statements to run on GPU."), cl::Hidden, cl::init(10 * 512 * 512)); +GPURuntime polly::GPURuntimeChoice; +static cl::opt XGPURuntimeChoice( + "polly-gpu-runtime", cl::desc("The GPU Runtime API to target"), + cl::values(clEnumValN(GPURuntime::CUDA, "libcudart", + "use the CUDA Runtime API"), + clEnumValN(GPURuntime::OpenCL, "libopencl", + "use the OpenCL Runtime API")), + cl::location(polly::GPURuntimeChoice), cl::init(GPURuntime::CUDA), + cl::ZeroOrMore, cl::cat(PollyCategory)); + +GPUArch polly::GPUArchChoice; +static cl::opt + XGPUArchChoice("polly-gpu-arch", cl::desc("The GPU Architecture to target"), + cl::values(clEnumValN(GPUArch::NVPTX64, "nvptx64", + "target NVIDIA 64-bit architecture"), + clEnumValN(GPUArch::SPIR32, "spir32", + "target SPIR 32-bit architecture"), + clEnumValN(GPUArch::SPIR64, "spir64", + "target SPIR 64-bit architecture")), + cl::location(polly::GPUArchChoice), + cl::init(GPUArch::NVPTX64), cl::ZeroOrMore, + cl::cat(PollyCategory)); + extern bool polly::PerfMonitoring; /// Return a unique name for a Scop, which is the scop region with the @@ -2548,7 +2571,11 @@ public: const DataLayout *DL; RegionInfo *RI; - PPCGCodeGeneration() : ScopPass(ID) {} + PPCGCodeGeneration() : ScopPass(ID) { + // Apply defaults. + Runtime = GPURuntimeChoice; + Architecture = GPUArchChoice; + } /// Construct compilation options for PPCG. /// diff --git a/polly/lib/Support/RegisterPasses.cpp b/polly/lib/Support/RegisterPasses.cpp index d9caed41ddba..0d2a5801bac1 100644 --- a/polly/lib/Support/RegisterPasses.cpp +++ b/polly/lib/Support/RegisterPasses.cpp @@ -106,27 +106,6 @@ static cl::opt ), cl::init(TARGET_CPU), cl::ZeroOrMore, cl::cat(PollyCategory)); -#ifdef GPU_CODEGEN -static cl::opt GPURuntimeChoice( - "polly-gpu-runtime", cl::desc("The GPU Runtime API to target"), - cl::values(clEnumValN(GPURuntime::CUDA, "libcudart", - "use the CUDA Runtime API"), - clEnumValN(GPURuntime::OpenCL, "libopencl", - "use the OpenCL Runtime API")), - cl::init(GPURuntime::CUDA), cl::ZeroOrMore, cl::cat(PollyCategory)); - -static cl::opt - GPUArchChoice("polly-gpu-arch", cl::desc("The GPU Architecture to target"), - cl::values(clEnumValN(GPUArch::NVPTX64, "nvptx64", - "target NVIDIA 64-bit architecture"), - clEnumValN(GPUArch::SPIR32, "spir32", - "target SPIR 32-bit architecture"), - clEnumValN(GPUArch::SPIR64, "spir64", - "target SPIR 64-bit architecture")), - cl::init(GPUArch::NVPTX64), cl::ZeroOrMore, - cl::cat(PollyCategory)); -#endif - VectorizerChoice polly::PollyVectorizerChoice; static cl::opt Vectorizer( "polly-vectorizer", cl::desc("Select the vectorization strategy"), diff --git a/polly/test/GPGPU/spir-typesize.ll b/polly/test/GPGPU/spir-typesize.ll index dae75ad74b49..2e9459134555 100644 --- a/polly/test/GPGPU/spir-typesize.ll +++ b/polly/test/GPGPU/spir-typesize.ll @@ -1,9 +1,9 @@ -; RUN: opt %loadPolly -O3 -polly -polly-target=gpu \ +; RUN: opt %loadPolly -polly-codegen-ppcg \ ; RUN: -polly-gpu-arch=spir64 \ ; RUN: -polly-acc-dump-kernel-ir -polly-process-unprofitable -disable-output < %s | \ ; RUN: FileCheck -check-prefix=I64 %s -; RUN: opt %loadPolly -O3 -polly -polly-target=gpu \ +; RUN: opt %loadPolly -polly-codegen-ppcg \ ; RUN: -polly-gpu-arch=spir32 \ ; RUN: -polly-acc-dump-kernel-ir -polly-process-unprofitable -disable-output < %s | \ ; RUN: FileCheck -check-prefix=I32 %s