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
de02a203
Commit
de02a203
authored
Nov 05, 2018
by
Yizhi Liu
Committed by
Tianqi Chen
Nov 05, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
print import_llvm ir in tensorize tutorial (#2064)
parent
c91ded32
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
tutorials/language/tensorize.py
+10
-5
No files found.
tutorials/language/tensorize.py
View file @
de02a203
...
@@ -154,6 +154,12 @@ def gemv_impl():
...
@@ -154,6 +154,12 @@ def gemv_impl():
# The importing needs to happen before the tensorized GEMV being executed.
# The importing needs to happen before the tensorized GEMV being executed.
#
#
s
[
C
]
.
pragma
(
x
,
"import_llvm"
,
gemv_impl
())
s
[
C
]
.
pragma
(
x
,
"import_llvm"
,
gemv_impl
())
print
(
tvm
.
lower
(
s
,
[
A
,
B
,
C
],
simple_mode
=
True
))
######################################################################
# Finally we compare the tensorize version with that :code:`numpy.dot` produces,
# ensure our implementation is correct.
#
func
=
tvm
.
build
(
s
,
[
A
,
B
,
C
],
target
=
"llvm"
,
name
=
"gemv"
)
func
=
tvm
.
build
(
s
,
[
A
,
B
,
C
],
target
=
"llvm"
,
name
=
"gemv"
)
from
topi.util
import
get_const_tuple
from
topi.util
import
get_const_tuple
...
@@ -166,12 +172,11 @@ func(tvm.nd.array(a, ctx), tvm.nd.array(b, ctx), c)
...
@@ -166,12 +172,11 @@ func(tvm.nd.array(a, ctx), tvm.nd.array(b, ctx), c)
tvm
.
testing
.
assert_allclose
(
c
.
asnumpy
(),
np
.
dot
(
a
,
b
.
T
),
rtol
=
1e-3
)
tvm
.
testing
.
assert_allclose
(
c
.
asnumpy
(),
np
.
dot
(
a
,
b
.
T
),
rtol
=
1e-3
)
######################################################################
######################################################################
# We compare the tensorize version with that :code:`numpy.dot` produces,
# ensure our implementation is correct.
#
# Reduce-update for Tensorize
# Reduce-update for Tensorize
# ------------------------------------
# ---------------------------
# Let's then move one step forward.
# So far you have learned the basic idea of tensorize,
# now let's move one step forward to a more complicated case.
#
# Assume our accelerator could only multiply a vector by a square matrix,
# Assume our accelerator could only multiply a vector by a square matrix,
# in which the vector size needs to be no larger than 16.
# in which the vector size needs to be no larger than 16.
# Given such hardware constrain, now we need to split the reduce axis as following,
# Given such hardware constrain, now we need to split the reduce axis as following,
...
...
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