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
617a9860
Commit
617a9860
authored
3 years ago
by
Aaron Councilman
Browse files
Options
Downloads
Patches
Plain Diff
Fix for computations in loop bound
parent
5e569b6d
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
hpvm/projects/hetero-c++/lib/HCCVerifier.cpp
+14
-8
14 additions, 8 deletions
hpvm/projects/hetero-c++/lib/HCCVerifier.cpp
hpvm/projects/hetero-c++/test/integration/src/test.cc
+28
-0
28 additions, 0 deletions
hpvm/projects/hetero-c++/test/integration/src/test.cc
with
42 additions
and
8 deletions
hpvm/projects/hetero-c++/lib/HCCVerifier.cpp
+
14
−
8
View file @
617a9860
...
@@ -526,7 +526,9 @@ bool HCCVerifier::verifyUses(RegionTree& region, std::set<Value*> inputs,
...
@@ -526,7 +526,9 @@ bool HCCVerifier::verifyUses(RegionTree& region, std::set<Value*> inputs,
&&
"verifyUses() requires outerInputs for loops"
);
&&
"verifyUses() requires outerInputs for loops"
);
if
(
region
.
contains
.
empty
())
{
if
(
region
.
contains
.
empty
())
{
// A region with code in it, so actually check the operands used
// A region with code in it, so actually check the operands used
std
::
set
<
Instruction
*>
outsideValues
;
// Track the values from outside the region used in it (and track in the
// bool whether the value is used by the loop condition for parallel loops)
std
::
set
<
std
::
pair
<
Instruction
*
,
bool
>>
outsideValues
;
Instruction
*
start
=
region
.
start
->
getNextNonDebugInstruction
();
Instruction
*
start
=
region
.
start
->
getNextNonDebugInstruction
();
Instruction
*
end
=
region
.
end
;
Instruction
*
end
=
region
.
end
;
...
@@ -576,7 +578,7 @@ bool HCCVerifier::verifyUses(RegionTree& region, std::set<Value*> inputs,
...
@@ -576,7 +578,7 @@ bool HCCVerifier::verifyUses(RegionTree& region, std::set<Value*> inputs,
// side-effect free and don't touch memory, because these are the
// side-effect free and don't touch memory, because these are the
// only ones that are safe to then rematerialize in the task
// only ones that are safe to then rematerialize in the task
// (possibly in multiple tasks or multiple iterations)
// (possibly in multiple tasks or multiple iterations)
outsideValues
.
insert
(
in
st
);
outsideValues
.
insert
(
st
d
::
make_pair
(
inst
,
isLoopCond
)
);
}
else
{
}
else
{
errors
=
true
;
errors
=
true
;
reportErrorOnInst
(
"Cannot use value defined outside of this "
reportErrorOnInst
(
"Cannot use value defined outside of this "
...
@@ -602,14 +604,17 @@ bool HCCVerifier::verifyUses(RegionTree& region, std::set<Value*> inputs,
...
@@ -602,14 +604,17 @@ bool HCCVerifier::verifyUses(RegionTree& region, std::set<Value*> inputs,
}
}
// Convert to a vector so we can add elements to it as we traverse
// Convert to a vector so we can add elements to it as we traverse
std
::
vector
<
Instruction
*>
values
(
outsideValues
.
begin
(),
outsideValues
.
end
());
std
::
vector
<
std
::
pair
<
Instruction
*
,
bool
>>
values
(
outsideValues
.
begin
(),
outsideValues
.
end
());
// We now process all of the operands that are values from instructions
// We now process all of the operands that are values from instructions
// outside of the region or that otherwise come from outside of the region.
// outside of the region or that otherwise come from outside of the region.
for
(
unsigned
int
i
=
0
;
i
<
values
.
size
();
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
values
.
size
();
i
++
)
{
Instruction
*
inst
=
values
[
i
];
Instruction
*
inst
=
values
[
i
].
first
;
bool
isLoopCond
=
values
[
i
].
second
;
for
(
Value
*
op
:
inst
->
operands
())
{
for
(
Value
*
op
:
inst
->
operands
())
{
if
(
inputs
.
find
(
op
)
==
inputs
.
end
())
{
if
(
inputs
.
find
(
op
)
==
inputs
.
end
()
&&
(
!
isLoopCond
||
outerInputs
->
find
(
op
)
==
outerInputs
->
end
()))
{
Instruction
*
ins
=
dyn_cast
<
Instruction
>
(
op
);
Instruction
*
ins
=
dyn_cast
<
Instruction
>
(
op
);
Constant
*
const_
=
dyn_cast
<
Constant
>
(
op
);
Constant
*
const_
=
dyn_cast
<
Constant
>
(
op
);
BasicBlock
*
block
=
dyn_cast
<
BasicBlock
>
(
op
);
BasicBlock
*
block
=
dyn_cast
<
BasicBlock
>
(
op
);
...
@@ -620,10 +625,11 @@ bool HCCVerifier::verifyUses(RegionTree& region, std::set<Value*> inputs,
...
@@ -620,10 +625,11 @@ bool HCCVerifier::verifyUses(RegionTree& region, std::set<Value*> inputs,
&&
!
ins
->
mayReadOrWriteMemory
())
{
&&
!
ins
->
mayReadOrWriteMemory
())
{
// Add to the list to verify, to make sure that all operands these
// Add to the list to verify, to make sure that all operands these
// instructions depend on satisfy these properties
// instructions depend on satisfy these properties
auto
f
=
outsideValues
.
find
(
ins
);
std
::
pair
<
Instruction
*
,
bool
>
pair
=
std
::
make_pair
(
ins
,
isLoopCond
);
auto
f
=
outsideValues
.
find
(
pair
);
if
(
f
==
outsideValues
.
end
())
{
if
(
f
==
outsideValues
.
end
())
{
outsideValues
.
insert
(
ins
);
outsideValues
.
insert
(
pair
);
values
.
push_back
(
ins
);
values
.
push_back
(
pair
);
}
}
}
else
{
}
else
{
errors
=
true
;
errors
=
true
;
...
...
This diff is collapsed.
Click to expand it.
hpvm/projects/hetero-c++/test/integration/src/test.cc
0 → 100644
+
28
−
0
View file @
617a9860
#include
<stdlib.h>
#include
<stdio.h>
#include
"heterocc.h"
void
dummy
(
size_t
bytes_prod
,
size_t
matrix_dim
)
{
void
*
Section
=
__hetero_section_begin
();
int
loop_size
=
matrix_dim
/
sizeof
(
int
);
for
(
int
i
=
0
;
i
<
loop_size
;
++
i
){
__hetero_parallel_loop
(
/* Number of parallel enclosing loops */
1
,
/* Number of Input Buffer Pairs */
1
,
bytes_prod
,
/* Number of Output Buffer Pairs */
1
,
bytes_prod
);
printf
(
"success"
);
}
__hetero_section_end
(
Section
);
}
int
main
()
{
size_t
x
=
3
,
y
=
7
;
auto
l
=
__hetero_launch
((
void
*
)
dummy
,
2
,
x
,
y
,
0
);
__hetero_wait
(
l
);
return
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