taichi-dev/taichi

Invoke materialize() only before calling a Taichi kernel

Open

#2,730 创建于 2021年8月19日

在 GitHub 查看
 (5 评论) (0 反应) (2 负责人)C++ (2,384 fork)batch import
good first issuerefactorwelcome contribution

仓库指标

Star
 (28,195 star)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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.

贡献者指南