Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vectorizing a reduce_axis does not raise an error #1795

Closed
kazimuth opened this issue Oct 2, 2018 · 4 comments · Fixed by #1921
Closed

Vectorizing a reduce_axis does not raise an error #1795

kazimuth opened this issue Oct 2, 2018 · 4 comments · Fixed by #1921

Comments

@kazimuth
Copy link
Contributor

kazimuth commented Oct 2, 2018

In #670 it was said that vectorizing a reduce_axis should raise an error, but it currently just silently gives wrong answers, e.g.:

import tvm

V = tvm.placeholder((128,), name='V')
ax = tvm.reduce_axis((0, 128), name='ax')
O = tvm.compute((1,), lambda _: tvm.sum(V[ax], axis=[ax]))

s = tvm.create_schedule(O.op)

s[O].vectorize(ax) # INVALID, but does not error!

func = tvm.build(s, [V, O])

vv = tvm.nd.array(np.ones((128,), dtype='float32'))
oo = tvm.nd.array(np.empty((1,), dtype='float32'))

func(vv, oo)
print(oo.asnumpy())
# prints:  [1.]
# should print: [128.]

I just ran into this issue and was confused :)

@tqchen
Copy link
Member

tqchen commented Oct 2, 2018

Thanks for reporting this!

I think that was something we missed and CHECK guard should be added here https://github.com/dmlc/tvm/blob/master/src/schedule/schedule_lang.cc#L355 to check the type of var(like https://github.com/dmlc/tvm/blob/master/src/schedule/schedule_lang.cc#L46)

Would you be interested in send a PR along with a regression testcase?

@kazimuth
Copy link
Contributor Author

kazimuth commented Oct 2, 2018

Sure, I'll get to this within the next day or so!

@tqchen
Copy link
Member

tqchen commented Oct 17, 2018

@kazimuth any updates on this ?

@tqchen
Copy link
Member

tqchen commented Oct 19, 2018

close by #1921

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants