tvm-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From weireweire via TVM Discuss <nore...@discuss.tvm.ai>
Subject [TVM Discuss] [Development] [Tensorize] Tensorize failed after reorder
Date Fri, 29 Mar 2019 03:40:19 GMT


hi,
I have a question about the solution code in [https://github.com/dmlc/tvm/issues/1625](https://github.com/dmlc/tvm/issues/1625)
> import tvm
> import numpy as np

> def intrin_vadd(n):
>     x = tvm.placeholder((n, 1, 1), name='vx')
>     y = tvm.placeholder((n, 1, 1), name='vy')
>     z = tvm.compute(x.shape, lambda i, j, k: x[i, j, k] + y[i, j, k], name='z')
>     def intrin_func(ins, outs):
>         xx, yy = ins
>         zz = outs[0]
>         return tvm.call_packed("vadd", xx, yy, zz)
> 
> 
>     strides = [tvm.var('so'), tvm.var('si'), 1]
>     offset_factor = 1
>     xb = tvm.decl_buffer(x.shape, x.dtype,
>                          name="xb",
>                          offset_factor=offset_factor,
>                          strides=strides)
>     yb = tvm.decl_buffer(y.shape, y.dtype,
>                          name="yb",
>                          offset_factor=offset_factor,
>                          strides=strides)
>     zb = tvm.decl_buffer(z.shape, z.dtype,
>                          name="zb",
>                          offset_factor=offset_factor,
>                          strides=strides)
>     binds = {x: xb, y: yb, z: zb}
>     return tvm.decl_tensor_intrin(z.op, intrin_func, binds=binds)


> def test_tensori
> ze_vadd():
> m = 16
> n = 16
> l = 16
> x = tvm.placeholder((m,n, l), name='x')
> y = tvm.placeholder((m,n, l), name='y')
> z = tvm.compute(x.shape, lambda i,j, k: x[i,j, k] + y[i,j, k], name='z')
> 
> def check(factor):
>     s = tvm.create_schedule(z.op)
>     xa, xb, xc = s[z].op.axis
>     s[z].reorder(xb, xc, xa)
>     print(tvm.lower(s, [x, y, z], simple_mode=True))
>     vadd = intrin_vadd(factor)
>     s[z].tensorize(xa, vadd)
>     s = s.normalize()
>     print(tvm.lower(s, [x, y, z], simple_mode=True))
> 
> check(16)
> 
> test_tensorize_vadd()

After the reorder, xa become the innermost axis. Why should we tensorize it with a tensor
with 3 dims. It's just one loop. And if I change the intrin tensor to 1 dim ,error will occour.





---
[Visit Topic](https://discuss.tvm.ai/t/tensorize-tensorize-failed-after-reorder/722/2) to
respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.ai/email/unsubscribe/64ecedc821ee204c6c70650b15116628a7d76f71b148a1be8b583196c6e99f9c).

Tianqi Chen, UW, Seattle, WA, 98105, United States
http://tracking.discuss.tvm.ai/tracking/unsubscribe?msgid=M4vzfKANxLAeSm3eBKyr0w2
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message