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

[ir] Remove the usage of kernel from type_check() pass #1848

Merged
merged 2 commits into from
Sep 6, 2020

Conversation

k-ye
Copy link
Member

@k-ye k-ye commented Sep 6, 2020

Because we know the kernel args and return types when constructing these arg load/kernel return stmts, we don't have to re-infer them inside type_check(). This PR removes the necessity of kernel in type_check (config is still not handled), so that IR is a bit more decoupled from Kernel.

Related issue = #689

[Click here for the format server]


@codecov
Copy link

codecov bot commented Sep 6, 2020

Codecov Report

Merging #1848 into master will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1848      +/-   ##
==========================================
+ Coverage   64.23%   64.26%   +0.02%     
==========================================
  Files          19       19              
  Lines        3722     3725       +3     
  Branches      705      705              
==========================================
+ Hits         2391     2394       +3     
  Misses       1204     1204              
  Partials      127      127              
Impacted Files Coverage Δ
python/taichi/lang/kernel_arguments.py 55.88% <100.00%> (ø)
python/taichi/lang/transformer.py 81.98% <100.00%> (+0.09%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 64a6122...a7dc3af. Read the comment docs.

Copy link
Contributor

@xumingkuan xumingkuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM + nits!

@@ -34,9 +34,11 @@ class ConstantFold : public BasicStmtVisitor {
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Off-topic: lines 10-11 are redundant in this file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done (removed + reordered)

@@ -346,8 +346,9 @@ void export_lang(py::module &m) {
current_ast_builder().insert(Stmt::make<FrontendBreakStmt>());
});

m.def("create_kernel_return", [&](const Expr &value) {
current_ast_builder().insert(Stmt::make<FrontendKernelReturnStmt>(value));
m.def("create_kernel_return", [&](const Expr &value, DataType dt) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Shall we use DataType dt or const DataType & (which is used in make_arg_load_expr)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack, switched to const DataType& (I tried to use DataType for make_arg_load_expr, but bumped into funny rvalue reference issues..)

Copy link
Contributor

@xumingkuan xumingkuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool LGTM!

@k-ye k-ye merged commit f809eec into taichi-dev:master Sep 6, 2020
@k-ye k-ye deleted the arg-load-ir branch September 6, 2020 15:09
@yuanming-hu yuanming-hu mentioned this pull request Sep 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants