Skip to content

[Inductor max autotune] Make autotune_select_algorithm more robust - #124928

Closed
kadeng wants to merge 14 commits into
gh/kadeng/57/basefrom
gh/kadeng/57/head
Closed

kadeng wants to merge 14 commits into
gh/kadeng/57/basefrom
gh/kadeng/57/head

Conversation

@kadeng

@kadeng kadeng commented Apr 25, 2024 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

This diff makes sure that a custom exception is thrown when no valid
choices remain during autotuning. This allows to gracefully fall back
to a default choice, even if that default choice has not been passed to
autotune_select_algorithm.

Additionally, this diff handles RuntimeErrors during autotuning gracefully, e.g. the corresponding choice is ignored but it does not lead to the compilation failure of the entire model if a problematic choice is encountered during autotuning.
( An error is being logged, though).

Test Plan:
CI

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @peterbell10 @ipiszy @yf225 @chenyang78 @muchulee8 @ColinPeppler @amjames @desertfire @chauhang

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Apr 25, 2024 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/124928

Note: Links to docs will display an error until the docs builds have been completed.

✅ You can merge normally! (2 Unrelated Failures)

As of commit 9464a45 with merge base 8a0529e (image):

FLAKY - The following job failed but was likely due to flakiness present on trunk:

BROKEN TRUNK - The following job failed but was present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

[ghstack-poisoned]
[ghstack-poisoned]
@kadeng kadeng added the topic: not user facing topic category label Apr 25, 2024
[ghstack-poisoned]
@kadeng
kadeng requested a review from int3 May 2, 2024 10:10
@kadeng

kadeng commented May 2, 2024

Copy link
Copy Markdown
Contributor Author

@int3 I noticed you wrote a diff that's doing something similar. Will take a look and see that this one is still compatible with your changes.

Comment thread torch/_inductor/select_algorithm.py Outdated
Comment on lines +1123 to +1126
(not isinstance(selected_time, float))
or (selected_time < 0.0)
or (not math.isfinite(selected_time))
or math.isnan(selected_time)

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.

feels a little overkill (pretty sure we only generate inf and regular floats) but not a big deal

@int3

int3 commented May 2, 2024

Copy link
Copy Markdown
Contributor

Ah I didn't see you had this in the works. Yeah, this is more or less compatible with my changes. I can add my tests after you land this.

[ghstack-poisoned]
[ghstack-poisoned]
kadeng added a commit that referenced this pull request May 2, 2024
This diff makes sure that a custom exception is thrown when no valid
choices remain during autotuning. This allows to gracefully fall back
to a default choice, even if that default choice has not been passed to
autotune_select_algorithm.

Additionally, this diff handles RuntimeErrors during autotuning gracefully, e.g. the corresponding choice is ignored but it does not lead to the compilation failure of the entire model if a problematic choice is encountered during autotuning.
( An error is being logged, though).

TODO:
 * Add unit test
 * Add an assertion that we use autune_in_subproc when CUTLASS backend is enabled

ghstack-source-id: b092fce
Pull Request resolved: #124928
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
kadeng added a commit that referenced this pull request May 3, 2024
This diff makes sure that a custom exception is thrown when no valid
choices remain during autotuning. This allows to gracefully fall back
to a default choice, even if that default choice has not been passed to
autotune_select_algorithm.

Additionally, this diff handles RuntimeErrors during autotuning gracefully, e.g. the corresponding choice is ignored but it does not lead to the compilation failure of the entire model if a problematic choice is encountered during autotuning.
( An error is being logged, though).

TODO:
 * Add unit test
 * Add an assertion that we use autune_in_subproc when CUTLASS backend is enabled

ghstack-source-id: ed4af3c
Pull Request resolved: #124928
[ghstack-poisoned]
@kadeng
kadeng marked this pull request as ready for review May 4, 2024 05:12
[ghstack-poisoned]
kadeng added a commit that referenced this pull request May 4, 2024
This diff makes sure that a custom exception is thrown when no valid
choices remain during autotuning. This allows to gracefully fall back
to a default choice, even if that default choice has not been passed to
autotune_select_algorithm.

Additionally, this diff handles RuntimeErrors during autotuning gracefully, e.g. the corresponding choice is ignored but it does not lead to the compilation failure of the entire model if a problematic choice is encountered during autotuning.
( An error is being logged, though).

ghstack-source-id: 904251b
Pull Request resolved: #124928

@int3 int3 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.

lgtm

@kadeng

kadeng commented May 5, 2024

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge

@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label May 5, 2024
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge failed

Reason: 2 mandatory check(s) failed. The first few are:

Dig deeper by viewing the failures on hud

Details for Dev Infra team Raised by workflow job

Failing merge rule: Core Maintainers

[ghstack-poisoned]
kadeng added a commit that referenced this pull request May 5, 2024
This diff makes sure that a custom exception is thrown when no valid
choices remain during autotuning. This allows to gracefully fall back
to a default choice, even if that default choice has not been passed to
autotune_select_algorithm.

Additionally, this diff handles RuntimeErrors during autotuning gracefully, e.g. the corresponding choice is ignored but it does not lead to the compilation failure of the entire model if a problematic choice is encountered during autotuning.
( An error is being logged, though).

ghstack-source-id: 568b81b
Pull Request resolved: #124928
@kadeng

kadeng commented May 5, 2024

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@github-actions
github-actions Bot deleted the gh/kadeng/57/head branch June 5, 2024 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants