-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Refactor] IR standardization #689
Comments
Go CHI |
I wonder if we should separate By doing so, we can embed more structural knowledge of a Taichi kernel into the types. For example, a Taichi kernel is always composed of a series of Right now the root is just a This also makes it hard to look up info other than then current void Visitor::visit(Block* b) {
if (is_top_level_) {
// handling root, we know that each stmt in b->statements is an offloaded task
} else {
// internal IR nodes.
}
} Last but not least, this also enforces the invariants that offloaded tasks can only be at the top level -- Since it's not part of IR, it cannot be nested by other IR nodes accidentally. Giving more thoughts on this, maybe Taichi/CHI is too incomplete without offloaded tasks being part of its IR. Then at a minimum, I think we can have the following:
WDYT? |
Can't agree more, also note that there are not nesting taichi/taichi/program/kernel.h Line 14 in 62cdc60
to something like: std::vector<OffloadStmt *> offloads; |
I believe having a See also https://testing.googleblog.com/2017/11/obsessed-with-primitives.html. Builder's pattern is another common pattern to solve such problems. |
You mean, Also note that we want to implement real functions at some point #602, we want to leave a way for it when implementing |
The later one.
Yeah, then it's even more reasonable that we have a |
Shall we put all functions in |
Good idea. All passes that do not change IR should go to |
Is there gonna be serialization/pretty printer/parser so ppl can build external tool without interfacing C++? |
At some point, we should make the Taichi IR more standard. The standardized IR will be codenamed CHI (气), recursive acronym for CHI Hierarchical Instructions. This will not only make the codebase more maintainable, but also allow others to reuse CHI to build new languages, for sparse/differentiable/megakernel computation, just like a higher-level LLVM IR for visual computing applications.
Stmt
field naming consistent (e.g.AtomicOpStmt::dest/val
are inconsistent withGlobalStoreStmt::ptr/data
)OffloadedStmt::loop_vars
andOffloadedStmt::step
are not used (thanks to @xumingkuan). Consider removalanalysis
(thanks to @xumingkuan)taichi
, and the backend statements (CHI) are reusable to build a different language.add_operand
- is there a better way to implement it?taichi/ir/ir.h
andtaichi/ir/statements.h
VecStatement
toStatementPack
or merge it withBlock
?has_global_side_effect
tohas_side_effect
ArgStoreStmt
Stmt
from LLVM ([refactor] Removedllvm::Value *Stmt::value
#686)SNode
from LLVM ([refactor] RemoveSNodeAttr
and decoupleSNode
from LLVM #817)The text was updated successfully, but these errors were encountered: