gemini-code-assist[bot] commented on code in PR #19568:
URL: https://github.com/apache/tvm/pull/19568#discussion_r3246645947


##########
src/target/llvm/intrin_rule_llvm.cc:
##########
@@ -143,32 +143,18 @@ 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;
+      using namespace intrin;
       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);
     });
 
 TVM_REGISTER_OP("tirx.sinh")
     .set_attr<FLegalize>("llvm.FLegalize", [](const PrimExpr& e) -> PrimExpr {
-      using tirx::make_const;
-      using tirx::make_zero;
+      using namespace intrin;
       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:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The `using namespace intrin;` statement and the `call` variable are 
redundant here. `DispatchPureExtern` already performs an internal check on the 
node type, and the call is fully qualified, making the local scope additions 
unnecessary.
   
   ```c
         return 
::tvm::codegen::intrin::DispatchPureExtern<::tvm::codegen::intrin::FloatSuffix>(e);
   ```



##########
src/target/llvm/intrin_rule_llvm.cc:
##########
@@ -143,32 +143,18 @@ 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;
+      using namespace intrin;
       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:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The `using namespace intrin;` statement and the `call` variable are 
redundant here. `DispatchPureExtern` already performs an internal check on the 
node type, and the call is fully qualified, making the local scope additions 
unnecessary.
   
   ```c
         return 
::tvm::codegen::intrin::DispatchPureExtern<::tvm::codegen::intrin::FloatSuffix>(e);
   ```



##########
src/target/llvm/intrin_rule_llvm.cc:
##########
@@ -232,24 +218,18 @@ TVM_REGISTER_OP("tirx.acos")
 
 TVM_REGISTER_OP("tirx.atan")
     .set_attr<FLegalize>("llvm.FLegalize", [](const PrimExpr& e) -> PrimExpr {
-      using tirx::make_const;
+      using namespace intrin;
       const tirx::CallNode* call = e.as<tirx::CallNode>();
       TVM_FFI_ICHECK(call != nullptr) << "Invalid call node in atan 
legalization";
-      const PrimExpr& x = call->args[0];
-      PrimExpr one = make_const(x.dtype(), 1.0);
-      PrimExpr denom = sqrt(x * x + one);
-      return asin(x / denom);
+      return 
::tvm::codegen::intrin::DispatchPureExtern<::tvm::codegen::intrin::FloatSuffix>(e);
     });
 
 TVM_REGISTER_OP("tirx.asinh")
     .set_attr<FLegalize>("llvm.FLegalize", [](const PrimExpr& e) -> PrimExpr {
-      using tirx::make_const;
+      using namespace intrin;
       const tirx::CallNode* call = e.as<tirx::CallNode>();
       TVM_FFI_ICHECK(call != nullptr) << "Invalid call node in asinh 
legalization";
-      const PrimExpr& x = call->args[0];
-      PrimExpr one = make_const(x.dtype(), 1.0);
-      PrimExpr sqrt_val = sqrt(x * x + one);
-      return log(x + sqrt_val);
+      return 
::tvm::codegen::intrin::DispatchPureExtern<::tvm::codegen::intrin::FloatSuffix>(e);

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The `using namespace intrin;` statement and the `call` variable are 
redundant here. `DispatchPureExtern` already performs an internal check on the 
node type, and the call is fully qualified, making the local scope additions 
unnecessary.
   
   ```c
         return 
::tvm::codegen::intrin::DispatchPureExtern<::tvm::codegen::intrin::FloatSuffix>(e);
   ```



##########
src/target/llvm/intrin_rule_llvm.cc:
##########
@@ -275,21 +255,10 @@ TVM_REGISTER_OP("tirx.atanh")
 
 TVM_REGISTER_OP("tirx.erf")
     .set_attr<FLegalize>("llvm.FLegalize", [](const PrimExpr& e) -> PrimExpr {
-      using tirx::make_const;
+      using namespace intrin;
       const tirx::CallNode* call = e.as<tirx::CallNode>();
       TVM_FFI_ICHECK(call != nullptr) << "Invalid call node in erf 
legalization";
-      const PrimExpr& x = call->args[0];
-      PrimExpr abs_x = tvm::abs(x);
-      PrimExpr t = make_const(x.dtype(), 1.0) /
-                   (make_const(x.dtype(), 1.0) + make_const(x.dtype(), 
0.3275911) * abs_x);
-      PrimExpr a1 = make_const(x.dtype(), 0.254829592);
-      PrimExpr a2 = make_const(x.dtype(), -0.284496736);
-      PrimExpr a3 = make_const(x.dtype(), 1.421413741);
-      PrimExpr a4 = make_const(x.dtype(), -1.453152027);
-      PrimExpr a5 = make_const(x.dtype(), 1.061405429);
-      PrimExpr poly = (((((a5 * t + a4) * t + a3) * t + a2) * t + a1) * t);
-      PrimExpr approx = make_const(x.dtype(), 1.0) - poly * exp(-abs_x * 
abs_x);
-      return tvm::tirx::Select(x < 0, -approx, approx);
+      return 
::tvm::codegen::intrin::DispatchPureExtern<::tvm::codegen::intrin::FloatSuffix>(e);

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The `using namespace intrin;` statement and the `call` variable are 
redundant here. `DispatchPureExtern` already performs an internal check on the 
node type, and the call is fully qualified, making the local scope additions 
unnecessary.
   
   ```c
         return 
::tvm::codegen::intrin::DispatchPureExtern<::tvm::codegen::intrin::FloatSuffix>(e);
   ```



##########
src/target/llvm/intrin_rule_llvm.cc:
##########
@@ -232,24 +218,18 @@ TVM_REGISTER_OP("tirx.acos")
 
 TVM_REGISTER_OP("tirx.atan")
     .set_attr<FLegalize>("llvm.FLegalize", [](const PrimExpr& e) -> PrimExpr {
-      using tirx::make_const;
+      using namespace intrin;
       const tirx::CallNode* call = e.as<tirx::CallNode>();
       TVM_FFI_ICHECK(call != nullptr) << "Invalid call node in atan 
legalization";
-      const PrimExpr& x = call->args[0];
-      PrimExpr one = make_const(x.dtype(), 1.0);
-      PrimExpr denom = sqrt(x * x + one);
-      return asin(x / denom);
+      return 
::tvm::codegen::intrin::DispatchPureExtern<::tvm::codegen::intrin::FloatSuffix>(e);

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The `using namespace intrin;` statement and the `call` variable are 
redundant here. `DispatchPureExtern` already performs an internal check on the 
node type, and the call is fully qualified, making the local scope additions 
unnecessary.
   
   ```c
         return 
::tvm::codegen::intrin::DispatchPureExtern<::tvm::codegen::intrin::FloatSuffix>(e);
   ```



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