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
adf4bfef
Commit
adf4bfef
authored
Nov 19, 2016
by
tqchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable attribute key in LetStmt
parent
38f03f1f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
34 additions
and
8 deletions
+34
-8
HalideIR
+1
-1
Makefile
+0
-1
python/tvm/stmt.py
+1
-3
src/c_api/c_api_ir.cc
+17
-1
src/c_api/c_api_registry.h
+3
-0
tests/python/test_basic.py
+12
-2
No files found.
HalideIR
@
7f1d8119
Subproject commit
24a7c0357a6a8db5db782d320aad7f706ebe8507
Subproject commit
7f1d811972bccc26f651ea2289d88bcadea9fe9f
Makefile
View file @
adf4bfef
export
CXX
=
g++
export
LDFLAGS
=
-pthread
-lm
export
CFLAGS
=
-std
=
c++11
-Wall
-O2
-Wno-unknown-pragmas
-funroll-loops
\
-Iinclude
-Idmlc-core
/include
-IHalideIR
/src
-fPIC
...
...
python/tvm/stmt.py
View file @
adf4bfef
from
__future__
import
absolute_import
as
_abs
from
._ctypes._api
import
NodeBase
,
register_node
from
.
import
function
as
_func
from
.
import
make
as
_make
class
Stmt
(
NodeBase
):
def
__repr__
(
self
):
return
_func
.
format_str
(
self
)
pass
@register_node
class
LetStmt
(
Stmt
):
...
...
src/c_api/c_api_ir.cc
View file @
adf4bfef
...
...
@@ -56,6 +56,23 @@ TVM_REGISTER_API(_make_Allocate)
args
.
at
(
4
));
});
TVM_REGISTER_API
(
_make_LetStmt
)
.
set_body
([](
const
ArgStack
&
args
,
RetValue
*
ret
)
{
if
(
args
.
size
()
==
3
)
{
*
ret
=
LetStmt
::
make
(
args
.
at
(
0
),
args
.
at
(
1
),
args
.
at
(
2
));
}
else
{
CHECK_EQ
(
args
.
size
(),
5
);
*
ret
=
LetStmt
::
make
(
args
.
at
(
0
),
args
.
at
(
1
),
args
.
at
(
2
),
args
.
at
(
3
),
args
.
at
(
4
));
}
});
// make from two arguments
#define REGISTER_MAKE1(Node) \
TVM_REGISTER_API(_make_## Node) \
...
...
@@ -109,7 +126,6 @@ REGISTER_MAKE3(Select);
REGISTER_MAKE3
(
Ramp
);
REGISTER_MAKE2
(
Broadcast
);
REGISTER_MAKE3
(
Let
);
REGISTER_MAKE3
(
LetStmt
);
REGISTER_MAKE2
(
AssertStmt
);
REGISTER_MAKE3
(
ProducerConsumer
);
REGISTER_MAKE3
(
Store
);
...
...
src/c_api/c_api_registry.h
View file @
adf4bfef
...
...
@@ -97,6 +97,9 @@ class APIVariantValue {
inline
operator
T
()
const
{
if
(
type_id
==
kNull
)
return
T
();
CHECK_EQ
(
type_id
,
kNodeHandle
);
// use dynamic RTTI for safety
CHECK
(
dynamic_cast
<
typename
T
::
ContainerType
*>
(
sptr
.
get
()))
<<
"wrong type specified"
;
return
T
(
sptr
);
}
inline
operator
Expr
()
const
{
...
...
tests/python/test_basic.py
View file @
adf4bfef
...
...
@@ -18,6 +18,15 @@ def test_ir():
stmt
=
tvm
.
make
.
Evaluate
(
z
)
assert
isinstance
(
stmt
,
tvm
.
stmt
.
Evaluate
)
def
test_let
():
x
=
tvm
.
Var
(
'x'
)
y
=
tvm
.
Var
(
'y'
)
stmt
=
tvm
.
make
.
LetStmt
(
x
,
10
,
tvm
.
make
.
Evaluate
(
x
+
1
),
y
,
"stride"
)
assert
stmt
.
attr_of_node
==
y
print
(
stmt
)
def
test_basic
():
a
=
tvm
.
Var
(
'a'
)
b
=
tvm
.
Var
(
'b'
)
...
...
@@ -28,10 +37,10 @@ def test_array():
a
=
tvm
.
convert
([
1
,
2
,
3
])
def
test_stmt
():
x
=
tvm
.
make
.
Evaluate
(
0
)
tvm
.
make
.
For
(
tvm
.
Var
(
'i'
),
0
,
1
,
tvm
.
stmt
.
For
.
Serial
,
0
,
tvm
.
make
.
Evaluate
(
0
))
x
)
if
__name__
==
"__main__"
:
...
...
@@ -40,3 +49,4 @@ if __name__ == "__main__":
test_ir
()
test_basic
()
test_stmt
()
test_let
()
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