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
8f0d5fe7
Commit
8f0d5fe7
authored
10 years ago
by
Prakalp Srivastava
Browse files
Options
Downloads
Patches
Plain Diff
Changes to GenVISC pass to find the __visc__node call site and call appropriate
functions to generate changes to host and kernel code
parent
74b0c13f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
llvm/include/llvm/GenVISC/GenVISC.h
+3
-0
3 additions, 0 deletions
llvm/include/llvm/GenVISC/GenVISC.h
llvm/lib/Transforms/GenVISC/GenVISC.cpp
+28
-5
28 additions, 5 deletions
llvm/lib/Transforms/GenVISC/GenVISC.cpp
with
31 additions
and
5 deletions
llvm/include/llvm/GenVISC/GenVISC.h
+
3
−
0
View file @
8f0d5fe7
...
...
@@ -35,6 +35,9 @@ public:
// Functions
virtual
bool
runOnModule
(
Module
&
M
);
static
bool
isVISCNodeCall
(
Instruction
*
I
);
static
void
genKernel
(
Function
*
KernelFunction
,
CallInst
*
CI
);
static
void
genHost
(
CallInst
*
CI
);
};
}
// End of namespace
...
...
This diff is collapsed.
Click to expand it.
llvm/lib/Transforms/GenVISC/GenVISC.cpp
+
28
−
5
View file @
8f0d5fe7
...
...
@@ -25,8 +25,6 @@ bool GenVISC::runOnModule(Module &M) {
errs
()
<<
"-------- Searching for launch sites ----------
\n
"
;
IntrinsicInst
*
II
;
// Iterate over all functions in the module
for
(
Module
::
iterator
mi
=
M
.
begin
(),
me
=
M
.
end
();
mi
!=
me
;
++
mi
)
{
Function
*
f
=
&*
mi
;
...
...
@@ -34,15 +32,40 @@ bool GenVISC::runOnModule(Module &M) {
for
(
inst_iterator
i
=
inst_begin
(
f
),
e
=
inst_end
(
f
);
i
!=
e
;
++
i
)
{
Instruction
*
I
=
&*
i
;
// Grab pointer to Instruction
if
(
isVISCNodeCall
(
I
))
{
CallInst
*
CI
=
cast
<
CallInst
>
(
I
);
errs
()
<<
"Found visc node call
\n
"
;
assert
(
CI
->
getNumArgOperands
()
>=
4
&&
"__visc_node call should have atleast 4 arguments!"
);
genKernel
(
cast
<
Function
>
(
CI
->
getArgOperand
(
0
)),
CI
);
genHost
(
CI
);
}
}
}
// Checking that we found at least one launch site
//assert((Roots.size() != 0) && "Launch site not found.");
return
false
;
//TODO: What does returning "false" mean?
}
// Helper Functions
bool
GenVISC
::
isVISCNodeCall
(
Instruction
*
I
)
{
if
(
!
isa
<
CallInst
>
(
I
))
return
false
;
CallInst
*
CI
=
cast
<
CallInst
>
(
I
);
DEBUG
(
errs
()
<<
*
I
<<
"
\n
"
);
return
(
CI
->
getCalledValue
()
->
stripPointerCasts
()
->
getName
()).
equals
(
"__visc__node"
);
}
void
GenVISC
::
genKernel
(
Function
*
KernelF
,
CallInst
*
CI
)
{
// Make changes to kernel here
errs
()
<<
"Modifying Node Function: "
<<
KernelF
->
getName
()
<<
"
\n
"
;
}
void
GenVISC
::
genHost
(
CallInst
*
CI
)
{
// Make host code changes here
errs
()
<<
"Modifying Host code for __visc__node call site: "
<<
*
CI
<<
"
\n
"
;
}
char
GenVISC
::
ID
=
0
;
static
RegisterPass
<
GenVISC
>
X
(
"genvisc"
,
"Pass to generate VISC IR from LLVM IR (with dummy function calls)"
,
false
,
false
);
...
...
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