You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/06/06 22:05:08 UTC
[GitHub] [tvm] vinx13 opened a new pull request, #11596: [MetaSchedule] Refactor RewriteTensorize to prevent concurrent map updates
vinx13 opened a new pull request, #11596:
URL: https://github.com/apache/tvm/pull/11596
Schedule primitives may cause module or prim func to be modified during `sch->Replace`. It is unsafe to iterate the functions in the module and call schedule primitives at the same time. This PR refactored `RewriteTensorize` to decompose it into two parts: find the blocks to rewrite first, and then do the actual rewrite.
cc @masahi @junrushao1994
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] junrushao1994 commented on pull request #11596: [MetaSchedule] Refactor RewriteTensorize to prevent concurrent map updates
Posted by GitBox <gi...@apache.org>.
junrushao1994 commented on PR #11596:
URL: https://github.com/apache/tvm/pull/11596#issuecomment-1148039018
@vinx13 We intentionally create a different IRModule for different threads (see `DeepCopyIRModule`). I was a little bit worried that we missed anything given this approach doesn't seem to work. Would you mind sharing more?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] vinx13 commented on pull request #11596: [MetaSchedule] Refactor RewriteTensorize to prevent concurrent map updates
Posted by GitBox <gi...@apache.org>.
vinx13 commented on PR #11596:
URL: https://github.com/apache/tvm/pull/11596#issuecomment-1148029173
> How about returning and collecting `jobs` from `ApplyTensorization`, and do
>
> ```
> for (auto kv : jobs) {
> tir::BlockRV block = sch->GetBlock(kv.first, func_name);
> sch->Unannotate(block, tir::attr::meta_schedule_auto_tensorize);
> kv.second(block);
> }
> ```
>
> after visiting all `sch->mod()->functions`?
that should also work
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] masahi commented on pull request #11596: [MetaSchedule] Refactor RewriteTensorize to prevent concurrent map updates
Posted by GitBox <gi...@apache.org>.
masahi commented on PR #11596:
URL: https://github.com/apache/tvm/pull/11596#issuecomment-1147997695
How about returning and collecting `jobs` from `ApplyTensorization`, and do
```
for (auto kv : jobs) {
tir::BlockRV block = sch->GetBlock(kv.first, func_name);
sch->Unannotate(block, tir::attr::meta_schedule_auto_tensorize);
kv.second(block);
}
```
after visiting all `sch->mod()->functions`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] vinx13 commented on pull request #11596: [MetaSchedule] Refactor RewriteTensorize to prevent concurrent map updates
Posted by GitBox <gi...@apache.org>.
vinx13 commented on PR #11596:
URL: https://github.com/apache/tvm/pull/11596#issuecomment-1147994493
It seems the map `mod->functions` got `CopyOnWrite`, as a result, the iterator in for loop got invalidated
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] vinx13 commented on pull request #11596: [MetaSchedule] Refactor RewriteTensorize to prevent concurrent map updates
Posted by GitBox <gi...@apache.org>.
vinx13 commented on PR #11596:
URL: https://github.com/apache/tvm/pull/11596#issuecomment-1148053227
It not related to multi threading. Even if I applied this postproc directly the iterator got invalidated.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] masahi merged pull request #11596: [MetaSchedule] Refactor RewriteTensorize to prevent concurrent map updates
Posted by GitBox <gi...@apache.org>.
masahi merged PR #11596:
URL: https://github.com/apache/tvm/pull/11596
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] masahi commented on pull request #11596: [MetaSchedule] Refactor RewriteTensorize to prevent concurrent map updates
Posted by GitBox <gi...@apache.org>.
masahi commented on PR #11596:
URL: https://github.com/apache/tvm/pull/11596#issuecomment-1147992863
I thought I've already split visiting and rewriting in `ApplyTensorization`. Is the problem in the iteration over
```
for (const auto& kv : sch->mod()->functions) {
ApplyTensorization(...)
}
```
?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] masahi commented on a diff in pull request #11596: [MetaSchedule] Refactor RewriteTensorize to prevent concurrent map updates
Posted by GitBox <gi...@apache.org>.
masahi commented on code in PR #11596:
URL: https://github.com/apache/tvm/pull/11596#discussion_r890665330
##########
src/meta_schedule/postproc/rewrite_tensorize.cc:
##########
@@ -28,26 +28,26 @@ namespace meta_schedule {
using tir::BlockRV;
using tir::LoopRV;
-void ApplyTensorization(const tir::Schedule& sch, const String& func_name,
- const tir::PrimFuncNode* func, bool vectorize_init_loop) {
- std::vector<std::pair<std::string, std::function<void(tir::BlockRV)>>> jobs;
-
+void ApplyTensorization(
Review Comment:
We should rename this function, since we are not applying here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org