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/07/05 16:35:35 UTC

[GitHub] [tvm] Lunderberg opened a new pull request, #15241: [TIR] Return error code from kernels in SplitHostDevice

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

   Some codegen types delegate to `CodeGenCPU` for their compute kernels, as they may delegate work to packed functions.  Because `CodeGenCPU` assumes that it can return an error code at any point (e.g. when launching a parallel for loop), the compute kernel should return an error code.
   
   This PR resolves a potential bug introduced in https://github.com/apache/tvm/pull/15127, which removed the hard-coded override of return type.
   
   The unit tests in this PR rely on changes made in https://github.com/apache/tvm/pull/15239, to allow TVMScript to represent the call into a compute kernel with non-void return type.


-- 
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 #15241: [TIR] Return error code from kernels in SplitHostDevice

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

   <!---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-->
    * cc @Hzfengsy, @junrushao, @quic-sanirudh, @shingjan <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] tqchen merged pull request #15241: [TIR] Return error code from kernels in SplitHostDevice

Posted by "tqchen (via GitHub)" <gi...@apache.org>.
tqchen merged PR #15241:
URL: https://github.com/apache/tvm/pull/15241


-- 
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 #15241: [TIR] Return error code from kernels in SplitHostDevice

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

   > can you clarify an example that leverages CodegenCPU for kernel.
   
   @tqchen Certainly.  This mainly comes up in a few edge cases found when debugging a single-module lowering flow (https://github.com/apache/tvm/pull/14985), used for https://github.com/apache/tvm/pull/14862.  The issue arose when a `kDLExtDev` target or a custom `TIRToRuntime` hook was implemented by subclassing `CodeGenCPU` or `CodeGenCHost` (e.g. [`CodeGenCMSISNN`](https://github.com/apache/tvm/blob/main/src/relay/backend/contrib/cmsisnn/tir_to_runtime.cc#L39)).  In those cases, the base class assumes that it is safe to return an error code (e.g. in [`CodeGenCHost::PrintGetFuncFromBackend`](https://github.com/apache/tvm/blob/main/src/target/source/codegen_c_host.cc#L221), even if that occurs within a portion that has been separated into an independent function.
   
   These cases are mostly suppressed by the fix in https://github.com/apache/tvm/pull/15102, but can still happen if there's an explicit `T.target("my_custom_extension", host="llvm")`.  In those cases, the compute kernels occur within a function generated by `"my_custom_extension"`, with the DLTensor-unpacking should still be handled by the usual LLVM codegen.
   
   > Just want to make sure that our existing path of GPU kernel separated codegen continues to function as error there are propagated by call packed mechanism
   
   Definitely agreed.  I updated the original PR to limit the `int32_t` return type to targets that may be executed on the CPU, so that the separated GPU kernels are unaffected.  This is sufficient for the functionality in https://github.com/apache/tvm/pull/14862, while avoiding changes to the GPU path.


-- 
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] tqchen commented on pull request #15241: [TIR] Return error code from kernels in SplitHostDevice

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

   @Lunderberg can you clarify an example that leverages CodegenCPU for kernel. Just want to make sure that our existing path of GPU kernel separated codegen continues to function as error there are propagated by call packed mechanism


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