Skip to content
Snippets Groups Projects
Commit e787d15e authored by kotsifa2's avatar kotsifa2
Browse files

Changes in dfg2llvm_nvptx pass.

- Simple (only for first cut, to be reconsidered) kernel selection.
- Code refactoring.
parent e496365b
No related branches found
No related tags found
No related merge requests found
......@@ -61,6 +61,7 @@ namespace {
//Member variables
Module &M;
BuildDFG &DFG;
DFNode * KernelLaunchNode;
// Map from Old function associated with DFNode to new cloned function with
// extra index and dimension arguments. This map also serves to find out if
......@@ -101,6 +102,18 @@ namespace {
void CodeGenTraversal::codeGen(DFInternalNode* N) {
if (!KernelLaunchNode) {
DEBUG(errs() << "No code generated (host code for kernel launch complete).\n");
return;
}
if (N == KernelLaunchNode) {
DEBUG(errs() << "Found kernel launch node. Generating host code.\n");
} else {
DEBUG(errs() << "Found intermediate node. Generating device code.\n");
DEBUG(errs() << "Changing leaf node function to device function.\n");
}
}
void CodeGenTraversal::codeGen(DFLeafNode* N) {
......@@ -111,6 +124,16 @@ namespace {
return;
}
// Checking which node is the kernel launch
DFNode* PNode = N->getParent();
int pLevel = PNode->getLevel();
int pReplFactor = PNode->getNumOfDim();
if (!pLevel || !pReplFactor)
KernelLaunchNode = PNode;
else
KernelLaunchNode = PNode->getParent();
std::vector<IntrinsicInst *> IItoRemove;
BuildDFG::HandleToDFNode Leaf_HandleToDFNodeMap;
......
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