Hi @chungs31,
I was looking into this a couple of days ago. This is my understanding (more experienced folks, please correct me if I am wrong).
There is a pass named MakePackedAPI
, which has the task of binding the variables of DLTensors to TVM buffers.
Lines 177-179 of make_packed_api.cc are like:
for (const auto& kv : buffer_def) {
binder.BindDLTensor(kv.second, device_type, device_id, kv.first, kv.first->name_hint);
}
BindDLTensor
adds LetStmt
for every variable related to the tensor (size, stride, etc…) calling the function Bind_
. For stride, you should be looking at lines 251-258 of arg_binder.cc
.
What Bind_
does is to look for the requested variable, creating the LetStmt
.
Hope this helps,