[PATCH] D32431: [Polly] Added OpenCL Runtime to GPURuntime Library for GPGPU CodeGen
Michael Kruse via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 25 04:31:37 PDT 2017
Meinersbur added a comment.
I wrote a runtime with similar scope here: https://github.com/Meinersbur/prl . We were one discussing to use it for Polly as well. What's the status of that?
================
Comment at: lib/CodeGen/PPCGCodeGeneration.cpp:56-58
+#define GPU_RUNTIME_NONE 0
+#define GPU_RUNTIME_CUDA 1
+#define GPU_RUNTIME_OPENCL 2
----------------
Did you consider an enum?
================
Comment at: lib/CodeGen/PPCGCodeGeneration.cpp:1562
+ else if (GPUNodeBuilder::Runtime == GPU_RUNTIME_OPENCL)
+ GPUModule->setTargetTriple(Triple::normalize("nvptx64-nvidia-nvcl"));
+
----------------
Is there some vendor-neutral triple?
================
Comment at: lib/CodeGen/PPCGCodeGeneration.cpp:1656
static char ID;
+ static int Runtime;
----------------
Why a static flag?
================
Comment at: lib/CodeGen/PPCGCodeGeneration.cpp:2530-2538
+Pass *polly::createPPCGCodeGenerationPassCUDA() {
+ PPCGCodeGeneration::Runtime = GPU_RUNTIME_CUDA;
+ return new PPCGCodeGeneration();
+}
+
+Pass *polly::createPPCGCodeGenerationPassOpenCL() {
+ PPCGCodeGeneration::Runtime = GPU_RUNTIME_OPENCL;
----------------
Did you consider
```
Pass *polly::createPPCGCodeGenerationPass(int Runtime);
```
?
================
Comment at: lib/Support/RegisterPasses.cpp:312-319
+ if (Target == TARGET_GPU_CUDA) {
#ifdef GPU_CODEGEN
- PM.add(polly::createPPCGCodeGenerationPass());
+ PM.add(polly::createPPCGCodeGenerationPassCUDA());
+#endif
+ } else if (Target == TARGET_GPU_OPENCL) {
+#ifdef GPU_CODEGEN
+ PM.add(polly::createPPCGCodeGenerationPassOpenCL());
----------------
A switch instead?
https://reviews.llvm.org/D32431
More information about the llvm-commits
mailing list