Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/transform/annotate_warp_group_reg_alloc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ class SetMaxNRegInjector : public StmtExprMutator {
private:
Stmt VisitStmt_(const EvaluateNode *op) final {
if (const CallNode *call = op->value.as<CallNode>()) {
if (call->op.same_as(set_max_nreg()) ||
call->op.same_as(no_set_max_nreg())) {
if (call->op.same_as(no_set_max_nreg())) {
// Remove the original set_max_nreg calls as they will be re-inserted
// at appropriate locations
return Evaluate(0);
Comment on lines +98 to 101
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Update the misleading comment.

The comment on lines 99-100 claims to "Remove the original set_max_nreg calls" but the code now only removes no_set_max_nreg() calls. Original set_max_nreg() calls are preserved in this version.

Apply this diff to correct the comment:

       if (call->op.same_as(no_set_max_nreg())) {
-        // Remove the original set_max_nreg calls as they will be re-inserted
-        // at appropriate locations
+        // Remove no_set_max_nreg() calls to allow injection of default hints
+        // if no explicit register hints were provided
         return Evaluate(0);
       }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (call->op.same_as(no_set_max_nreg())) {
// Remove the original set_max_nreg calls as they will be re-inserted
// at appropriate locations
return Evaluate(0);
if (call->op.same_as(no_set_max_nreg())) {
// Remove no_set_max_nreg() calls to allow injection of default hints
// if no explicit register hints were provided
return Evaluate(0);
🤖 Prompt for AI Agents
In src/transform/annotate_warp_group_reg_alloc.cc around lines 98 to 101, the
comment incorrectly states that "Remove the original set_max_nreg calls" while
the code only removes no_set_max_nreg() calls; update the comment to accurately
state that only no_set_max_nreg() calls are removed (or similar wording) so it
reflects the current behavior, e.g., change the comment to indicate removal of
no_set_max_nreg() calls which will be re-inserted later.

Expand Down Expand Up @@ -136,11 +135,9 @@ class SetMaxNRegInjector : public StmtExprMutator {
// Only inject if we have valid register hints and no SIMT copy
bool has_simt_copy = SimtCopyDetector::Detect(producer_body);

if (dec_reg >= 0 && inc_reg >= 0 && !has_simt_copy) {
auto inc_reg_num =
IntImm(DataType::Int(32), inc_reg == 0 ? 240 : inc_reg);
auto dec_reg_num =
IntImm(DataType::Int(32), dec_reg == 0 ? 24 : dec_reg);
if (dec_reg == 0 && inc_reg == 0 && !has_simt_copy) {
auto inc_reg_num = IntImm(DataType::Int(32), 240);
auto dec_reg_num = IntImm(DataType::Int(32), 24);
inc_reg_stmt = Evaluate(
Call(DataType::Handle(), set_max_nreg(), {inc_reg_num, 1}));
dec_reg_stmt = Evaluate(
Expand Down