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
With the introduction of Ndarray (ti.ndarray), array size is a runtime information. This means that arrays of different size won't re-trigger a kernel JIT. Hence, a Metal kernel with external arrays is now broken, if it's invoked twice with arrays of different size.
The only reason Metal backend still seems work when it's first invoked with an array is reasoned below:
Change Metal backend's implementaion for array args. Instead of embedding a fixed size of memory within the Context buffer, we should follow other backends' Ndarray implementation. WIP in [Metal] Support Ndarray #4720
The text was updated successfully, but these errors were encountered:
The size of an array arg on Metal is still determined at compile-time, and is fixed after JIT compilation. See https://github.com/taichi-dev/taichi/blob/6d538e171c96193fd2ce27967bd0b17a5797565e/taichi/backends/metal/
With the introduction of Ndarray (
ti.ndarray
), array size is a runtime information. This means that arrays of different size won't re-trigger a kernel JIT. Hence, a Metal kernel with external arrays is now broken, if it's invoked twice with arrays of different size.The only reason Metal backend still seems work when it's first invoked with an array is reasoned below:
Kernel::Arg::size
is zero at arg declaration time:taichi/taichi/program/callable.cpp
Lines 16 to 26 in 6d538e1
taichi/python/taichi/lang/kernel_impl.py
Lines 667 to 669 in 6d538e1
taichi/taichi/program/kernel.cpp
Line 241 in 6d538e1
Kernel::Arg::size
is changed at runtime!Kernel::operator()
taichi/taichi/program/kernel.cpp
Lines 106 to 108 in 6d538e1
taichi/taichi/backends/metal/kernel_utils.cpp
Line 91 in 6d538e1
We should do two things:
taichi/taichi/program/kernel.cpp
Line 241 in 6d538e1
taichi/taichi/program/context.h
Line 16 in 6d538e1
The text was updated successfully, but these errors were encountered: