taichi-dev/taichi

Invoke materialize() only before calling a Taichi kernel

Open

#2730 aperta il 19 ago 2021

Vedi su GitHub
 (5 commenti) (0 reazioni) (2 assegnatari)C++ (2384 fork)batch import
good first issuerefactorwelcome contribution

Metriche repository

Star
 (28.195 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

Concisely describe the proposed feature

Originally, materialize() was meant to be invoked immediately before the invocation of a @ti.kernel:

https://github.com/taichi-dev/taichi/blob/9c108ff0e1ce51ba991f1bd4476892d3823fe13a/python/taichi/lang/impl.py#L294-L317

That is, this part is where materialize() is supposed to be called: https://github.com/taichi-dev/taichi/blob/711c299ca9abce4b8a632922ff89295c6939faf3/python/taichi/lang/kernel_impl.py#L383


It is now scattered in several places in the codebase, see

https://github.com/taichi-dev/taichi/search?l=Python&q=%22materialize%28%22

Describe the solution you'd like (if any)

The reasons are two-fold

  1. We used to have to call materialize() before collecting SNode's information. shape has been fixed by @strongoier 's work (#2600) now. However, there are still some places left. We will be happy to guide for the rest of the fix.
  1. There are places where an exception should be thrown if the program is not materialized yet (instead of doing an implicit materialization):

Additional comments Add any other context or screenshots about the feature request here.

Guida contributor