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
17ac2769
Commit
17ac2769
authored
6 years ago
by
kotsifa2
Browse files
Options
Downloads
Patches
Plain Diff
Edit generated runtime calls to tensor runtime, according to required
signatures.
parent
f8685646
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
llvm/lib/Transforms/DFG2LLVM_CUDNN/DFG2LLVM_CUDNN.cpp
+14
-12
14 additions, 12 deletions
llvm/lib/Transforms/DFG2LLVM_CUDNN/DFG2LLVM_CUDNN.cpp
with
14 additions
and
12 deletions
llvm/lib/Transforms/DFG2LLVM_CUDNN/DFG2LLVM_CUDNN.cpp
+
14
−
12
View file @
17ac2769
...
@@ -56,9 +56,9 @@ private:
...
@@ -56,9 +56,9 @@ private:
InPlaceDFGAnalysis
::
InPlaceDFGParameter
*
IPP
;
InPlaceDFGAnalysis
::
InPlaceDFGParameter
*
IPP
;
// VISC Runtime API and Tensor runtime API
// VISC Runtime API and Tensor runtime API
Constant
*
llvm_
visc
_initTensorRt
;
// FIXME: sync names
Constant
*
llvm_
hpvm
_initTensorRt
;
// FIXME: sync names
Constant
*
llvm_
visc
_cleanupTensorRt
;
// FIXME: add function
Constant
*
llvm_
hpvm
_cleanupTensorRt
;
// FIXME: add function
Constant
*
ll
vm_
visc_
request
T
ensor
;
// FIXME: add function
Constant
*
hp
vm_request
_t
ensor
;
// FIXME: add function
// Functions
// Functions
...
@@ -105,9 +105,9 @@ void CGT_CUDNN::initRuntimeAPI() {
...
@@ -105,9 +105,9 @@ void CGT_CUDNN::initRuntimeAPI() {
// - initialization
// - initialization
// - cleanup
// - cleanup
// - request a tensor
// - request a tensor
DECLARE
(
llvm_
visc
_initTensorRt
);
DECLARE
(
llvm_
hpvm
_initTensorRt
);
DECLARE
(
llvm_
visc
_cleanupTensorRt
);
DECLARE
(
llvm_
hpvm
_cleanupTensorRt
);
DECLARE
(
ll
vm_
visc_
request
T
ensor
);
DECLARE
(
hp
vm_request
_t
ensor
);
// Find visc.init and visc.cleanup calls, and add placeholder methods
// Find visc.init and visc.cleanup calls, and add placeholder methods
// for initialization and cleanup of the hpvm tensor runtime
// for initialization and cleanup of the hpvm tensor runtime
...
@@ -115,12 +115,12 @@ void CGT_CUDNN::initRuntimeAPI() {
...
@@ -115,12 +115,12 @@ void CGT_CUDNN::initRuntimeAPI() {
Function
*
VI
=
M
.
getFunction
(
"llvm.visc.init"
);
Function
*
VI
=
M
.
getFunction
(
"llvm.visc.init"
);
assert
(
VI
->
getNumUses
()
==
1
&&
"__visc__init should only be used once
\n
"
);
assert
(
VI
->
getNumUses
()
==
1
&&
"__visc__init should only be used once
\n
"
);
InitCall
=
cast
<
Instruction
>
(
*
VI
->
user_begin
());
InitCall
=
cast
<
Instruction
>
(
*
VI
->
user_begin
());
CallInst
::
Create
(
llvm_
visc
_initTensorRt
,
ArrayRef
<
Value
*>
(),
""
,
InitCall
);
CallInst
::
Create
(
llvm_
hpvm
_initTensorRt
,
ArrayRef
<
Value
*>
(),
""
,
InitCall
);
Function
*
VC
=
M
.
getFunction
(
"llvm.visc.cleanup"
);
Function
*
VC
=
M
.
getFunction
(
"llvm.visc.cleanup"
);
assert
(
VC
->
getNumUses
()
==
1
&&
"__visc__clear should only be used once
\n
"
);
assert
(
VC
->
getNumUses
()
==
1
&&
"__visc__clear should only be used once
\n
"
);
CleanupCall
=
cast
<
Instruction
>
(
*
VC
->
user_begin
());
CleanupCall
=
cast
<
Instruction
>
(
*
VC
->
user_begin
());
CallInst
::
Create
(
llvm_
visc
_cleanupTensorRt
,
ArrayRef
<
Value
*>
(),
""
,
CleanupCall
);
CallInst
::
Create
(
llvm_
hpvm
_cleanupTensorRt
,
ArrayRef
<
Value
*>
(),
""
,
CleanupCall
);
}
}
...
@@ -178,15 +178,17 @@ void CGT_CUDNN::codeGen(DFLeafNode* N) {
...
@@ -178,15 +178,17 @@ void CGT_CUDNN::codeGen(DFLeafNode* N) {
// This is the first instruction of the function, insert them before this
// This is the first instruction of the function, insert them before this
Instruction
*
FI
=
&*
(
F_cudnn
->
getEntryBlock
().
begin
());
Instruction
*
FI
=
&*
(
F_cudnn
->
getEntryBlock
().
begin
());
// In this backend, the target device is GPU.
// In this backend, the target device is GPU, represented by i32 1.
// Create an LLVM Value that represents the visc::GPU_TARGET FIXME
ConstantInt
*
TargetDeviceID
=
ConstantInt
::
get
(
Type
::
getInt32Ty
(
M
.
getContext
()),
-
1
);
for
(
Function
::
arg_iterator
ai
=
F_cudnn
->
arg_begin
(),
for
(
Function
::
arg_iterator
ai
=
F_cudnn
->
arg_begin
(),
ae
=
F_cudnn
->
arg_end
();
ai
!=
ae
;
++
ai
)
{
ae
=
F_cudnn
->
arg_end
();
ai
!=
ae
;
++
ai
)
{
Argument
*
Arg
=
&*
ai
;
Argument
*
Arg
=
&*
ai
;
if
(
Arg
->
getType
()
->
isPointerTy
())
{
if
(
Arg
->
getType
()
->
isPointerTy
())
{
CallInst
::
Create
(
llvm_visc_requestTensor
,
Value
*
Args
[]
=
{
Arg
,
TargetDeviceID
};
ArrayRef
<
Value
*>
(
Arg
),
// FIXME: add second argument
CallInst
::
Create
(
hpvm_request_tensor
,
ArrayRef
<
Value
*>
(
Args
,
2
),
""
,
FI
);
""
,
FI
);
}
}
}
}
...
...
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