You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/10/07 15:19:13 UTC
[GitHub] [incubator-tvm] leandron commented on issue #6642: [Test] patterns for check into tests/python/contrib/test_tedd.py mismatch when running on CPU
leandron commented on issue #6642:
URL: https://github.com/apache/incubator-tvm/issues/6642#issuecomment-705007816
One example error message I was seeing:
The expected pattern is: `bk(kVectorized)`
The actual contents: `bk: int32(kVectorized)`
```
______________________________ test_schedule_tree ______________________________
def test_schedule_tree():
block_x = te.thread_axis("blockIdx.x")
thread_x = te.thread_axis("threadIdx.x")
n = te.var("n")
m = te.var("m")
l = te.var("l")
A = te.placeholder((n, m, l), name="A")
B = te.compute((n, m, l), lambda bi, bj, bk: A[bi, bj, bk] + 1, name="B")
r = te.reduce_axis((0, m), "r")
C = te.compute(
(
n,
m,
),
lambda ci, cj: te.sum(B[ci, cj, r], axis=r),
name="C",
)
s = te.create_schedule(C.op)
s.cache_read(A, "shared", [B])
s[B].vectorize(B.op.axis[-1])
s[C].reorder(C.op.reduce_axis[0], C.op.axis[0])
_, ki = s[C].split(C.op.reduce_axis[0], factor=16)
Cr = s.rfactor(C, ki)
s[Cr].compute_at(s[C], s[C].op.axis[-1])
s[C].bind(s[C].op.axis[0], block_x)
s[C].bind(s[C].op.axis[1], thread_x)
def verify():
from tvm.contrib import tedd
str = tedd.viz_schedule_tree(s, False, "", True)
findany(r"digraph \"Schedule Tree\"", str)
findany(r"subgraph cluster_legend", str)
# Check the A_shared stage, including memory scope, itervars,
# and compute
findany(
r"Stage_1.*A\.shared<br/>Scope: shared.+>0.+>"
r"ax0.*\(kDataPar\).+>1.+ax1.*\(kDataPar\).+>2.+>ax2.*\(kDataPar\).+>"
r"\[A[\[\(]ax0, ax1, ax2[\)\]]\]",
str
)
# Check itervars of types different from KDataPar
findany(r"bk\(kVectorized\)", str)
findany(r"r.outer\(kCommReduce\)", str)
findany(r"label=ROOT", str)
# Check the compute_at edge
findany(r"Stage_1.*\[color\=\"\#000000\"\]", str)
if checkdependency():
> verify()
tests/python/contrib/test_tedd.py:148:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/python/contrib/test_tedd.py:141: in verify
findany(r"bk\(kVectorized\)", str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pattern = 'bk\\(kVectorized\\)'
str = 'digraph "Schedule Tree" {\n\tgraph [rankdir=BT]\n\tsubgraph cluster_legend {\n\t\tlabel=Legend\n\t\tlegend [label=<<T...Stage_4:IterVar_4_1 [color="#76448A"]\n\tStage_4 -> ROOT [color="#000000"]\n\tROOT [label=ROOT margin=0 shape=oval]\n}'
def findany(pattern, str):
matches = re.findall(pattern, str)
> assert len(matches) > 0, "Pattern not found.\nPattern: " + pattern + "\nString: " + str
E AssertionError: Pattern not found.
E Pattern: bk\(kVectorized\)
E String: digraph "Schedule Tree" {
E graph [rankdir=BT]
E subgraph cluster_legend {
E label=Legend
E legend [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4"><TR><TD BGCOLOR="#FFFFFF"></TD><TD BGCOLOR="white">kDataPar</TD></TR><TR><TD BGCOLOR="#2980B9"></TD><TD BGCOLOR="white">kThreadIndex</TD></TR><TR><TD BGCOLOR="#FAD7A0"></TD><TD BGCOLOR="white">kCommReduce</TD></TR><TR><TD BGCOLOR="#D35400"></TD><TD BGCOLOR="white">kOrdered</TD></TR><TR><TD BGCOLOR="#ABB2B9"></TD><TD BGCOLOR="white">kOpaque</TD></TR><TR><TD BGCOLOR="#D2B4DE"></TD><TD BGCOLOR="white">kUnrolled</TD></TR><TR><TD BGCOLOR="#AED6F1"></TD><TD BGCOLOR="white">kVectorized</TD></TR><TR><TD BGCOLOR="#F5B7B1"></TD><TD BGCOLOR="white">kParallelized</TD></TR><TR><TD BGCOLOR="#A9DFBF"></TD><TD BGCOLOR="white">kTensorized</TD></TR></TABLE>> margin=0 shape=none]
E }
E Stage_0 [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4"> <TR><TD BGCOLOR="lightgrey" COLSPAN="2" PORT="stage">A<br/>Scope: </TD></TR></TABLE>> margin=0 shape=none]
E Stage_1 [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4"> <TR><TD BGCOLOR="lightgrey" COLSPAN="2" PORT="stage">A.shared<br/>Scope: shared</TD></TR><TR><TD PORT="IterVar_1_0" BGCOLOR="#FFFFFF">0</TD><TD BGCOLOR="white" PORT="itervar">ax0: int32(kDataPar)<br/>range(min=0, ext=n)</TD></TR><TR><TD PORT="IterVar_1_1" BGCOLOR="#FFFFFF">1</TD><TD BGCOLOR="white" PORT="itervar">ax1: int32(kDataPar)<br/>range(min=0, ext=m)</TD></TR><TR><TD PORT="IterVar_1_2" BGCOLOR="#FFFFFF">2</TD><TD BGCOLOR="white" PORT="itervar">ax2: int32(kDataPar)<br/>range(min=0, ext=(floordiv((m + 15), 16)*16))</TD></TR><TR><TD COLSPAN="2">[A[ax0, ax1, ax2]]</TD></TR></TABLE>> margin=0 shape=none]
E Stage_2 [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4"> <TR><TD BGCOLOR="lightgrey" COLSPAN="2" PORT="stage">B<br/>Scope: </TD></TR><TR><TD PORT="IterVar_2_0" BGCOLOR="#FFFFFF">0</TD><TD BGCOLOR="white" PORT="itervar">bi: int32(kDataPar)<br/>range(min=0, ext=n)</TD></TR><TR><TD PORT="IterVar_2_1" BGCOLOR="#FFFFFF">1</TD><TD BGCOLOR="white" PORT="itervar">bj: int32(kDataPar)<br/>range(min=0, ext=m)</TD></TR><TR><TD PORT="IterVar_2_2" BGCOLOR="#AED6F1">2</TD><TD BGCOLOR="white" PORT="itervar">bk: int32(kVectorized)<br/>range(min=0, ext=(floordiv((m + 15), 16)*16))</TD></TR><TR><TD COLSPAN="2">[(A.shared[bi, bj, bk] + 1f)]</TD></TR></TABLE>> margin=0 shape=none]
E Stage_3 [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4"> <TR><TD BGCOLOR="lightgrey" COLSPAN="2" PORT="stage">C.rf<br/>Scope: </TD></TR><TR><TD PORT="IterVar_3_0" BGCOLOR="#FFFFFF">0</TD><TD BGCOLOR="white" PORT="itervar">r.inner: int32(kDataPar)<br/>range(min=0, ext=16)</TD></TR><TR><TD PORT="IterVar_3_1" BGCOLOR="#FFFFFF">1</TD><TD BGCOLOR="white" PORT="itervar">ci: int32(kDataPar)<br/>range(min=blockIdx.x, ext=1)</TD></TR><TR><TD PORT="IterVar_3_2" BGCOLOR="#FFFFFF">2</TD><TD BGCOLOR="white" PORT="itervar">cj: int32(kDataPar)<br/>range(min=threadIdx.x, ext=1)</TD></TR><TR><TD PORT="IterVar_3_3" BGCOLOR="#FAD7A0">3</TD><TD BGCOLOR="white" PORT="itervar">r.outer: int32(kCommReduce)<br/>range(min=0, ext=floordiv((m + 15), 16))</TD></TR><TR><TD COLSPAN="2">[reduce(combiner=comm_reducer(<br/>result=[(x + y)], lhs=[x], rhs<br/>=[y], identity_element=[0f]), <br/>source=[B[ci, cj, (r.inner + (<br/>r.outer*16))]], init=[], axis=<br/>[iter_var(r.outer,
range(min=0<br/>, ext=floordiv((m + 15), 16)))<br/>], where=tir.likely(((r.inner <br/>+ (r.outer*16)) < m)), value_i<br/>ndex=0)]</TD></TR></TABLE>> margin=0 shape=none]
E Stage_4 [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4"> <TR><TD BGCOLOR="lightgrey" COLSPAN="2" PORT="stage">C.repl<br/>Scope: </TD></TR><TR><TD PORT="IterVar_4_0" BGCOLOR="#FFFFFF">0</TD><TD BGCOLOR="white" PORT="itervar">ax0: int32(kDataPar)<br/><font color="#2980B9">(blockIdx.x: int32)</font><br/>range(min=0, ext=n)</TD></TR><TR><TD PORT="IterVar_4_1" BGCOLOR="#FFFFFF">1</TD><TD BGCOLOR="white" PORT="itervar">ax1: int32(kDataPar)<br/><font color="#2980B9">(threadIdx.x: int32)</font><br/>range(min=0, ext=m)</TD></TR><TR><TD PORT="IterVar_4_2" BGCOLOR="#FAD7A0">2</TD><TD BGCOLOR="white" PORT="itervar">r.inner.v: int32(kCommReduce)<br/>range(min=0, ext=16)</TD></TR><TR><TD COLSPAN="2">[reduce(combiner=comm_reducer(<br/>result=[(x + y)], lhs=[x], rhs<br/>=[y], identity_element=[0f]), <br/>source=[C.rf[r.inner.v, ax0, a<br/>x1]], init=[], axis=[iter_var(<br/>r.inner.v, range(min=0, ext=16<br/>))], where=(bool)1, value_inde<br/>x=0)]</TD></TR></TA
BLE>> margin=0 shape=none]
E Stage_0 -> ROOT [color="#000000"]
E Stage_1 -> ROOT [color="#000000"]
E Stage_2 -> ROOT [color="#000000"]
E Stage_3 -> Stage_4:IterVar_4_1 [color="#76448A"]
E Stage_4 -> ROOT [color="#000000"]
E ROOT [label=ROOT margin=0 shape=oval]
E }
E assert 0 > 0
E + where 0 = len([])
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org