Skip to content

baby steps on patching inf/nan behavior & aten::amin support in nvfuser#75646

Closed
jjsjann123 wants to merge 6 commits intopytorch:masterfrom
jjsjann123:inf_nan_patch
Closed

baby steps on patching inf/nan behavior & aten::amin support in nvfuser#75646
jjsjann123 wants to merge 6 commits intopytorch:masterfrom
jjsjann123:inf_nan_patch

Conversation

@jjsjann123
Copy link
Collaborator

@jjsjann123 jjsjann123 commented Apr 12, 2022

Fixes #75622

  1. Instead of getting max/min_value for reduction init value, we go with (-)infinity instead so we can properly preserve inf inputs;
  2. Adding inf/(-)inf/nan for float value.
  3. Adding aten::amin in nvfuser (@kevinstephano @rdspring1 for review)

@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Apr 12, 2022

🔗 Helpful links

💊 CI failures summary and remediations

As of commit 80c232e (more details on the Dr. CI page):


💚 💚 Looks good so far! There are no failures yet. 💚 💚


This comment was automatically generated by Dr. CI (expand for details).

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

@facebook-github-bot facebook-github-bot added the oncall: jit Add this issue/PR to JIT oncall triage queue label Apr 12, 2022
@jjsjann123 jjsjann123 requested a review from ngimel April 12, 2022 02:57
@jjsjann123
Copy link
Collaborator Author

jjsjann123 commented Apr 12, 2022

cc'ing @kevinstephano @rdspring1

@jjsjann123 jjsjann123 changed the title baby steps on patching inf/nan behavior baby steps on patching inf/nan behavior & aten::amin support in nvfuser Apr 12, 2022
"Requires fusion optimization pass to be effective")
@unittest.skipIf(is_pre_volta(), "reduction not supported in pre volta device")
def test_inf_quick_patch(self):
x = torch.tensor([-float('inf'), -float('inf'), 4.0], device="cuda")
Copy link
Collaborator

Choose a reason for hiding this comment

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

This test is not enough to catch previously problematic values - you need input full of -inf (nothing else there) to catch that FLT_MIN is not the correct initializer, similarly for amin. You need yet another input for nan propagation (unless you have those tests in other places, in which case it's probably better to unify)

Copy link
Contributor

@rdspring1 rdspring1 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@kevinstephano kevinstephano left a comment

Choose a reason for hiding this comment

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

LGTM

@jjsjann123 jjsjann123 requested a review from ngimel April 12, 2022 21:02
@jjsjann123
Copy link
Collaborator Author

@pytorchbot merge this

@github-actions
Copy link
Contributor

Hey @jjsjann123.
You've committed this PR, but it does not have both a 'release notes: ...' and 'topics: ...' label. Please add one of each to the PR. The 'release notes: ...' label should represent the part of PyTorch that this PR changes (fx, autograd, distributed, etc) and the 'topics: ...' label should represent the kind of PR it is (not user facing, new feature, bug fix, perf improvement, etc). The list of valid labels can be found here for the 'release notes: ...' and here for the 'topics: ...'.
For changes that are 'topic: not user facing' there is no need for a release notes label.

facebook-github-bot pushed a commit that referenced this pull request Apr 14, 2022
…er (#75646)

Summary:
Fixes #75622

1. Instead of getting max/min_value for reduction init value, we go with (-)infinity instead so we can properly preserve inf inputs;
2. Adding inf/(-)inf/nan for float value.
3. Adding aten::amin in nvfuser (kevinstephano rdspring1 for review)

Pull Request resolved: #75646
Approved by: https://github.com/rdspring1, https://github.com/kevinstephano, https://github.com/ngimel

Test Plan: contbuild & OSS CI, see https://hud.pytorch.org/commit/pytorch/pytorch/692ebc8d8bbd10c21530254b29d458dc9b871386

Reviewed By: osalpekar

Differential Revision: D35618790

Pulled By: mehtanirav

fbshipit-source-id: 406965941919ad1777b74d36898709eb17580fa1
jjsjann123 added a commit to csarofeen/pytorch that referenced this pull request Apr 17, 2022
Fixes pytorch#75622

1. Instead of getting max/min_value for reduction init value, we go with (-)infinity instead so we can properly preserve inf inputs;
2. Adding inf/(-)inf/nan for float value.
3. Adding aten::amin in nvfuser (@kevinstephano @rdspring1 for review)
Pull Request resolved: pytorch#75646
Approved by: https://github.com/rdspring1, https://github.com/kevinstephano, https://github.com/ngimel
jjsjann123 added a commit to csarofeen/pytorch that referenced this pull request Apr 18, 2022
…er (#1588)

Fixes pytorch#75622

1. Instead of getting max/min_value for reduction init value, we go with (-)infinity instead so we can properly preserve inf inputs;
2. Adding inf/(-)inf/nan for float value.
3. Adding aten::amin in nvfuser (@kevinstephano @rdspring1 for review)
Pull Request resolved: pytorch#75646
Approved by: https://github.com/rdspring1, https://github.com/kevinstephano, https://github.com/ngimel
jjsjann123 added a commit to csarofeen/pytorch that referenced this pull request Apr 18, 2022
Fixes pytorch#75622

1. Instead of getting max/min_value for reduction init value, we go with (-)infinity instead so we can properly preserve inf inputs;
2. Adding inf/(-)inf/nan for float value.
3. Adding aten::amin in nvfuser (@kevinstephano @rdspring1 for review)
Pull Request resolved: pytorch#75646
Approved by: https://github.com/rdspring1, https://github.com/kevinstephano, https://github.com/ngimel
jjsjann123 added a commit to jjsjann123/nvfuser that referenced this pull request Oct 29, 2022
Fixes #75622

1. Instead of getting max/min_value for reduction init value, we go with (-)infinity instead so we can properly preserve inf inputs;
2. Adding inf/(-)inf/nan for float value.
3. Adding aten::amin in nvfuser (@kevinstephano @rdspring1 for review)
Pull Request resolved: pytorch/pytorch#75646
Approved by: https://github.com/rdspring1, https://github.com/kevinstephano, https://github.com/ngimel
jjsjann123 added a commit to jjsjann123/nvfuser that referenced this pull request Nov 10, 2022
Fixes #75622

1. Instead of getting max/min_value for reduction init value, we go with (-)infinity instead so we can properly preserve inf inputs;
2. Adding inf/(-)inf/nan for float value.
3. Adding aten::amin in nvfuser (@kevinstephano @rdspring1 for review)
Pull Request resolved: pytorch/pytorch#75646
Approved by: https://github.com/rdspring1, https://github.com/kevinstephano, https://github.com/ngimel
jjsjann123 added a commit to jjsjann123/nvfuser that referenced this pull request Nov 10, 2022
…er (#1588)

Fixes #75622

1. Instead of getting max/min_value for reduction init value, we go with (-)infinity instead so we can properly preserve inf inputs;
2. Adding inf/(-)inf/nan for float value.
3. Adding aten::amin in nvfuser (@kevinstephano @rdspring1 for review)
Pull Request resolved: pytorch/pytorch#75646
Approved by: https://github.com/rdspring1, https://github.com/kevinstephano, https://github.com/ngimel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla signed oncall: jit Add this issue/PR to JIT oncall triage queue open source

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NVFuser incorrectly computes max for extremal values

6 participants