Skip to content
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

Support frontend type check #3301

Closed
22 tasks done
strongoier opened this issue Oct 27, 2021 · 0 comments
Closed
22 tasks done

Support frontend type check #3301

strongoier opened this issue Oct 27, 2021 · 0 comments
Assignees
Labels
c++ C++ engineering related feature request Suggest an idea on this project ir IR related issues

Comments

@strongoier
Copy link
Contributor

strongoier commented Oct 27, 2021

Concisely describe the proposed feature

Currently, Taichi doesn't have frontend type check. All type related stuff are not handled until Taichi kernels are turned into CHI IRs. This causes the following issues:

  1. Type error messages are not readable. It is very hard for users to distinguish between a user error and a compiler internal error, as they always see a bunch of purple stuff. Even for an experienced user, in some cases it is almost impossible to figure out the connections between the reported CHI IR-level errors and the original Taichi kernels.
  2. It is not possible to support local variable definition requiring type inference. For example, we may want a local array with only initial values (which may or may not be constants) provided.

To solve these issues, I hope to make Taichi support frontend type check.

Describe the solution you'd like (if any)

Add ret_type (return type) member variable and type_check member function for the Expression class (which represents frontend expressions) in Taichi core, and call type_check when a Python-side Expr is constructed. Note that the type inference/check rules need to be consistent with the type_check pass of CHI IR. Our goal is to infer all frontend types and report all type errors at this stage, and the type_check pass of CHI IR should only serve the compiler itself.

Progress:

  • ArgLoadExpression
  • RandExpression
  • UnaryOpExpression
  • BinaryOpExpression
  • TernaryOpExpression
  • InternalFuncCallExpression
  • ExternalFuncCallExpression
  • ExternalTensorExpression
  • GlobalVariableExpression
  • GlobalPtrExpression
  • TensorElementExpression
  • EvalExpression
  • RangeAssumptionExpression
  • LoopUniqueExpression
  • IdExpression
  • AtomicOpExpression
  • SNodeOpExpression
  • LocalLoadExpression
  • GlobalLoadExpression
  • ConstExpression
  • ExternalTensorShapeAlongAxisExpression
  • FuncCallExpression
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ C++ engineering related feature request Suggest an idea on this project ir IR related issues
Projects
None yet
Development

No branches or pull requests

1 participant