Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always enable IdModel-based indexing when resize is used #3567

Merged
merged 5 commits into from
Dec 11, 2024

Conversation

naoyam
Copy link
Collaborator

@naoyam naoyam commented Dec 11, 2024

I'm pretty much always assuming the new indexer is used when resize is involved, so enabling the new indexer automatically when resize is detected.

There are a couple of new issues found while running the tests.

} else {
EnableOptionsGuard::getCurOptions().unset(EnableOption::IdModel);
}
EnableOptionsGuard::getCurOptions().set(EnableOption::IdModel, {"all"});
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I still keep these options here because "all" also enables loop generation using IdModel, which is required for inlining. I should probably also enable that in lower2device.cpp, but that'll be a future PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changes here are just not running the tests without IdModel since it doen't make sense anymore.

@naoyam
Copy link
Collaborator Author

naoyam commented Dec 11, 2024

!test

@naoyam naoyam marked this pull request as ready for review December 11, 2024 01:47
@naoyam
Copy link
Collaborator Author

naoyam commented Dec 11, 2024

!test

@naoyam
Copy link
Collaborator Author

naoyam commented Dec 11, 2024

!test

1 similar comment
@naoyam
Copy link
Collaborator Author

naoyam commented Dec 11, 2024

!test

auto exprs = DependencyCheck::getAllExprsBetween(
{tv->getLogicalDomain().begin(), tv->getLogicalDomain().end()},
{tv->getMaybeAllocationDomain().begin(),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

One issue found here

@@ -845,14 +855,18 @@ std::vector<Val*> TensorIndexer::getIndexFor(
const auto& replacement_map = getIndexReplacementMap(
expr, as_consumer, info.loop_domains, for_loops, info.index_map);

const auto index_groups = traversalGraph().toGroups(index_ids);
// Note that IDs of index_ids may be mapped as the traversal graph
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Another issue found here. Previously, this function only returns a list of indices for a unique vector of ValGroups. This resulted in an error when the given index vector (index_ids) have mapped IDs.

@naoyam naoyam requested a review from jacobhinkle December 11, 2024 15:52
Copy link
Collaborator

@jacobhinkle jacobhinkle left a comment

Choose a reason for hiding this comment

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

LGTM

options.setProducerIndex(true);
options.setConsumerIndex(true);
options.setInlinePredicate(true);
options.setUnswitchPredicate(true);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we have options.setLoop(true) also?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nevermind, I see your comment in test_resize.cpp now.

@naoyam naoyam merged commit cd99c7d into main Dec 11, 2024
48 checks passed
@naoyam naoyam deleted the enable_id_model_for_resize branch December 11, 2024 17:17
naoyam added a commit that referenced this pull request Dec 13, 2024
Followup to #3567. I just found the Loop option is also necessary. With
this option, the inlining analysis uses IdModel to understand if
inlining is possible. The loop generation lowering pass also uses
IdModel loop promotion to figure out which iter domains to use for each
`ForLoop` node. The latter is not necessary for the resize scheduler at
this moment, though.
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