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
c5395a1f
Commit
c5395a1f
authored
Jan 05, 2017
by
tqchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose testcase as bound inference to python, now push toward the goal!
parent
54c18a6c
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
57 additions
and
5 deletions
+57
-5
python/tvm/_ctypes/_api.py
+2
-1
src/c_api/c_api_pass.cc
+7
-1
src/c_api/c_api_schedule.cc
+27
-0
src/schedule/bound.cc
+1
-1
src/schedule/bound.h
+1
-1
tests/python/test_bound_inference.py
+19
-0
tests/python/test_schedule.py
+0
-1
No files found.
python/tvm/_ctypes/_api.py
View file @
c5395a1f
...
...
@@ -239,7 +239,8 @@ def _init_function_module(root_namespace):
module_internal
=
sys
.
modules
[
"
%
s._function_internal"
%
root_namespace
]
namespace_match
=
{
"_make_"
:
sys
.
modules
[
"
%
s.make"
%
root_namespace
],
"_pass_"
:
sys
.
modules
[
"
%
s.ir_pass"
%
root_namespace
]
"_pass_"
:
sys
.
modules
[
"
%
s.ir_pass"
%
root_namespace
],
"_schedule_"
:
sys
.
modules
[
"
%
s.schedule"
%
root_namespace
]
}
for
name
in
op_names
:
...
...
src/c_api/c_api_pass.cc
View file @
c5395a1f
...
...
@@ -7,10 +7,10 @@
#include <tvm/ir.h>
#include <tvm/ir_pass.h>
#include "./c_api_registry.h"
#include "../schedule/bound.h"
namespace
tvm
{
namespace
ir
{
using
ArgStack
=
const
std
::
vector
<
APIVariantValue
>
;
using
RetValue
=
APIVariantValue
;
...
...
@@ -21,6 +21,12 @@ using RetValue = APIVariantValue;
*ret = PassName(args.at(0)); \
}) \
#define REGISTER_PASS2(PassName) \
TVM_REGISTER_API(_pass_## PassName) \
.set_body([](const ArgStack& args, RetValue *ret) { \
*ret = PassName(args.at(0), args.at(1)); \
}) \
#define REGISTER_PASS4(PassName) \
TVM_REGISTER_API(_pass_## PassName) \
.set_body([](const ArgStack& args, RetValue *ret) { \
...
...
src/c_api/c_api_schedule.cc
0 → 100644
View file @
c5395a1f
/*!
* Copyright (c) 2016 by Contributors
* Implementation of API functions related to schedule pass.
* \file c_api_lang.cc
*/
#include <tvm/expr.h>
#include <tvm/tensor.h>
#include <tvm/schedule.h>
#include "../schedule/bound.h"
#include "./c_api_registry.h"
namespace
tvm
{
namespace
schedule
{
using
ArgStack
=
const
std
::
vector
<
APIVariantValue
>
;
using
RetValue
=
APIVariantValue
;
#define REGISTER_SCHEDULE_PASS1(PassName) \
TVM_REGISTER_API(_schedule_## PassName) \
.set_body([](const ArgStack& args, RetValue *ret) { \
*ret = PassName(args.at(0)); \
}) \
REGISTER_SCHEDULE_PASS1
(
InferBound
);
}
// namespace schedule
}
// namespace tvm
src/schedule/bound.cc
View file @
c5395a1f
...
...
@@ -143,7 +143,7 @@ void InferBound(const Schedule& sch,
}
std
::
unordered_m
ap
<
IterVar
,
Range
>
InferBound
(
Schedule
sch
)
{
M
ap
<
IterVar
,
Range
>
InferBound
(
Schedule
sch
)
{
return
{};
}
...
...
src/schedule/bound.h
View file @
c5395a1f
...
...
@@ -19,7 +19,7 @@ namespace schedule {
* \param sch The root schedule to infer all the bounds.
* \return the result bound of the iteration Variable
*/
std
::
unordered_m
ap
<
IterVar
,
Range
>
InferBound
(
Schedule
sch
);
M
ap
<
IterVar
,
Range
>
InferBound
(
Schedule
sch
);
}
// namespace schedule
}
// namespace tvm
...
...
tests/python/test_bound_inference.py
0 → 100644
View file @
c5395a1f
import
tvm
def
test_bound_inference
():
m
=
tvm
.
Var
(
'm'
)
l
=
tvm
.
Var
(
'l'
)
A
=
tvm
.
placeholder
((
m
,
l
),
name
=
'A'
)
A1
=
tvm
.
compute
((
m
,
l
),
lambda
i
,
j
:
A
[
i
,
j
])
A2
=
tvm
.
compute
((
m
,
l
),
lambda
i
,
j
:
A1
[
i
,
j
]
+
3
)
sA1
=
tvm
.
Schedule
(
A1
.
op
)
sA2
=
tvm
.
Schedule
(
A2
.
op
)
xo
,
xi
=
sA1
.
split
(
A1
.
op
.
dim_var
[
0
],
factor
=
8
)
sA2
.
compute_at
(
sA1
,
xi
)
bounds
=
tvm
.
schedule
.
InferBound
(
sA1
)
assert
isinstance
(
bounds
,
tvm
.
collections
.
Map
)
print
(
bounds
)
if
__name__
==
"__main__"
:
test_bound_inference
()
tests/python/test_schedule.py
View file @
c5395a1f
...
...
@@ -48,4 +48,3 @@ if __name__ == "__main__":
test_schedule_create
()
test_reorder
()
test_tile
()
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