Skip to content

Vectorizing a reduce_axis does not raise an error #1795

@kazimuth

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

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