Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add accelerator code generation pass skeleton
Add a new pass to serve as basis for automatic accelerator mapping in Polly. The pass structure and the analyses preserved are copied from CodeGeneration.cpp, as we will rely on IslNodeBuilder and IslExprBuilder for LLVM-IR code generation. Polly's accelerator code generation is enabled with -polly-target=gpu I would like to use this commit as opportunity to thank Yabin Hu for his work in the context of two Google summer of code projects during which he implemented initial prototypes of the Polly accelerator code generation -- in parts this code is already available in todays Polly (e.g., tools/GPURuntime). More will come as part of the upcoming Polly ACC changes. Reviewers: Meinersbur Subscribers: pollydev, llvm-commits Differential Revision: http://reviews.llvm.org/D22036 llvm-svn: 275275
- Loading branch information
1 parent
a041239
commit 9dfe4e7
Showing
4 changed files
with
118 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
//===------ PPCGCodeGeneration.cpp - Polly Accelerator Code Generation. ---===// | ||
// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is distributed under the University of Illinois Open Source | ||
// License. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Take a scop created by ScopInfo and map it to GPU code using the ppcg | ||
// GPU mapping strategy. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "polly/CodeGen/IslNodeBuilder.h" | ||
#include "polly/DependenceInfo.h" | ||
#include "polly/LinkAllPasses.h" | ||
#include "polly/ScopInfo.h" | ||
#include "llvm/Analysis/AliasAnalysis.h" | ||
#include "llvm/Analysis/BasicAliasAnalysis.h" | ||
#include "llvm/Analysis/GlobalsModRef.h" | ||
#include "llvm/Analysis/PostDominators.h" | ||
#include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h" | ||
|
||
#include "llvm/Support/Debug.h" | ||
|
||
using namespace polly; | ||
using namespace llvm; | ||
|
||
#define DEBUG_TYPE "polly-codegen-ppcg" | ||
|
||
namespace { | ||
class PPCGCodeGeneration : public ScopPass { | ||
public: | ||
static char ID; | ||
|
||
PPCGCodeGeneration() : ScopPass(ID) {} | ||
|
||
bool runOnScop(Scop &S) override { return true; } | ||
|
||
void printScop(raw_ostream &, Scop &) const override {} | ||
|
||
void getAnalysisUsage(AnalysisUsage &AU) const override { | ||
AU.addRequired<DominatorTreeWrapperPass>(); | ||
AU.addRequired<RegionInfoPass>(); | ||
AU.addRequired<ScalarEvolutionWrapperPass>(); | ||
AU.addRequired<ScopDetection>(); | ||
AU.addRequired<ScopInfoRegionPass>(); | ||
AU.addRequired<LoopInfoWrapperPass>(); | ||
|
||
AU.addPreserved<AAResultsWrapperPass>(); | ||
AU.addPreserved<BasicAAWrapperPass>(); | ||
AU.addPreserved<LoopInfoWrapperPass>(); | ||
AU.addPreserved<DominatorTreeWrapperPass>(); | ||
AU.addPreserved<GlobalsAAWrapperPass>(); | ||
AU.addPreserved<PostDominatorTreeWrapperPass>(); | ||
AU.addPreserved<ScopDetection>(); | ||
AU.addPreserved<ScalarEvolutionWrapperPass>(); | ||
AU.addPreserved<SCEVAAWrapperPass>(); | ||
|
||
// FIXME: We do not yet add regions for the newly generated code to the | ||
// region tree. | ||
AU.addPreserved<RegionInfoPass>(); | ||
AU.addPreserved<ScopInfoRegionPass>(); | ||
} | ||
}; | ||
} | ||
|
||
char PPCGCodeGeneration::ID = 1; | ||
|
||
Pass *polly::createPPCGCodeGenerationPass() { return new PPCGCodeGeneration(); } | ||
|
||
INITIALIZE_PASS_BEGIN(PPCGCodeGeneration, "polly-codegen-ppcg", | ||
"Polly - Apply PPCG translation to SCOP", false, false) | ||
INITIALIZE_PASS_DEPENDENCY(DependenceInfo); | ||
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass); | ||
INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass); | ||
INITIALIZE_PASS_DEPENDENCY(RegionInfoPass); | ||
INITIALIZE_PASS_DEPENDENCY(ScalarEvolutionWrapperPass); | ||
INITIALIZE_PASS_DEPENDENCY(ScopDetection); | ||
INITIALIZE_PASS_END(PPCGCodeGeneration, "polly-codegen-ppcg", | ||
"Polly - Apply PPCG translation to SCOP", false, false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters