Hi,
These days, I am studying TVMScript and some other JIT languages. More or less, they have some similarities and differences. Here are some stuff I think may be helpful for the further development of TVMScript.
- At present, TVMScript do not support variable ndims. This makes it somewhat laborious to program. TaiChi use templates to suport this (refer to [Metaprogramming | Taichi Docs](https://meta programming)).
@ti.kernel
def copy_1D(x: ti.template(), y: ti.template()):
for i in x:
y[i] = x[i]
@ti.kernel
def copy_2d(x: ti.template(), y: ti.template()):
for i, j in x:
y[i, j] = x[i, j]
@ti.kernel
def copy_3d(x: ti.template(), y: ti.template()):
for i, j, k in x:
y[i, j, k] = x[i, j, k]
# Kernels listed above can be unified into one kernel using `ti.grouped`:
@ti.kernel
def copy(x: ti.template(), y: ti.template()):
for I in ti.grouped(y):
# I is a vector with dimensionality same to y
# If y is 0D, then I = ti.Vector([]), which is equivalent to `None` used in x[I]
# If y is 1D, then I = ti.Vector([i])
# If y is 2D, then I = ti.Vector([i, j])
# If y is 3D, then I = ti.Vector([i, j, k])
# ...
x[I] = y[I]
If TVMScript can support something like it, I think it will be more convenient and save users much time and energy.
-
Compared with Numba, TaiChi, etc, TVMScript looks like a bit complicated. A new user need to learn some new concepts such as Block, Iterator domain which are not easy to understand. So can we simplify these things? For example, if we can get iterator domain information given the user’s program, then we can tell users that the iterator domain is not necessary to specify. What’s more, if so, explicit block declaration can be not mandatory for scheduling (we can create blocks by “blockize”, and create a generic shedule). For the explicit block declaration, we can categorize it into the advanced programming. this makes TVMScript more python and user-friendly.
-
I think it’s better if we support python tuple in TVMScript. For example,
M, N = a.shape
.