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
01590bd5
Commit
01590bd5
authored
10 years ago
by
Prakalp Srivastava
Browse files
Options
Downloads
Patches
Plain Diff
Checkpoint commit in coding GenVISC pass
parent
8f0d5fe7
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
+2
-2
2 additions, 2 deletions
llvm/include/llvm/GenVISC/GenVISC.h
llvm/lib/Transforms/GenVISC/GenVISC.cpp
+36
-0
36 additions, 0 deletions
llvm/lib/Transforms/GenVISC/GenVISC.cpp
with
38 additions
and
2 deletions
llvm/include/llvm/GenVISC/GenVISC.h
+
2
−
2
View file @
01590bd5
...
...
@@ -36,8 +36,8 @@ public:
virtual
bool
runOnModule
(
Module
&
M
);
static
bool
isVISCNodeCall
(
Instruction
*
I
);
static
void
genKernel
(
Function
*
KernelFunction
,
CallInst
*
CI
);
static
void
genHost
(
CallInst
*
CI
);
void
genKernel
(
Function
*
KernelFunction
,
CallInst
*
CI
);
void
genHost
(
CallInst
*
CI
);
};
}
// End of namespace
...
...
This diff is collapsed.
Click to expand it.
llvm/lib/Transforms/GenVISC/GenVISC.cpp
+
36
−
0
View file @
01590bd5
...
...
@@ -47,7 +47,13 @@ bool GenVISC::runOnModule(Module &M) {
}
// Helper Functions
static
unsigned
getNumericValue
(
Value
*
V
)
{
assert
(
isa
<
ConstantInt
>
(
V
)
&&
"Number of arguments should be a constant"
);
return
cast
<
ConstantInt
>
(
V
)
->
getZExtValue
();
}
// Public Functions of GenVISC pass
bool
GenVISC
::
isVISCNodeCall
(
Instruction
*
I
)
{
if
(
!
isa
<
CallInst
>
(
I
))
return
false
;
...
...
@@ -64,6 +70,36 @@ void GenVISC::genKernel(Function* KernelF, CallInst* CI) {
void
GenVISC
::
genHost
(
CallInst
*
CI
)
{
// Make host code changes here
errs
()
<<
"Modifying Host code for __visc__node call site: "
<<
*
CI
<<
"
\n
"
;
// Find number of dimensions
unsigned
offset
=
1
;
// argument at offset 1 is the number of dimensions
assert
(
CI
->
getNumArgOperands
()
>
offset
&&
"Too few arguments for __visc_node call!"
);
unsigned
numDims
=
getNumericValue
(
CI
->
getOperand
(
offset
));
errs
()
<<
"Num of dimensions = "
<<
numDims
<<
"
\n
"
;
// Find number of arguments
offset
+=
numDims
+
1
;
// skip the dimesnions
assert
(
CI
->
getNumArgOperands
()
>
offset
&&
"Too few arguments for __visc_node call!"
);
unsigned
numArgs
=
getNumericValue
(
CI
->
getArgOperand
(
offset
));
errs
()
<<
"Num of kernel arguments = "
<<
numArgs
<<
"
\n
"
;
// Find number of outputs
offset
+=
numArgs
+
1
;
// skip the kernel arguments
assert
(
CI
->
getNumArgOperands
()
>
offset
&&
"Too few arguments for __visc_node call!"
);
unsigned
numOutputs
=
getNumericValue
(
CI
->
getArgOperand
(
offset
));
errs
()
<<
"Num of kernel outputs = "
<<
numOutputs
<<
"
\n
"
;
// Find return struct type
// Generate argument struct type (All arguments followed by return struct type)
// Insert alloca inst for this argument struct type
// Marshall all input arguments into argument struct type
// Type cast argument struct to i8*
// Replace CI with launch call
// Add wait call
// Get result (optional)
}
char
GenVISC
::
ID
=
0
;
...
...
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