Skip to content

Purge MINIFIER_SPAWNED#90089

Closed
voznesenskym wants to merge 5 commits intogh/voznesenskym/24/basefrom
gh/voznesenskym/24/head
Closed

Purge MINIFIER_SPAWNED#90089
voznesenskym wants to merge 5 commits intogh/voznesenskym/24/basefrom
gh/voznesenskym/24/head

Conversation

@voznesenskym
Copy link
Collaborator

@voznesenskym voznesenskym commented Dec 2, 2022

Purge MINIFIER_SPAWNED

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Dec 2, 2022

🔗 Helpful Links

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

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

❌ 1 Failures

As of commit 6bd7b90:

The following jobs have failed:

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

voznesenskym added a commit that referenced this pull request Dec 2, 2022
Purge MINIFIER_SPAWNED

ghstack-source-id: 718020a
Pull Request resolved: #90089
@voznesenskym voznesenskym changed the title Purge Purge MINIFIER_SPAWNED Dec 2, 2022
)
)
return True
raise
Copy link
Contributor

Choose a reason for hiding this comment

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

??

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We need this as it moved to runtime

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, well, if you want to change the behavior here, you need to at least update the warning above.

But the original intent of squelching the error still seems valid; if you get stuck on an unrelated exception, you're never going to get to the actual failure that you wanted to minify. So I don't really understand your stated justification...

Purge MINIFIER_SPAWNED

cc mlazos soumith yanboliang penguinwu anijain2305 EikanWang jgong5 Guobing-Chen chunyuan-w XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx desertfire

[ghstack-poisoned]
voznesenskym added a commit that referenced this pull request Dec 2, 2022
Purge MINIFIER_SPAWNED

ghstack-source-id: c34b211
Pull Request resolved: #90089

lint
@voznesenskym voznesenskym added the topic: not user facing topic category label Dec 3, 2022
Purge MINIFIER_SPAWNED

cc mlazos soumith yanboliang penguinwu anijain2305 EikanWang jgong5 Guobing-Chen chunyuan-w XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx desertfire

[ghstack-poisoned]
@voznesenskym voznesenskym requested a review from ezyang December 3, 2022 19:19
return gm
def backend_accuracy_eval_fwd(*args):
# Set the eval mode to remove randomness.
gm.eval()
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like an unnecessary behavior change; previously gm was changed to eval() mode at compile time, now it is reset to eval time every runtime.

...arguably we shouldn't be changing the model to eval mode at all, doesn't this mean running with accuracy minifier changes the results of your model...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point, let's go back to the prior way where we ensure we compile.

return not same_two_models(gm, compiled_gm, args)

# (4) Check Accuracy
if not same_two_models(gm, compiled_gm, args):
Copy link
Contributor

Choose a reason for hiding this comment

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

Use module_fails_accuracy?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure :)

minifier(
gm,
example_inputs,
module_fails=module_fails_accuracy,
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks questionable. The original fails_fn recompiles the passed in gm. However, your fails_fn here simply reuses the original compiled_gm as is. This seems wrong: I'd expect the minifier to be modifying the gm passed in and expecting it to recompile. Without recompiling it I find it hard to see how the minifier could do the correct thing here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point, I bet it minifies but not the same way, as the backend is taken out. Let me revisit this.

Copy link
Contributor

@ezyang ezyang left a comment

Choose a reason for hiding this comment

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

The new code looks buggy

Purge MINIFIER_SPAWNED

cc mlazos soumith yanboliang penguinwu anijain2305 EikanWang jgong5 Guobing-Chen chunyuan-w XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx desertfire

[ghstack-poisoned]
Purge MINIFIER_SPAWNED

cc mlazos soumith yanboliang penguinwu anijain2305 EikanWang jgong5 Guobing-Chen chunyuan-w XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx desertfire

[ghstack-poisoned]
voznesenskym added a commit that referenced this pull request Dec 4, 2022
Purge MINIFIER_SPAWNED

ghstack-source-id: 988c850
Pull Request resolved: #90089

lint

Feedback

Comments
@voznesenskym voznesenskym requested a review from ezyang December 4, 2022 17:48
@albanD albanD removed their request for review December 5, 2022 15:30

return not same_two_models(gm, compiled_gm, example_inputs, only_fwd)
if real_args is None:
real_args = example_inputs
Copy link
Contributor

Choose a reason for hiding this comment

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

Is example inputs expected to be non-fake if real args is None?

return gm
# (4) Bind the current compiler_fn and real_args to accuracy_eval
# We need to do this in order to ensure that (a) we correctly recompile on every
# minification, and (b) that the args captured here, in the runtime, are passed to eval
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment is backwards. To "correctly recompile on every minification", the bug in https://github.com/pytorch/pytorch/pull/90089/files/ae9f856428538468b5da8825e9d796790b010db6#r1038871303 was that you didn't pass backend_accuracy_fails to the minifier at all. Binding compiler_fn/real_args has nothing to do with ensuring that we actually recompile; you must bind them for the simpler reason that the minifier isn't going to pass those arguments directly lol

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, it would be good to understand why the minifier tests did not capture this case; maybe there is a simple test that can be added for this bug.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This comment is backwards. To "correctly recompile on every minification", the bug in https://github.com/pytorch/pytorch/pull/90089/files/ae9f856428538468b5da8825e9d796790b010db6#r1038871303 was that you didn't pass backend_accuracy_fails to the minifier at all. Binding compiler_fn/real_args has nothing to do with ensuring that we actually recompile; you must bind them for the simpler reason that the minifier isn't going to pass those arguments directly lol

I was passing a different function, identical to this except for recompilation. So now I'm confused by what you mean.

Copy link
Contributor

Choose a reason for hiding this comment

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

The comment says "Bind the current compiler_fn and real_args to accuracy_eval; we need to do this". I parse this as "we need to [Bind the current compiler_fn and real_args]". Let's suppose I removed this binding. Then I would expect this code to fail with "not enough parameters passed".

Copy link
Contributor

@ezyang ezyang left a comment

Choose a reason for hiding this comment

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

I'm still very skeptical about the change in same_two_models. There are also comments I'd like to see addressed.

@ezyang ezyang requested a review from anijain2305 December 5, 2022 16:38
@voznesenskym
Copy link
Collaborator Author

@anijain2305 ping

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2023

Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as Stale.
Feel free to remove the Stale label if you feel this was a mistake.
If you are unable to remove the Stale label please contact a maintainer in order to do so.
If you want the bot to never mark this PR stale again, add the no-stale label.
Stale pull requests will automatically be closed after 30 days of inactivity.

@github-actions github-actions bot added the Stale label Feb 4, 2023
@facebook-github-bot facebook-github-bot deleted the gh/voznesenskym/24/head branch June 8, 2023 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants