Skip to content

Vectorizing a reduce_axis does not raise an error #1795

Closed

Description

@kazimuth

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 :)

Activity

  1. tqchen commented on Oct 2, 2018

    @tqchen
    Member

    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?

  2. kazimuth commented on Oct 2, 2018

    @kazimuth
    ContributorAuthor

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

  3. tqchen commented on Oct 17, 2018

    @tqchen
    Member

    @kazimuth any updates on this ?

  4. tqchen commented on Oct 19, 2018

    @tqchen
    Member

    close by #1921

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions