Skip to content

[TIRx][Schedule] Support rfactor for arg reducers selecting last index#19909

Open
ZephyrLi-pro wants to merge 1 commit into
apache:mainfrom
ZephyrLi-pro:pr2-arg-reduction-rfactor
Open

[TIRx][Schedule] Support rfactor for arg reducers selecting last index#19909
ZephyrLi-pro wants to merge 1 commit into
apache:mainfrom
ZephyrLi-pro:pr2-arg-reduction-rfactor

Conversation

@ZephyrLi-pro

Copy link
Copy Markdown
Contributor

This PR extends rfactor reducer pattern matching to support TOPI argmax/argmin with select_last_index=True.

For select_last_index=True, ties should be resolved by choosing the larger index. The added reducer patterns preserve the existing value comparison semantics, then use lhs_idx > rhs_idx as the tie-break condition.

Tests are added for applying rfactor to topi.argmax and topi.argmin with select_last_index=True.

@ZephyrLi-pro ZephyrLi-pro force-pushed the pr2-arg-reduction-rfactor branch from 4fcb683 to 590577a Compare June 29, 2026 09:38

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for argmax and argmin reducers with select_last_index=True (preferring the last occurrence) in the TIR schedule reduction primitive. It adds the corresponding reducer implementations in reduction.cc and includes comprehensive unit tests in test_tir_schedule_rfactor.py to verify the correctness of rfactor scheduling on these new reducers. There are no review comments, so we have no additional feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@yongwww

yongwww commented Jul 2, 2026

Copy link
Copy Markdown
Member

@tvm-bot rerun

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants