Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyuanbo
tic
Commits
36f20b54
Commit
36f20b54
authored
Jul 16, 2017
by
Tianqi Chen
Committed by
GitHub
Jul 16, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PASS] Add storage alignment info to heap allocated data (#254)
parent
204e9cb4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
8 deletions
+19
-8
src/pass/lower_packed_call.cc
+6
-1
src/runtime/thread_storage_scope.h
+13
-7
No files found.
src/pass/lower_packed_call.cc
View file @
36f20b54
...
...
@@ -110,7 +110,12 @@ class PackedCallBuilder : public IRMutator {
op
->
buffer_var
},
Call
::
Extern
);
Stmt
free_stmt
=
IfThenElse
::
make
(
free_op
!=
make_zero
(
Int
(
32
)),
throw_last_error
);
return
Block
::
make
(
alloca
,
free_stmt
);
body
=
Block
::
make
(
alloca
,
free_stmt
);
body
=
AttrStmt
::
make
(
op
->
buffer_var
,
attr
::
storage_alignment
,
make_const
(
Int
(
32
),
runtime
::
kTempAllocaAlignment
),
body
);
return
body
;
}
Stmt
Mutate_
(
const
AttrStmt
*
op
,
const
Stmt
&
s
)
final
{
...
...
src/runtime/thread_storage_scope.h
View file @
36f20b54
...
...
@@ -17,18 +17,21 @@ namespace runtime {
struct
StorageScope
{
/*! \brief The rank of the storage */
int
rank
{
0
};
/*! \brief tag for special memory, if any */
std
::
string
tag
;
// comparator
inline
bool
operator
==
(
const
StorageScope
&
other
)
const
{
return
rank
==
other
.
rank
;
return
rank
==
other
.
rank
&&
tag
==
other
.
tag
;
}
inline
bool
operator
!=
(
const
StorageScope
&
other
)
const
{
return
!
(
*
this
==
other
);
}
inline
std
::
string
to_string
()
const
{
std
::
string
ret
;
switch
(
rank
)
{
case
0
:
return
"global"
;
case
1
:
return
"shared"
;
case
2
:
return
"local"
;
case
0
:
return
"global"
+
tag
;
case
1
:
return
"shared"
+
tag
;
case
2
:
return
"local"
+
tag
;
default
:
LOG
(
FATAL
)
<<
"unknown storage scope"
;
return
""
;
}
}
...
...
@@ -39,12 +42,15 @@ struct StorageScope {
*/
static
StorageScope
make
(
const
std
::
string
&
s
)
{
StorageScope
r
;
if
(
s
==
"global"
)
{
if
(
s
.
compare
(
0
,
6
,
"global"
)
==
0
)
{
r
.
rank
=
0
;
}
else
if
(
s
==
"shared"
)
{
r
.
tag
=
s
.
substr
(
6
,
std
::
string
::
npos
);
}
else
if
(
s
.
compare
(
0
,
6
,
"shared"
)
==
0
)
{
r
.
rank
=
1
;
}
else
if
(
s
==
"local"
)
{
r
.
tag
=
s
.
substr
(
6
,
std
::
string
::
npos
);
}
else
if
(
s
.
compare
(
0
,
5
,
"local"
)
==
0
)
{
r
.
rank
=
2
;
r
.
tag
=
s
.
substr
(
5
,
std
::
string
::
npos
);
}
else
{
LOG
(
FATAL
)
<<
"unknown storage scope "
<<
s
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment