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 2020/04/01 21:02:01 UTC

[GitHub] [incubator-tvm] wpan11nv opened a new pull request #5209: [CodeGen][CUDA] Fix bugs

wpan11nv opened a new pull request #5209: [CodeGen][CUDA] Fix bugs
URL: https://github.com/apache/incubator-tvm/pull/5209
 
 
   - Support vectorized casts
   
   - It is incorrect to extract elements from int8x4 with
   
      0x000000ff & (x >> i * 8)
   
     as this value is of type int in C/C++. If this expression
     is used for sign extensions, the sign bit will be wrong.
     Simply use C style casts instead and sign bits will just work.
   
   Signed-off-by: Wei Pan <we...@nvidia.com>
   
   Thanks for contributing to TVM!   Please refer to guideline https://tvm.apache.org/docs/contribute/ for useful information and tips. After the pull request is submitted, please request code reviews from [Reviewers](https://github.com/apache/incubator-tvm/blob/master/CONTRIBUTORS.md#reviewers) by @ them in the pull request thread.
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-tvm] wpan11nv commented on a change in pull request #5209: [CodeGen][CUDA] Fix bugs

Posted by GitBox <gi...@apache.org>.
wpan11nv commented on a change in pull request #5209: [CodeGen][CUDA] Fix bugs
URL: https://github.com/apache/incubator-tvm/pull/5209#discussion_r402080514
 
 

 ##########
 File path: src/target/source/codegen_cuda.cc
 ##########
 @@ -352,6 +354,37 @@ void CodeGenCUDA::PrintStorageScope(
   }
 }
 
+void CodeGenCUDA::VisitExpr_(const CastNode* op, std::ostream& os) {
+  DataType from_ty = op->value.dtype();
+  DataType target_ty = op->dtype;
+  CHECK_EQ(target_ty.lanes(), from_ty.lanes());
+
+  // Emit simple C-style type conversion.
+  if (from_ty.is_scalar())
+    return CodeGenC::VisitExpr_(op, os);
+
+  // We could emit make_float4 like calls, but the emitted code looks
+  // too compact to read. Emit this as vectorized unary ops.
 
 Review comment:
   No, typical optimizations like mem2reg will promote temporary into registers and make them equivalent. 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-tvm] vinx13 commented on a change in pull request #5209: [CodeGen][CUDA] Fix bugs

Posted by GitBox <gi...@apache.org>.
vinx13 commented on a change in pull request #5209: [CodeGen][CUDA] Fix bugs
URL: https://github.com/apache/incubator-tvm/pull/5209#discussion_r402049736
 
 

 ##########
 File path: src/target/source/codegen_cuda.cc
 ##########
 @@ -352,6 +354,37 @@ void CodeGenCUDA::PrintStorageScope(
   }
 }
 
+void CodeGenCUDA::VisitExpr_(const CastNode* op, std::ostream& os) {
+  DataType from_ty = op->value.dtype();
+  DataType target_ty = op->dtype;
+  CHECK_EQ(target_ty.lanes(), from_ty.lanes());
+
+  // Emit simple C-style type conversion.
+  if (from_ty.is_scalar())
+    return CodeGenC::VisitExpr_(op, os);
+
+  // We could emit make_float4 like calls, but the emitted code looks
+  // too compact to read. Emit this as vectorized unary ops.
 
 Review comment:
   is there any difference in performance?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-tvm] tqchen commented on issue #5209: [CodeGen][CUDA] Fix bugs

Posted by GitBox <gi...@apache.org>.
tqchen commented on issue #5209: [CodeGen][CUDA] Fix bugs
URL: https://github.com/apache/incubator-tvm/pull/5209#issuecomment-607488374
 
 
   @vinx13 would be great if you can help to take a look

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-tvm] vinx13 merged pull request #5209: [CodeGen][CUDA] Fix bugs

Posted by GitBox <gi...@apache.org>.
vinx13 merged pull request #5209: [CodeGen][CUDA] Fix bugs
URL: https://github.com/apache/incubator-tvm/pull/5209
 
 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services