Skip to content

[SCHEDULE] Improve bound inference for split - #4932

Closed
merrymercy wants to merge 3 commits into
apache:masterfrom
merrymercy:fix-infer-split
Closed

[SCHEDULE] Improve bound inference for split#4932
merrymercy wants to merge 3 commits into
apache:masterfrom
merrymercy:fix-infer-split

Conversation

@merrymercy

Copy link
Copy Markdown
Member

When we split an axis i with a factor f that is larger than the extent of i, we should set the extent of the inner axis to be the extent of i instead of f.

Test script

importtvmA=tvm.placeholder((2, 2), name='A')
B=tvm.compute((2, 2), lambdai, j : A[i][j] +1.0, name='B')
s=tvm.create_schedule([B.op])
i, j=s[B].op.axiss[B].split(i, 4)
print(tvm.lower(s, [A ,B], simple_mode=True))

Results

Before

produce B {
for (i.inner, 0, 4) {
for (j, 0, 2) {
if (likely((i.inner < 2))) {
if (likely((i.inner < 2))) {
B[((i.inner*2) + j)] = (A[((i.inner*2) + j)] + 1f)
}
}
}
}
}

After

produce B {
for (i.inner, 0, 2) {
for (j, 0, 2) {
B[((i.inner*2) + j)] = (A[((i.inner*2) + j)] + 1f)
}
}
}

@merrymercy

Copy link
Copy Markdown
MemberAuthor

cc @jcf94@tqchen

@yongfeng-nv

Copy link
Copy Markdown
Contributor

@merrymercy, I submitted almost the same PR last week: #4885. More failures are exposed during CI. I am improving it with two failures left: #4931. Can you review it?

@merrymercy

Copy link
Copy Markdown
MemberAuthor

@yongfeng-nv
Good work! I will review your PR and close this one

@merrymercy
merrymercy deleted the fix-infer-split branch February 24, 2020 22:19
@yongfeng-nv

Copy link
Copy Markdown
Contributor

@merrymercy, thanks. We ran into this issue, because the 'if' statements are not allowed in the tensorization region, giving errors like: TVMError: Tensorize failed, split condition likely((i.inner < 8)) relies on var defined inside tensorize scope.

Can you share your use case stopped by this issue? I am going to open a thread in the forum about it and finding more use cases while fixing failures.

@yongfeng-nvyongfeng-nv mentioned this pull request Feb 25, 2020
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@merrymercy@yongfeng-nv