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
8ba9e8bc
Commit
8ba9e8bc
authored
Dec 18, 2019
by
Haichen Shen
Committed by
Yao Wang
Dec 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TOPI] Allow batch matmul to be fused into injective ops (#4537)
parent
e274e66e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
19 deletions
+26
-19
topi/python/topi/x86/batch_matmul.py
+26
-19
No files found.
topi/python/topi/x86/batch_matmul.py
View file @
8ba9e8bc
...
@@ -92,33 +92,40 @@ def schedule_batch_matmul(cfg, outs):
...
@@ -92,33 +92,40 @@ def schedule_batch_matmul(cfg, outs):
def
_callback
(
op
):
def
_callback
(
op
):
if
"batch_matmul"
in
op
.
tag
:
if
"batch_matmul"
in
op
.
tag
:
C
=
op
.
output
(
0
)
C
=
op
.
output
(
0
)
A
,
B
=
s
[
C
]
.
op
.
input_tensors
A
,
B
=
op
.
input_tensors
_
,
M
,
K
=
get_const_tuple
(
A
.
shape
)
_
,
M
,
K
=
get_const_tuple
(
A
.
shape
)
_
,
_
,
N
=
get_const_tuple
(
C
.
shape
)
_
,
_
,
N
=
get_const_tuple
(
C
.
shape
)
if
op
not
in
s
.
outputs
:
s
[
C
]
.
compute_inline
()
O
=
outs
[
0
]
else
:
O
=
C
CC
=
s
.
cache_write
(
C
,
"global"
)
# create tuning space
# create tuning space
cfg
.
define_split
(
"tile_y"
,
M
,
num_outputs
=
2
)
cfg
.
define_split
(
"tile_y"
,
M
,
num_outputs
=
2
)
cfg
.
define_split
(
"tile_x"
,
N
,
num_outputs
=
2
)
cfg
.
define_split
(
"tile_x"
,
N
,
num_outputs
=
2
)
cfg
.
define_split
(
"tile_k"
,
K
,
num_outputs
=
2
)
cfg
.
define_split
(
"tile_k"
,
K
,
num_outputs
=
2
)
k
,
=
s
[
C
]
.
op
.
reduce_axis
b
,
y
,
x
=
s
[
O
]
.
op
.
axis
yo
,
yi
=
cfg
[
"tile_y"
]
.
apply
(
s
,
O
,
y
)
ko
,
ki
=
cfg
[
"tile_k"
]
.
apply
(
s
,
C
,
k
)
xo
,
xi
=
cfg
[
"tile_x"
]
.
apply
(
s
,
O
,
x
)
CC
=
s
.
rfactor
(
C
,
ki
)
s
[
O
]
.
reorder
(
b
,
yo
,
xo
,
yi
,
xi
)
bxyo
=
s
[
O
]
.
fuse
(
b
,
yo
,
xo
)
b
,
y
,
x
=
s
[
C
]
.
op
.
axis
s
[
O
]
.
parallel
(
bxyo
)
yo
,
yi
=
cfg
[
"tile_y"
]
.
apply
(
s
,
C
,
y
)
xo
,
xi
=
cfg
[
"tile_x"
]
.
apply
(
s
,
C
,
x
)
s
[
CC
]
.
compute_at
(
s
[
O
],
bxyo
)
s
[
C
]
.
reorder
(
b
,
yo
,
xo
,
yi
,
xi
)
k
,
=
s
[
CC
]
.
op
.
reduce_axis
bxyo
=
s
[
C
]
.
fuse
(
b
,
yo
,
xo
)
ko
,
ki
=
cfg
[
"tile_k"
]
.
apply
(
s
,
CC
,
k
)
s
[
C
]
.
parallel
(
bxyo
)
s
[
C
]
.
fuse
(
yi
,
xi
)
Crf
=
s
.
rfactor
(
CC
,
ki
)
s
[
Crf
]
.
compute_at
(
s
[
CC
],
s
[
CC
]
.
op
.
axis
[
0
])
s
[
CC
]
.
compute_at
(
s
[
C
],
bxyo
)
_
,
_
,
y
,
x
=
s
[
Crf
]
.
op
.
axis
_
,
_
,
y
,
x
=
s
[
CC
]
.
op
.
axis
s
[
Crf
]
.
fuse
(
y
,
x
)
s
[
CC
]
.
fuse
(
y
,
x
)
s
[
Crf
]
.
vectorize
(
s
[
Crf
]
.
op
.
axis
[
0
])
s
[
CC
]
.
vectorize
(
s
[
CC
]
.
op
.
axis
[
0
])
s
[
O
]
.
pragma
(
bxyo
,
'auto_unroll_max_step'
,
16
)
s
[
C
]
.
pragma
(
bxyo
,
'auto_unroll_max_step'
,
16
)
traverse_inline
(
s
,
outs
[
0
]
.
op
,
_callback
)
traverse_inline
(
s
,
outs
[
0
]
.
op
,
_callback
)
return
s
return
s
...
...
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