Skip to content

Conversation

Mel-Chen
Copy link
Contributor

@Mel-Chen Mel-Chen commented Oct 7, 2025

Unlike AnyOf, FindLast/FindFirst are not related to an or operation. Therefore, it’s inappropriate to set the opcode of FindLast/FindFirst to Instruction::Or. Setting it to Instruction::Select is more appropriate.

This change also allows RecurrenceDescriptor::getReductionOpChain to find the recurrence chain for FindLast/FindFirst, which will help support in-loop FindLast/FindFirst reductions in the future.

Copy link
Contributor

@fhahn fhahn left a comment

Choose a reason for hiding this comment

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

LGTM, thanks.

Ths


// In-loop AnyOf and FindIV reductions are not yet supported.
RecurKind Kind = RdxDesc.getRecurrenceKind();
if (RecurrenceDescriptor::isAnyOfRecurrenceKind(Kind) ||
Copy link
Contributor

Choose a reason for hiding this comment

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

With this change, can we make Find* unreachable in getOpcode for now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is another way #163541. We only need to land either #163541 or this patch.
Please let me know which patch you prefer.

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