Hi,The following is my code(actually it is generated by my own frontend but it is irrelevant to my rpoblem):
from akg import tvm
from akg.tvm.hybrid import script
import numpy as np
@script
def Conv2D(data,conv1_weight):
#s=0.000000
PaddedData = output_tensor((1,6,14,14),"float32")
conv1 = output_tensor((1,4,12,12),"float32")
for n in range(1):
for i0 in range(6):
for i1 in range(14):
for i2 in range(14):
PaddedData[n,i0,i1,i2] = 0.000000 if i1<1 or 1+12<=i1 or i2<1 or 1+12<=i2 else data[n,i0,i1-1,i2-1]
for n in range(1):
for c in range(4):
for i in range(12):
for j in range(12):
conv1[n,c,i,j] = 0.000000
for ric in range(6):
for rkh in range(3):
for rkw in range(3):
#s = 0.000000 if i+rkh<1 or 1+12<=i+rkh or j+rkw<1 or 1+12<=j+rkw else data[n,ric,i+rkh-1,j+rkw-1]
#conv1[n,c,i,j] = conv1[n,c,i,j]+ s*conv1_weight[c,ric,rkh,rkw]
conv1[n,c,i,j] = conv1[n,c,i,j]+ PaddedData[n,ric,i*1+rkh,j*1+rkw]*conv1_weight[c,ric,rkh,rkw]
return conv1
data = tvm.placeholder(shape=(1,6,12,12),name="data",dtype="float32")
conv1_weight = tvm.placeholder(shape=(4,6,3,3),name="conv1_weight",dtype="float32")
res = Conv2D(data,conv1_weight)
sch = akg.tvm.create_schedule(res.op)
mod = akg.build(sch,(data,conv1_weight,res),'cuda',[], name='myfunc', attrs={}, polyhedral=True, binds=None)
basically,this is a convolution2d using tvm.hybrid.script,paramater:data(1,6,12,12)(NCHW) conv1_weight(4,6,3,3)
stride=1,padding=1.And a error occurred:
[ERROR] AKG:2021-04-26-18:41:22.497.033 [scop_info.cc:1207] [poly] Hoist footprint of tensor PaddedData has no buffer definition
I'm a little confuing about how to write it correctly becase I'm fresh in this and learning hybrid tutorial in docs.tvm.org
of course,if I inline paddeddata into main loop just like the comments did in below code,it can run normally.But I noticed that akg could do Autoinline and Autofuse,so I would rather not to implement Autoinline in my own frontend.
some other error also occur while I'm doing some adjustment in this function such as:
[ERROR] AKG:2021-04-26-18:24:03.033.999 [storage_flatten.cc:133] [pass] Check failed: it != buf_map_.end(): Cannot find allocated buffer for placeholder(Conv2D_v1, 0x3804790)
```when trying return both paddeddata and conv1
[ERROR] AKG:2021-04-26-17:38:50.631.723 [tiling_utils.cc:98] [tiling] L0 value of axis 0_11 has not been tiled.
free(): invalid next size (fast)
Hi,The following is my code(actually it is generated by my own frontend but it is irrelevant to my rpoblem):
basically,this is a convolution2d using tvm.hybrid.script,paramater:data(1,6,12,12)(NCHW) conv1_weight(4,6,3,3)
stride=1,padding=1.And a error occurred:
I'm a little confuing about how to write it correctly becase I'm fresh in this and learning hybrid tutorial in docs.tvm.org
of course,if I inline paddeddata into main loop just like the comments did in below code,it can run normally.But I noticed that akg could do Autoinline and Autofuse,so I would rather not to implement Autoinline in my own frontend.
some other error also occur while I'm doing some adjustment in this function such as:
[ERROR] AKG:2021-04-26-17:38:50.631.723 [tiling_utils.cc:98] [tiling] L0 value of axis 0_11 has not been tiled.
free(): invalid next size (fast)