Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tvm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cld
ml
tvm
Commits
de02a203
Commit
de02a203
authored
6 years ago
by
Yizhi Liu
Committed by
Tianqi Chen
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
print import_llvm ir in tensorize tutorial (#2064)
parent
c91ded32
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tutorials/language/tensorize.py
+10
-5
10 additions, 5 deletions
tutorials/language/tensorize.py
with
10 additions
and
5 deletions
tutorials/language/tensorize.py
+
10
−
5
View file @
de02a203
...
...
@@ -154,6 +154,12 @@ def gemv_impl():
# The importing needs to happen before the tensorized GEMV being executed.
#
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
"
)
from
topi.util
import
get_const_tuple
...
...
@@ -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
)
######################################################################
# We compare the tensorize version with that :code:`numpy.dot` produces,
# ensure our implementation is correct.
#
# 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,
# 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,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment