Lunderberg commented on code in PR #12691:
URL: https://github.com/apache/tvm/pull/12691#discussion_r979046683
##########
src/te/schedule/schedule_lang.cc:
##########
@@ -200,7 +200,7 @@ Stage& Stage::env_threads(Array<IterVar> threads) {
ICHECK_EQ(self->env_threads.size(), 0U) << "Already set env_threads";
Array<IterVar>& leaf_vars = self->leaf_iter_vars;
Array<IterVar>& all_vars = self->all_iter_vars;
- std::vector<ObjectRef> temp;
+ std::vector<IterVar> temp;
Review Comment:
This was actually the exact type of error that I wanted to catch with the
`static_assert` statements. This was a `std::vector<ObjectRef>` which was
copied into an `Array<IterVar>`, with no type-checking during the conversion.
It didn't cause any runtime issues, because the `std::vector` was originally
populated with `ObjectRef` instances that contain `IterVarNode`, but there were
no compile-time checks to ensure that was the case. Had it been otherwise, the
later use of `ObjectRef::DowncastNoCheck<IterVar>` would have invoked undefined
behavior.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]