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
93057c8a
Commit
93057c8a
authored
Apr 17, 2017
by
Tianqi Chen
Committed by
GitHub
Apr 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[BUILD] add with_api_wrapper to lower (#95)
parent
3b8ad0a2
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
8 deletions
+14
-8
python/tvm/build.py
+11
-4
src/schedule/schedule_dataflow_rewrite.cc
+1
-1
src/schedule/schedule_ops.cc
+1
-1
tutorials/python/get_started.py
+1
-2
No files found.
python/tvm/build.py
View file @
93057c8a
...
@@ -12,10 +12,12 @@ from . import ir_pass
...
@@ -12,10 +12,12 @@ from . import ir_pass
from
.
import
collections
from
.
import
collections
from
.
import
codegen
from
.
import
codegen
def
lower
(
sch
,
def
lower
(
sch
,
args
,
args
,
name
=
"default_function"
,
name
=
"default_function"
,
binds
=
None
,
binds
=
None
,
with_api_wrapper
=
True
,
max_auto_unroll_step
=
8
):
max_auto_unroll_step
=
8
):
"""Lowering step before build into target.
"""Lowering step before build into target.
...
@@ -34,13 +36,17 @@ def lower(sch,
...
@@ -34,13 +36,17 @@ def lower(sch,
Dictionary that maps the binding of symbolic buffer to Tensor.
Dictionary that maps the binding of symbolic buffer to Tensor.
By default, a new buffer is created for each tensor in the argument.
By default, a new buffer is created for each tensor in the argument.
with_api_wrapper : bool, optional
Whether add API wrapper during lowering.
max_auto_unroll_step: int, optional
max_auto_unroll_step: int, optional
Maximum step to perform automatic unrolling
Maximum step to perform automatic unrolling
Returns
Returns
-------
-------
f : LoweredFunc
f : LoweredFunc or Stmt
The result function.
The result function, if with_api_wrapper=False
Then the Stmt before make api is returned.
"""
"""
binds
=
{}
if
binds
is
None
else
binds
.
copy
()
binds
=
{}
if
binds
is
None
else
binds
.
copy
()
arg_list
=
[]
arg_list
=
[]
...
@@ -67,8 +73,9 @@ def lower(sch,
...
@@ -67,8 +73,9 @@ def lower(sch,
stmt
=
ir_pass
.
LiftAllocate
(
stmt
)
stmt
=
ir_pass
.
LiftAllocate
(
stmt
)
stmt
=
ir_pass
.
UnrollLoop
(
stmt
,
max_auto_unroll_step
)
stmt
=
ir_pass
.
UnrollLoop
(
stmt
,
max_auto_unroll_step
)
stmt
=
ir_pass
.
Simplify
(
stmt
)
stmt
=
ir_pass
.
Simplify
(
stmt
)
fapi
=
ir_pass
.
MakeAPI
(
stmt
,
name
,
arg_list
,
0
)
if
not
with_api_wrapper
:
return
fapi
return
stmt
return
ir_pass
.
MakeAPI
(
stmt
,
name
,
arg_list
,
0
)
def
build
(
sch
,
def
build
(
sch
,
...
...
src/schedule/schedule_dataflow_rewrite.cc
View file @
93057c8a
...
@@ -170,7 +170,7 @@ void RebaseNonZeroMinLoop(const Schedule& sch) {
...
@@ -170,7 +170,7 @@ void RebaseNonZeroMinLoop(const Schedule& sch) {
if
(
idx
<
leaf_vars
->
data
.
size
())
{
if
(
idx
<
leaf_vars
->
data
.
size
())
{
// insert rebase
// insert rebase
IterVar
rebased
=
IterVarNode
::
make
(
IterVar
rebased
=
IterVarNode
::
make
(
Range
(),
iv
->
var
.
copy_with_suffix
(
"
.rb
"
),
iv
->
iter_type
);
Range
(),
iv
->
var
.
copy_with_suffix
(
""
),
iv
->
iter_type
);
s
->
relations
.
push_back
(
RebaseNode
::
make
(
iv
,
rebased
));
s
->
relations
.
push_back
(
RebaseNode
::
make
(
iv
,
rebased
));
leaf_vars
->
data
[
idx
]
=
rebased
.
node_
;
leaf_vars
->
data
[
idx
]
=
rebased
.
node_
;
rebase_map
[
iv
]
=
rebased
;
rebase_map
[
iv
]
=
rebased
;
...
...
src/schedule/schedule_ops.cc
View file @
93057c8a
...
@@ -162,7 +162,7 @@ class SchedulePostProc : public IRMutator {
...
@@ -162,7 +162,7 @@ class SchedulePostProc : public IRMutator {
// delete duplicated thread extent attr
// delete duplicated thread extent attr
auto
it
=
thread_extent_scope_
.
find
(
op
->
node
.
get
());
auto
it
=
thread_extent_scope_
.
find
(
op
->
node
.
get
());
if
(
it
!=
thread_extent_scope_
.
end
())
{
if
(
it
!=
thread_extent_scope_
.
end
())
{
CHECK
(
is_zero
(
ir
::
Simplify
(
it
->
second
-
op
->
value
)));
CHECK
(
is_zero
(
ir
::
Simplify
(
it
->
second
-
op
->
value
)));
return
this
->
Mutate
(
op
->
body
);
return
this
->
Mutate
(
op
->
body
);
}
else
{
}
else
{
thread_extent_scope_
[
op
->
node
.
get
()]
=
op
->
value
;
thread_extent_scope_
[
op
->
node
.
get
()]
=
op
->
value
;
...
...
tutorials/python/get_started.py
View file @
93057c8a
...
@@ -17,8 +17,7 @@ import numpy as np
...
@@ -17,8 +17,7 @@ import numpy as np
# Vector Add Example
# Vector Add Example
# ------------------
# ------------------
# In this tutorial, we will use a vector addition example to demonstrate
# In this tutorial, we will use a vector addition example to demonstrate
# the workflow in TVM. We will demonstrate how we can describe and compile
# the workflow.
# vector addition code that runs on GPU.
#
#
######################################################################
######################################################################
...
...
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