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


##########
src/tir/schedule/primitive/compute_inline.cc:
##########
@@ -1160,20 +1212,41 @@ Block 
ReductionEpilogueFuser::CreateFusedReductionBlock(const BlockNode* reducti
     var_map[epilogue_data_vars[i]] = reduction_data_vars[i];
   }
 
-  // 2. Change init to epilogue value: D[vi, vj] = C[vi, vj]
-  BufferStore new_init_store(epilogue_output_buffer_, 
Substitute(epilogue_addend_, var_map),
-                             Substitute(epilogue_output_indices_, var_map));
+  // 2. Change init to epilogue value based on epilogue type
+  BufferStore new_init_store;
+  if (epilogue_type_ == EpilogueType::BiasReLU) {
+    // For ReLU, init should be max(C[vi, vj], 0) to match per-iteration ReLU 
semantics
+    PrimExpr init_value = Substitute(epilogue_addend_, var_map);
+    PrimExpr zero = tir::make_zero(init_value.dtype());
+    new_init_store = BufferStore(epilogue_output_buffer_, Max(init_value, 
zero),
+                                 Substitute(epilogue_output_indices_, 
var_map));
+  } else {
+    // Bias: D[vi, vj] = C[vi, vj]
+    new_init_store = BufferStore(epilogue_output_buffer_, 
Substitute(epilogue_addend_, var_map),
+                                 Substitute(epilogue_output_indices_, 
var_map));
+  }
   new_block->init = new_init_store;
 
   // 3. Replace output buffer from temp to D in body
   class BufferReplacer : public StmtExprMutator {
    public:
-    BufferReplacer(Buffer old_buf, Buffer new_buf) : old_buffer_(old_buf), 
new_buffer_(new_buf) {}
+    BufferReplacer(Buffer old_buf, Buffer new_buf, EpilogueType epilogue_type, 
DataType dtype)
+        : old_buffer_(old_buf),
+          new_buffer_(new_buf),
+          epilogue_type_(epilogue_type),
+          dtype_(dtype),
+          is_temp_buffer_(is_temp_buffer) {}

Review Comment:
   ![critical](https://www.gstatic.com/codereviewagent/critical.svg)
   
   The member `is_temp_buffer_` is initialized with itself here, but it is not 
declared as a member of the `BufferReplacer` class. This appears to be a 
copy-paste error and will cause a compilation failure. Please remove this line.
   
   ```suggestion
       BufferReplacer(Buffer old_buf, Buffer new_buf, EpilogueType 
epilogue_type, DataType dtype)
           : old_buffer_(old_buf),
             new_buffer_(new_buf),
             epilogue_type_(epilogue_type),
             dtype_(dtype) {}
   ```



##########
.lesshst:
##########
@@ -0,0 +1 @@
+.less-history-file:

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   This file appears to be a local history file from the `less` command. Such 
files are specific to a user's environment and should not be included in the 
project's version control. Please remove this file from the pull request and 
add `.lesshst` to the project's `.gitignore` file to prevent it from being 
accidentally committed in the future.



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