You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As mentioned in #6432 , when exporting a kernel with multiple data types, the behaviour of ti::Kernel on the C++ side is unexpected. The reason is that the ti::Kernel does not support inputs of different data types.
Since a kernel on the python side is able to take different data types, the ti::Kernel on the C++ side should have the same behaviour.
Thus, an expected behaviour should be:
python
importtaichiastiti.init(arch=ti.vulkan)
@ti.kerneldefk_test(arr: ti.types.ndarray(field_dim=1)):
arr[2] =arr[0] +arr[1]
a=ti.ndarray(ti.f32, 10)
b=ti.ndarray(ti.i32, 10)
mod=ti.aot.Module(ti.vulkan)
# Serialize a function instance: `k_test_f32`mod.add_kernel(k_test,
template_args={
"arr": a,
})
# Serialize a function instance: `k_test_i32`mod.add_kernel(k_test,
template_args={
"arr": b,
})
mod.save("aot_files/", "")
c++
// ...auto a = allocate_ndarray<float>(...);
auto b = allocate_ndarray<int>(...);
ti::Kernel k_test = load_kernel("k_test");
k_test[0] = a;
k_test.launch(); // This should call function `k_test_f32`.
k_test[0] = b;
k_test.launch(); // This should call function `k_test_i32`.
Concisely describe the proposed feature
As mentioned in #6432 , when exporting a kernel with multiple data types, the behaviour of
ti::Kernel
on the C++ side is unexpected. The reason is that theti::Kernel
does not support inputs of different data types.Since a kernel on the python side is able to take different data types, the
ti::Kernel
on the C++ side should have the same behaviour.Thus, an expected behaviour should be:
python
c++
cc @ailzhang
The text was updated successfully, but these errors were encountered: