ConvolutedDog commented on code in PR #19568:
URL: https://github.com/apache/tvm/pull/19568#discussion_r3256041038


##########
src/target/llvm/intrin_rule_llvm.cc:
##########
@@ -143,32 +143,16 @@ TVM_REGISTER_OP("tirx.tan")
 
 TVM_REGISTER_OP("tirx.cosh")
     .set_attr<FLegalize>("llvm.FLegalize", [](const PrimExpr& e) -> PrimExpr {
-      using tirx::make_const;
-      using tirx::make_zero;
       const tirx::CallNode* call = e.as<tirx::CallNode>();
       TVM_FFI_ICHECK(call != nullptr);
-      const PrimExpr& x = call->args[0];
-      PrimExpr two = make_const(x.dtype(), 2);
-      PrimExpr neg_one = make_const(x.dtype(), -1);
-      PrimExpr exp_negx = exp(neg_one * x);
-      PrimExpr exp_posx = exp(x);
-      PrimExpr ret = (exp_posx + exp_negx) / two;
-      return ret;
+      return 
::tvm::codegen::intrin::DispatchPureExtern<::tvm::codegen::intrin::FloatSuffix>(e);

Review Comment:
   I have a question: `default.FLowerIntrinsic` already handles conversion for 
these operations, wouldn't simply deleting the `llvm.FLegalize` registrations 
achieve the same result as adding redundant `DispatchPureExtern` rules in 
`intrin_rule_llvm.cc`? Are there any other considerations?
   
https://github.com/apache/tvm/blob/4b93f2060f1c11786ed3e257bbccc617b8a20b3b/src/target/intrin_rule.cc#L78-L79



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to