tvm/python/tvm/tir/buffer.py at unity · apache/tvm (github.com)
in tir/buffer.py, Buffer.vload(begin, dtype=None) function, the dtype is redundant. as no testing case has used the dtype arg, and according to the .cc implement, the dtype must equal to buffer it’s self dtype, as follows:
PrimExpr Buffer::vload(Array<PrimExpr> begin, DataType value_dtype) const {
// specially handle bool, stored as DataType::Int(8)
const BufferNode* n = operator->();
ICHECK(n != nullptr);
ICHECK(value_dtype.element_of() == n->dtype.element_of() &&
value_dtype.lanes() % n->dtype.lanes() == 0)
<< "Cannot load " << value_dtype << " from buffer of " << n->dtype;
Array<PrimExpr> indices = begin;
int factor = value_dtype.lanes() / n->dtype.lanes();
if (factor > 1) {
indices.Set(indices.size() - 1, Ramp(indices[indices.size() - 1], 1, factor));
}
return BufferLoad(*this, indices);
}