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
9f469dcf
Commit
9f469dcf
authored
5 years ago
by
Akash Kothari
Browse files
Options
Downloads
Patches
Plain Diff
Updating with apt changes to function declaration types to Function Callee
parent
456dd2b6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hpvm/lib/Transforms/DFG2LLVM_X86/DFG2LLVM_X86.cpp
+45
-53
45 additions, 53 deletions
hpvm/lib/Transforms/DFG2LLVM_X86/DFG2LLVM_X86.cpp
with
45 additions
and
53 deletions
hpvm/lib/Transforms/DFG2LLVM_X86/DFG2LLVM_X86.cpp
+
45
−
53
View file @
9f469dcf
...
...
@@ -73,29 +73,29 @@ class CGT_X86 : public CodeGenTraversal {
private:
//Member variables
Constant
*
malloc
;
FunctionCallee
malloc
;
// VISC Runtime API
Constant
*
llvm_visc_x86_launch
;
Constant
*
llvm_visc_x86_wait
;
Constant
*
llvm_visc_x86_argument_ptr
;
Constant
*
llvm_visc_streamLaunch
;
Constant
*
llvm_visc_streamPush
;
Constant
*
llvm_visc_streamPop
;
Constant
*
llvm_visc_streamWait
;
Constant
*
llvm_visc_createBindInBuffer
;
Constant
*
llvm_visc_createBindOutBuffer
;
Constant
*
llvm_visc_createEdgeBuffer
;
Constant
*
llvm_visc_createLastInputBuffer
;
Constant
*
llvm_visc_createThread
;
FunctionCallee
llvm_visc_x86_launch
;
FunctionCallee
llvm_visc_x86_wait
;
FunctionCallee
llvm_visc_x86_argument_ptr
;
FunctionCallee
llvm_visc_streamLaunch
;
FunctionCallee
llvm_visc_streamPush
;
FunctionCallee
llvm_visc_streamPop
;
FunctionCallee
llvm_visc_streamWait
;
FunctionCallee
llvm_visc_createBindInBuffer
;
FunctionCallee
llvm_visc_createBindOutBuffer
;
FunctionCallee
llvm_visc_createEdgeBuffer
;
FunctionCallee
llvm_visc_createLastInputBuffer
;
FunctionCallee
llvm_visc_createThread
;
//Constant* llvm_visc_freeThreads;
Constant
*
llvm_visc_bufferPush
;
Constant
*
llvm_visc_bufferPop
;
Constant
*
llvm_visc_x86_dstack_push
;
Constant
*
llvm_visc_x86_dstack_pop
;
Constant
*
llvm_visc_x86_getDimLimit
;
Constant
*
llvm_visc_x86_getDimInstance
;
FunctionCallee
llvm_visc_bufferPush
;
FunctionCallee
llvm_visc_bufferPop
;
FunctionCallee
llvm_visc_x86_dstack_push
;
FunctionCallee
llvm_visc_x86_dstack_pop
;
FunctionCallee
llvm_visc_x86_getDimLimit
;
FunctionCallee
llvm_visc_x86_getDimInstance
;
//Functions
std
::
vector
<
IntrinsicInst
*>*
getUseList
(
Value
*
LI
);
Value
*
addLoop
(
Instruction
*
I
,
Value
*
limit
,
const
Twine
&
indexName
=
""
);
...
...
@@ -227,17 +227,16 @@ void CGT_X86::initRuntimeAPI() {
initializeTimerSet
(
I
);
switchToTimer
(
visc_TimerID_NONE
,
I
);
// Insert code for initializing the sceduling policy
Function
*
IP
=
cast
<
Function
>
(
M
.
getOrInsertFunction
(
"llvm_visc_policy_init"
,
runtimeModule
->
getFunction
(
"llvm_visc_policy_init"
)
->
getFunctionType
())
)
;
Function
Callee
IP
=
M
.
getOrInsertFunction
(
"llvm_visc_policy_init"
,
runtimeModule
->
getFunction
(
"llvm_visc_policy_init"
)
->
getFunctionType
());
CallInst
*
IPCallInst
=
CallInst
::
Create
(
IP
,
ArrayRef
<
Value
*>
(),
""
,
I
);
DEBUG
(
errs
()
<<
*
IPCallInst
<<
"
\n
"
);
// If device abstraction is enabled, we add a runtime call to start the
// device status simulation
if
(
DeviceAbstraction
)
{
Function
*
ID
=
cast
<
Function
>
(
M
.
getOrInsertFunction
(
"llvm_visc_deviceAbstraction_start"
,
runtimeModule
->
getFunction
(
"llvm_visc_deviceAbstraction_start"
)
->
getFunctionType
()));
FunctionCallee
ID
=
M
.
getOrInsertFunction
(
"llvm_visc_deviceAbstraction_start"
,
runtimeModule
->
getFunction
(
"llvm_visc_deviceAbstraction_start"
)
->
getFunctionType
());
CallInst
*
IDCallInst
=
CallInst
::
Create
(
ID
,
ArrayRef
<
Value
*>
(),
""
,
I
);
DEBUG
(
errs
()
<<
*
IDCallInst
<<
"
\n
"
);
}
...
...
@@ -248,8 +247,8 @@ void CGT_X86::initRuntimeAPI() {
// Insert code for clearing the sceduling policy
I
=
cast
<
Instruction
>
(
*
VC
->
user_begin
());
IP
=
cast
<
Function
>
(
M
.
getOrInsertFunction
(
"llvm_visc_policy_clear"
,
runtimeModule
->
getFunction
(
"llvm_visc_policy_clear"
)
->
getFunctionType
())
)
;
IP
=
M
.
getOrInsertFunction
(
"llvm_visc_policy_clear"
,
runtimeModule
->
getFunction
(
"llvm_visc_policy_clear"
)
->
getFunctionType
());
IPCallInst
=
CallInst
::
Create
(
IP
,
ArrayRef
<
Value
*>
(),
""
,
I
);
errs
()
<<
*
IPCallInst
<<
"
\n
"
;
...
...
@@ -259,9 +258,8 @@ void CGT_X86::initRuntimeAPI() {
// If device abstraction is enabled, we add a runtime call to end the
// device status simulation
if
(
DeviceAbstraction
)
{
Function
*
ID
=
cast
<
Function
>
(
M
.
getOrInsertFunction
(
"llvm_visc_deviceAbstraction_end"
,
runtimeModule
->
getFunction
(
"llvm_visc_deviceAbstraction_end"
)
->
getFunctionType
()));
FunctionCallee
ID
=
M
.
getOrInsertFunction
(
"llvm_visc_deviceAbstraction_end"
,
runtimeModule
->
getFunction
(
"llvm_visc_deviceAbstraction_end"
)
->
getFunctionType
());
CallInst
*
IDCallInst
=
CallInst
::
Create
(
ID
,
ArrayRef
<
Value
*>
(),
""
,
I
);
DEBUG
(
errs
()
<<
*
IDCallInst
<<
"
\n
"
);
}
...
...
@@ -277,14 +275,7 @@ std::vector<IntrinsicInst*>* CGT_X86::getUseList(Value* GraphID) {
ue
=
GraphID
->
user_end
();
ui
!=
ue
;
++
ui
)
{
if
(
IntrinsicInst
*
waitI
=
dyn_cast
<
IntrinsicInst
>
(
*
ui
))
{
UseList
->
push_back
(
waitI
);
}
//else if (PHINode* PN = dyn_cast<PHINode>(*ui)){
//errs() << "Found PhiNode use of graphID\n";
//std::vector<IntrinsicInst*>* phiUseList = getUseList(PN);
//UseList->insert(UseList->end(), phiUseList->begin(), phiUseList->end());
//free(phiUseList);
//}
else
{
}
else
{
llvm_unreachable
(
"Error: Operation on Graph ID not supported!
\n
"
);
}
}
...
...
@@ -584,7 +575,8 @@ Function* CGT_X86::createLaunchFunction(DFInternalNode* N) {
DEBUG
(
errs
()
<<
"Generating Code for Streaming Launch Function
\n
"
);
// Give a name to the argument which is used pass data to this thread
Argument
*
data
=
&*
LaunchFunc
->
arg_begin
();
Argument
*
graphID
=
&*
(
++
LaunchFunc
->
arg_begin
());
// NOTE-HS: Check correctness with Maria
Argument
*
graphID
=
&*
(
LaunchFunc
->
arg_begin
()
+
1
);
data
->
setName
(
"data.addr"
);
graphID
->
setName
(
"graphID"
);
// Add a basic block to this empty function and a return null statement to it
...
...
@@ -1508,10 +1500,10 @@ void CGT_X86::codeGen(DFInternalNode* N) {
// its first statement
BasicBlock
*
BB
=
&*
NodeGenFunc
->
begin
();
std
::
vector
<
Value
*>
Args
;
// TODO: add the device type as argument?
Function
*
RTF
=
cast
<
Function
>
(
M
.
getOrInsertFunction
(
"llvm_visc_deviceAbstraction_waitOnDeviceStatus"
,
runtimeModule
->
getFunction
(
"llvm_visc_deviceAbstraction_waitOnDeviceStatus"
)
->
getFunctionType
())
)
;
CallInst
*
RTFInst
=
CallInst
::
Create
(
RTF
,
Args
,
""
,
BB
->
getFirstNonPHI
());
Function
Callee
RTF
=
M
.
getOrInsertFunction
(
"llvm_visc_deviceAbstraction_waitOnDeviceStatus"
,
runtimeModule
->
getFunction
(
"llvm_visc_deviceAbstraction_waitOnDeviceStatus"
)
->
getFunctionType
());
CallInst
*
RTFInst
=
CallInst
::
Create
(
RTF
,
Args
,
""
,
BB
->
getFirstNonPHI
());
}
}
...
...
@@ -1606,7 +1598,7 @@ void CGT_X86::codeGen(DFInternalNode* N) {
NameV
.
push_back
(
ConstantInt
::
get
(
Type
::
getInt8Ty
(
M
.
getContext
()),
'\0'
));
ArrayType
*
NameType
=
ArrayType
::
get
(
IntegerType
::
get
(
M
.
getContext
(),
8
),
nameSize
);
AllocaInst
*
AI
=
new
AllocaInst
(
NameType
,
nullptr
,
""
,
BBcurrent
);
AllocaInst
*
AI
=
new
AllocaInst
(
NameType
,
0
,
nullptr
,
""
,
BBcurrent
);
Constant
*
NameConst
=
ConstantArray
::
get
(
NameType
,
NameV
);
StoreInst
*
StI
=
new
StoreInst
(
NameConst
,
AI
,
BBcurrent
);
CastInst
*
BI
=
BitCastInst
::
CreatePointerCast
(
AI
,
...
...
@@ -1614,9 +1606,9 @@ void CGT_X86::codeGen(DFInternalNode* N) {
std
::
vector
<
Value
*>
Args
;
Args
.
push_back
(
BI
);
Args
.
push_back
(
ConstantInt
::
get
(
Type
::
getInt64Ty
(
M
.
getContext
()),
-
1
,
true
));
Function
*
RTF
=
cast
<
Function
>
(
M
.
getOrInsertFunction
(
"llvm_visc_policy_getVersion"
,
runtimeModule
->
getFunction
(
"llvm_visc_policy_getVersion"
)
->
getFunctionType
())
)
;
Function
Callee
RTF
=
M
.
getOrInsertFunction
(
"llvm_visc_policy_getVersion"
,
runtimeModule
->
getFunction
(
"llvm_visc_policy_getVersion"
)
->
getFunctionType
());
CallInst
*
RTFInst
=
CallInst
::
Create
(
RTF
,
Args
,
""
,
BBcurrent
);
ConstantInt
*
CmpConst
=
...
...
@@ -1651,9 +1643,9 @@ void CGT_X86::codeGen(DFInternalNode* N) {
if
(
DeviceAbstraction
)
{
// Prepare arguments and function for call to wait for device runtime call
std
::
vector
<
Value
*>
Args
;
// TODO: add the device type as argument?
Function
*
RTF
=
cast
<
Function
>
(
M
.
getOrInsertFunction
(
"llvm_visc_deviceAbstraction_waitOnDeviceStatus"
,
runtimeModule
->
getFunction
(
"llvm_visc_deviceAbstraction_waitOnDeviceStatus"
)
->
getFunctionType
())
)
;
Function
Callee
RTF
=
M
.
getOrInsertFunction
(
"llvm_visc_deviceAbstraction_waitOnDeviceStatus"
,
runtimeModule
->
getFunction
(
"llvm_visc_deviceAbstraction_waitOnDeviceStatus"
)
->
getFunctionType
());
CallInst
*
RTFInst
=
CallInst
::
Create
(
RTF
,
Args
,
""
,
GenFuncCI
);
}
}
...
...
@@ -1677,8 +1669,8 @@ void CGT_X86::codeGen(DFInternalNode* N) {
// Prepare arguments and function for call to wait for device runtime call
std
::
vector
<
Value
*>
Args
;
// TODO: add the device type as argument?
Function
*
RTF
=
cast
<
Function
>
(
M
.
getOrInsertFunction
(
"llvm_visc_deviceAbstraction_waitOnDeviceStatus"
,
runtimeModule
->
getFunction
(
"llvm_visc_deviceAbstraction_waitOnDeviceStatus"
)
->
getFunctionType
())
)
;
M
.
getOrInsertFunction
(
"llvm_visc_deviceAbstraction_waitOnDeviceStatus"
,
runtimeModule
->
getFunction
(
"llvm_visc_deviceAbstraction_waitOnDeviceStatus"
)
->
getFunctionType
());
CallInst
*
RTFInst
=
CallInst
::
Create
(
RTF
,
Args
,
""
,
GenFuncCI
);
}
}
...
...
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