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


##########
include/tvm/topi/transform.h:
##########
@@ -910,23 +909,24 @@ inline Tensor strided_slice_with_axes(const Tensor& x, 
const ffi::Array<Integer>
                  axes.size() == strides.size());
 
   // Normalize negative axes
-  ffi::Array<Integer> normalized_axes;
+  ffi::Array<int64_t> normalized_axes;
   for (size_t i = 0; i < axes.size(); ++i) {
-    int64_t axis = axes[i].IntValue();
+    int64_t axis = axes[i];
     if (axis < 0) {
       axis += src_tensor_dim;
     }
     TVM_FFI_ICHECK(axis >= 0 && axis < src_tensor_dim)
-        << "Axis " << axes[i].IntValue() << " is out of bounds for tensor with 
" << src_tensor_dim
+        << "Axis " << axes[i] << " is out of bounds for tensor with " << 
src_tensor_dim
         << " dimensions";
-    normalized_axes.push_back(Integer(axis));
+    normalized_axes.push_back(axis);
   }
 
   std::vector<int64_t> begin_vec, end_vec, strides_vec;
   std::tie(begin_vec, end_vec, strides_vec) = ConvertToVec(begin, end, 
strides, slice_mode);
 
+  DataType index_dtype = begin.size() > 0 ? DataType::Int(64) : 
DataType::Int(64);

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The ternary operator here is redundant because both branches return 
`DataType::Int(64)`. It can be simplified to directly assign 
`DataType::Int(64)`.
   
   ```suggestion
     DataType index_dtype = DataType::Int(64);
   ```



##########
src/te/operation/create_primfunc.cc:
##########
@@ -544,7 +545,7 @@ Stmt GenerateStmtFromCompute(const te::ComputeOp& 
compute_op, CreateFuncInfo* in
     Stmt body =
         GenerateBodyStmt(leaf.store_indices, buffers, leaf.axes_remap, 
expr_body, info, analyzer);
     seq_stmt.push_back(SBlockRealize(/*iter_values=*/leaf.bindings,
-                                     /*predicate=*/Bool(true),
+                                     /*predicate=*/IntImm(DataType::Bool(), 1),

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Since `<tvm/tirx/op.h>` is now included in this file, we can use the more 
idiomatic and readable `const_true()` helper instead of manually constructing 
`IntImm(DataType::Bool(), 1)`.
   
   ```suggestion
                                        /*predicate=*/const_true(),
   ```



##########
src/relax/ir/dataflow_matcher.cc:
##########
@@ -471,7 +471,7 @@ PrimExpr DFPatternMatcher::SimplifyCondition(PrimExpr 
condition) {
       constraints.begin(), constraints.end(),
       [&sort_key](const PrimExpr& a, const PrimExpr& b) { return sort_key(a) < 
sort_key(b); });
 
-  PrimExpr sorted_condition = Bool(true);
+  PrimExpr sorted_condition = IntImm(DataType::Bool(), 1);

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Since `<tvm/tirx/op.h>` is included via the header, we can use the more 
idiomatic `const_true()` helper instead of manually constructing 
`IntImm(DataType::Bool(), 1)`.
   
   ```suggestion
     PrimExpr sorted_condition = const_true();
   ```



##########
src/relax/transform/fuse_tir.cc:
##########
@@ -154,7 +155,7 @@ class SymbolicMatcher : ExprFunctor<void(const PrimExpr& n, 
const PrimExpr& othe
 
   arith::Analyzer* analyzer_;
   ffi::Map<tirx::Var, PrimExpr>* var_remap_;
-  PrimExpr must_prove_ = Bool(true);
+  PrimExpr must_prove_ = IntImm(DataType::Bool(), 1);

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Since `<tvm/tirx/op.h>` is included, we can use the more idiomatic 
`const_true()` helper instead of manually constructing 
`IntImm(DataType::Bool(), 1)`.
   
   ```suggestion
     PrimExpr must_prove_ = const_true();
   ```



##########
src/relax/analysis/struct_info_analysis.cc:
##########
@@ -632,121 +633,121 @@ class StructInfoBasePreconditionCollector
   PrimExpr VisitStructInfo(const StructInfo& lhs, const StructInfo& other) 
override {
     if (lhs.same_as(other)) {
       // Early bail-out if the StructInfo has reference equality.
-      return Bool(true);
+      return IntImm(DataType::Bool(), 1);

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Since `<tvm/tirx/op.h>` is included, we can use the more idiomatic 
`const_true()` helper instead of manually constructing 
`IntImm(DataType::Bool(), 1)`.
   
   ```suggestion
         return const_true();
   ```



##########
src/relax/transform/adjust_matmul_order.cc:
##########
@@ -72,7 +73,7 @@ std::tuple<DFPattern, ffi::TypedFunction<Expr(Expr, 
ffi::Map<DFPattern, Expr>)>>
   auto pat = pat_matmul_on_lhs | pat_matmul_on_rhs | 
pat_permuted_matmul_on_lhs |
              pat_permuted_matmul_on_rhs;
 
-  PrimExpr symbolic_var_constraints = Bool(true);
+  PrimExpr symbolic_var_constraints = IntImm(DataType::Bool(), 1);

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Since `<tvm/tirx/op.h>` is included, we can use the more idiomatic 
`const_true()` helper instead of manually constructing 
`IntImm(DataType::Bool(), 1)`.
   
   ```suggestion
     PrimExpr symbolic_var_constraints = const_true();
   ```



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