Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hpvm-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
llvm
hpvm-release
Commits
d13e1f3f
Commit
d13e1f3f
authored
10 years ago
by
Prakalp Srivastava
Browse files
Options
Downloads
Patches
Plain Diff
Topological sort working. Added support for query intrinsics in BuildDFG
parent
bb68383e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
llvm/include/llvm/BuildDFG/BuildDFG.h
+1
-0
1 addition, 0 deletions
llvm/include/llvm/BuildDFG/BuildDFG.h
llvm/lib/Transforms/BuildDFG/BuildDFG.cpp
+58
-16
58 additions, 16 deletions
llvm/lib/Transforms/BuildDFG/BuildDFG.cpp
with
59 additions
and
16 deletions
llvm/include/llvm/BuildDFG/BuildDFG.h
+
1
−
0
View file @
d13e1f3f
...
@@ -42,6 +42,7 @@ namespace builddfg {
...
@@ -42,6 +42,7 @@ namespace builddfg {
// Functions
// Functions
void
handleCreateNode
(
DFInternalNode
*
N
,
IntrinsicInst
*
II
);
void
handleCreateNode
(
DFInternalNode
*
N
,
IntrinsicInst
*
II
);
void
handleCreateEdge
(
DFInternalNode
*
N
,
IntrinsicInst
*
II
);
void
handleCreateEdge
(
DFInternalNode
*
N
,
IntrinsicInst
*
II
);
void
handleGetParentNode
(
DFInternalNode
*
N
,
IntrinsicInst
*
II
);
void
BuildGraph
(
DFInternalNode
*
N
,
Function
*
F
);
void
BuildGraph
(
DFInternalNode
*
N
,
Function
*
F
);
...
...
This diff is collapsed.
Click to expand it.
llvm/lib/Transforms/BuildDFG/BuildDFG.cpp
+
58
−
16
View file @
d13e1f3f
...
@@ -199,24 +199,51 @@ namespace builddfg {
...
@@ -199,24 +199,51 @@ namespace builddfg {
Type
*
SrcTy
,
*
DestTy
;
Type
*
SrcTy
,
*
DestTy
;
// Get destination type
// Get destination type
FunctionType
*
FT
=
DestDF
->
getFuncPointer
()
->
getFunctionType
();
// If destination is the parent node. Then we need the return type of the
assert
((
FT
->
getNumParams
()
>
DestPosition
)
// parent node. Hence need to handle it as a special case
&&
"Invalid argument number for destination dataflow node!"
);
if
(
DestDF
==
(
DFNode
*
)
N
)
{
DestTy
=
FT
->
getParamType
(
DestPosition
);
StructType
*
OutTy
=
cast
<
StructType
>
(
DestDF
->
getOutputType
());
assert
((
OutTy
->
getNumElements
()
>
DestPosition
)
&&
"Invalid argument number for destination parent dataflow node!"
);
DestTy
=
OutTy
->
getElementType
(
DestPosition
);
}
else
{
// If destination is a sibling
FunctionType
*
FT
=
DestDF
->
getFuncPointer
()
->
getFunctionType
();
errs
()
<<
"Destination: "
<<
DestDF
->
getFuncPointer
()
->
getName
()
<<
"
\n
"
;
errs
()
<<
FT
->
getNumParams
()
<<
" "
<<
DestPosition
<<
"
\n
"
;
errs
()
<<
*
FT
<<
"
\n
"
;
assert
((
FT
->
getNumParams
()
>
DestPosition
)
&&
"Invalid argument number for destination dataflow node!"
);
DestTy
=
FT
->
getParamType
(
DestPosition
);
}
// Get source type
// Get source type
if
(
isa
<
DFInternalNode
>
(
SrcDF
))
{
// If source is the parent node. Then we need the parameter list of the
// For Internal node, get the correct element type from the struct type
// parent node. Hence need to handle it as a special case
StructType
*
OutTy
=
cast
<
StructType
>
(
SrcDF
->
getOutputType
());
if
(
SrcDF
==
(
DFNode
*
)
N
)
{
assert
((
OutTy
->
getNumElements
()
>
SourcePosition
)
FunctionType
*
FT
=
SrcDF
->
getFuncPointer
()
->
getFunctionType
();
&&
"Invalid argument number for source dataflow node!"
);
assert
((
FT
->
getNumParams
()
>
SourcePosition
)
SrcTy
=
OutTy
->
getElementType
(
SourcePosition
);
&&
"Invalid argument number for source parent dataflow node!"
);
SrcTy
=
FT
->
getParamType
(
SourcePosition
);
}
}
else
{
else
{
// For Leaf node, there is just one outgoing edge
// If source is a sibling
assert
((
SourcePosition
==
0
)
if
(
isa
<
DFInternalNode
>
(
SrcDF
))
{
&&
"Invalid argument number for source dataflow node!"
);
// For Internal node, get the correct element type from the struct type
SrcTy
=
SrcDF
->
getOutputType
();
StructType
*
OutTy
=
cast
<
StructType
>
(
SrcDF
->
getOutputType
());
errs
()
<<
"Source: "
<<
SrcDF
->
getFuncPointer
()
->
getName
()
<<
"
\n
"
;
errs
()
<<
OutTy
->
getNumElements
()
<<
" "
<<
SourcePosition
<<
"
\n
"
;
assert
((
OutTy
->
getNumElements
()
>
SourcePosition
)
&&
"Invalid argument number for source dataflow node!"
);
SrcTy
=
OutTy
->
getElementType
(
SourcePosition
);
}
else
{
// For Leaf node, there is just one outgoing edge
assert
((
SourcePosition
==
0
)
&&
"Invalid argument number for source dataflow node!"
);
SrcTy
=
SrcDF
->
getOutputType
();
}
}
}
// check if the types are compatible
// check if the types are compatible
...
@@ -236,6 +263,14 @@ namespace builddfg {
...
@@ -236,6 +263,14 @@ namespace builddfg {
N
->
addEdgeToDFGraph
(
newDFEdge
);
N
->
addEdgeToDFGraph
(
newDFEdge
);
}
}
void
BuildDFG
::
handleGetParentNode
(
DFInternalNode
*
N
,
IntrinsicInst
*
II
)
{
HandleToDFNode
::
iterator
DFI
=
HandleToDFNodeMap
.
find
(
II
->
getOperand
(
0
));
assert
(
DFI
!=
HandleToDFNodeMap
.
end
()
&&
"Undefined operand!"
);
DFNode
*
DF
=
HandleToDFNodeMap
[
II
->
getOperand
(
0
)];
HandleToDFNodeMap
[
II
]
=
DF
->
getParent
();
}
void
BuildDFG
::
BuildGraph
(
DFInternalNode
*
N
,
Function
*
F
)
{
void
BuildDFG
::
BuildGraph
(
DFInternalNode
*
N
,
Function
*
F
)
{
// TODO: Place checks for valid visc functions. For example one of the
// TODO: Place checks for valid visc functions. For example one of the
...
@@ -264,8 +299,15 @@ namespace builddfg {
...
@@ -264,8 +299,15 @@ namespace builddfg {
case
Intrinsic
::
visc_createEdge
:
case
Intrinsic
::
visc_createEdge
:
handleCreateEdge
(
N
,
II
);
handleCreateEdge
(
N
,
II
);
break
;
break
;
case
Intrinsic
::
visc_getNode
:
HandleToDFNodeMap
[
II
]
=
N
;
break
;
case
Intrinsic
::
visc_getParentNode
:
handleGetParentNode
(
N
,
II
);
break
;
//TODO: Reconsider launch within a dataflow graph (recursion?)
//TODO: Reconsider launch within a dataflow graph (recursion?)
case
Intrinsic
::
visc_launch
:
case
Intrinsic
::
visc_launch
:
errs
()
<<
"Error: Launch intrinsic used within a dataflow graph
\n
"
;
errs
()
<<
"Error: Launch intrinsic used within a dataflow graph
\n
"
;
break
;
break
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment