You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "Lunderberg (via GitHub)" <gi...@apache.org> on 2023/04/12 14:00:48 UTC

[GitHub] [tvm] Lunderberg opened a new pull request, #14604: [Array] Add deduction guide for Array(IterType,IterType) constructor

Lunderberg opened a new pull request, #14604:
URL: https://github.com/apache/tvm/pull/14604

   Previously, the `Array(IterType,IterType)` constructor required the class template parameter `T` to be explicitly provided.  This commit adds a template deduction guide, specifying the intended type `T` as the type produced by de-referencing the iterator, to remove the requirement.
   
   Fixes https://github.com/apache/tvm/issues/14600


-- 
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] jikechao commented on pull request #14604: [Array] Add deduction guide for Array(IterType,IterType) constructor

Posted by "jikechao (via GitHub)" <gi...@apache.org>.
jikechao commented on PR #14604:
URL: https://github.com/apache/tvm/pull/14604#issuecomment-1513317301

   @Hzfengsy I update llvm-gcc-12.0 which is the latest version that is supported by Ubuntu16.04. But this bug exists. 
   As a workaround, I modify the source code by replacing `Array{ptr->source, ptr->dest}` with` Array<ObjectRef>{ptr->source, ptr->dest} `  to avoid the build failure. 


-- 
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] Lunderberg commented on pull request #14604: [Array] Add deduction guide for Array(IterType,IterType) constructor

Posted by "Lunderberg (via GitHub)" <gi...@apache.org>.
Lunderberg commented on PR #14604:
URL: https://github.com/apache/tvm/pull/14604#issuecomment-1540855363

   @tvm-bot rerun


-- 
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] tvm-bot commented on pull request #14604: [Array] Add deduction guide for Array(IterType,IterType) constructor

Posted by "tvm-bot (via GitHub)" <gi...@apache.org>.
tvm-bot commented on PR #14604:
URL: https://github.com/apache/tvm/pull/14604#issuecomment-1505331736

   <!---bot-comment-->
   
   Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from [Reviewers](https://github.com/apache/incubator-tvm/blob/master/CONTRIBUTORS.md#reviewers) by @-ing them in a comment.
   
   <!--bot-comment-ccs-start-->
    * No users to tag found in teams: `array` <sub>See [#10317](https://github.com/apache/tvm/issues/10317) for details</sub><!--bot-comment-ccs-end-->
   
   <sub>Generated by [tvm-bot](https://github.com/apache/tvm/blob/main/ci/README.md#github-actions)</sub>


-- 
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] jikechao commented on pull request #14604: [Array] Add deduction guide for Array(IterType,IterType) constructor

Posted by "jikechao (via GitHub)" <gi...@apache.org>.
jikechao commented on PR #14604:
URL: https://github.com/apache/tvm/pull/14604#issuecomment-1512379852

   @Lunderberg @Hzfengsy Thanks you for your advice and patch. However, I'm sorry to tell you that this crash still exists after using the patch mentioned in this PR.


-- 
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


Re: [PR] [Array] Add deduction guide for Array(IterType,IterType) constructor [tvm]

Posted by "Lunderberg (via GitHub)" <gi...@apache.org>.
Lunderberg closed pull request #14604: [Array] Add deduction guide for Array(IterType,IterType) constructor
URL: https://github.com/apache/tvm/pull/14604


-- 
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] Lunderberg commented on pull request #14604: [Array] Add deduction guide for Array(IterType,IterType) constructor

Posted by "Lunderberg (via GitHub)" <gi...@apache.org>.
Lunderberg commented on PR #14604:
URL: https://github.com/apache/tvm/pull/14604#issuecomment-1513343603

   Interesting.  While the change compiles locally, it looks like the CI is having issues with this patch, with the older version of gcc not interpreting the deduction guide correctly.
   
   Looking at this specific use case again, it looks like it is also dependent on the ambiguity between `Array{first_element, second_element}` and `Array{iter_begin, iter_end}`.  The deduction guides would help handle the case where the second usage has ambiguous type, but it wouldn't handle the case where the first usage is intended.  We may be able to remove this ambiguity by moving the static_assert into a SFINAE parameter, so that the `initializer_list` case is the only remaining overload.
   
   Can you try making the following change in `include/tvm/runtime/container/array.h`?
   
   ```c++
   // Before
   template <typename IterType>
   Array(IterType first, IterType last) {
     static_assert(is_valid_iterator_v<T, IterType>,
                   "IterType cannot be inserted into a tvm::Array<T>");
     Assign(first, last);
   }
   
   // After
   template <typename IterType, typename = std::enable_if_t<is_valid_iterator_v<T, IterType>>>
   Array(IterType first, IterType last) {
     Assign(first, last);
   }
   ```
   
   That said, if this is the only instance of this issue, it probably is easier to change from `Array{...}` to `Array<ObjectRef>{...}`.


-- 
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


Re: [PR] [Array] Add deduction guide for Array(IterType,IterType) constructor [tvm]

Posted by "Lunderberg (via GitHub)" <gi...@apache.org>.
Lunderberg commented on PR #14604:
URL: https://github.com/apache/tvm/pull/14604#issuecomment-2127802225

   Trying to clear out some of my (very) old PRs.  This PR is now rebased onto main including the fix in [this comment](https://github.com/apache/tvm/pull/14604#issuecomment-1513343603).  If it passes CI, then it's ready to merge.


-- 
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] Hzfengsy commented on pull request #14604: [Array] Add deduction guide for Array(IterType,IterType) constructor

Posted by "Hzfengsy (via GitHub)" <gi...@apache.org>.
Hzfengsy commented on PR #14604:
URL: https://github.com/apache/tvm/pull/14604#issuecomment-1512391152

   @jikechao Could you please try to upgrade your cxx compiler? 


-- 
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] jikechao commented on pull request #14604: [Array] Add deduction guide for Array(IterType,IterType) constructor

Posted by "jikechao (via GitHub)" <gi...@apache.org>.
jikechao commented on PR #14604:
URL: https://github.com/apache/tvm/pull/14604#issuecomment-1515766113

   @Lunderberg Thanks for your efforts. Indeed, only one instance of this issue. 
   
   After changing Array{...} to Array<ObjectRef>{...}. and changing the source code you provided [above](https://github.com/apache/tvm/pull/14604#:~:text=//%20After%0Atemplate%20%3Ctypename%20IterType%2C%20typename%20%3D%20std%3A%3Aenable_if_t%3Cis_valid_iterator_v%3CT%2C%20IterType%3E%3E%3E%0AArray(IterType%20first%2C%20IterType%20last)%20%7B%0A%20%20Assign(first%2C%20last)%3B%0A%7D), build sucessfully. 
   
   


-- 
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