Skip to content

Make at::numeric_limits non CUDA-specific#50902

Closed
peterbell10 wants to merge 13 commits intogh/peterbell10/46/basefrom
gh/peterbell10/46/head
Closed

Make at::numeric_limits non CUDA-specific#50902
peterbell10 wants to merge 13 commits intogh/peterbell10/46/basefrom
gh/peterbell10/46/head

Conversation

@peterbell10
Copy link
Copy Markdown
Collaborator

@peterbell10 peterbell10 commented Jan 21, 2021

Stack from ghstack:

This allows numeric_limits to be used in code shared between CPU and CUDA
implementations.

This allows numeric_limits to be used in code shared between CPU and CUDA
implementations.

[ghstack-poisoned]
@facebook-github-bot
Copy link
Copy Markdown
Contributor

facebook-github-bot commented Jan 21, 2021

💊 CI failures summary and remediations

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


  • 4/4 failures possibly* introduced in this PR
    • 1/4 non-CircleCI failure(s)

🕵️ 3 new failures recognized by patterns

The following CI failures do not appear to be due to upstream breakages:

See CircleCI build pytorch_xla_linux_bionic_py3_6_clang9_build (1/3)

Step: "(Optional) Merge target branch" (full log | diagnosis details | 🔁 rerun)

Automatic merge failed; fix conflicts and then commit the result.
CONFLICT (add/add): Merge conflict in .circleci/scripts/setup_ci_environment.sh
Auto-merging .circleci/scripts/setup_ci_environment.sh
CONFLICT (add/add): Merge conflict in .circleci/docker/common/install_conda.sh
Auto-merging .circleci/docker/common/install_conda.sh
CONFLICT (add/add): Merge conflict in .circleci/config.yml
Auto-merging .circleci/config.yml
CONFLICT (add/add): Merge conflict in .circleci/cimodel/data/dimensions.py
Auto-merging .circleci/cimodel/data/dimensions.py
CONFLICT (add/add): Merge conflict in .circleci/README.md
Auto-merging .circleci/README.md
Automatic merge failed; fix conflicts and then commit the result.


Exited with code exit status 1

See CircleCI build pytorch_linux_xenial_cuda9_2_cudnn7_py3_gcc5_4_build (2/3)

Step: "(Optional) Merge target branch" (full log | diagnosis details | 🔁 rerun)

Automatic merge failed; fix conflicts and then commit the result.
CONFLICT (add/add): Merge conflict in .circleci/scripts/setup_ci_environment.sh
Auto-merging .circleci/scripts/setup_ci_environment.sh
CONFLICT (add/add): Merge conflict in .circleci/docker/common/install_conda.sh
Auto-merging .circleci/docker/common/install_conda.sh
CONFLICT (add/add): Merge conflict in .circleci/config.yml
Auto-merging .circleci/config.yml
CONFLICT (add/add): Merge conflict in .circleci/cimodel/data/dimensions.py
Auto-merging .circleci/cimodel/data/dimensions.py
CONFLICT (add/add): Merge conflict in .circleci/README.md
Auto-merging .circleci/README.md
Automatic merge failed; fix conflicts and then commit the result.


Exited with code exit status 1

See CircleCI build pytorch_linux_xenial_py3_6_gcc5_4_build (3/3)

Step: "(Optional) Merge target branch" (full log | diagnosis details | 🔁 rerun)

Automatic merge failed; fix conflicts and then commit the result.
CONFLICT (add/add): Merge conflict in .circleci/scripts/setup_ci_environment.sh
Auto-merging .circleci/scripts/setup_ci_environment.sh
CONFLICT (add/add): Merge conflict in .circleci/docker/common/install_conda.sh
Auto-merging .circleci/docker/common/install_conda.sh
CONFLICT (add/add): Merge conflict in .circleci/config.yml
Auto-merging .circleci/config.yml
CONFLICT (add/add): Merge conflict in .circleci/cimodel/data/dimensions.py
Auto-merging .circleci/cimodel/data/dimensions.py
CONFLICT (add/add): Merge conflict in .circleci/README.md
Auto-merging .circleci/README.md
Automatic merge failed; fix conflicts and then commit the result.


Exited with code exit status 1


Extra GitHub checks: 1 failed


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

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

This allows numeric_limits to be used in code shared between CPU and CUDA
implementations.

[ghstack-poisoned]
This allows numeric_limits to be used in code shared between CPU and CUDA
implementations.

[ghstack-poisoned]
@peterbell10 peterbell10 requested a review from mruberry January 21, 2021 21:03
This allows numeric_limits to be used in code shared between CPU and CUDA
implementations.

[ghstack-poisoned]
This allows numeric_limits to be used in code shared between CPU and CUDA
implementations.

[ghstack-poisoned]
This allows numeric_limits to be used in code shared between CPU and CUDA
implementations.

[ghstack-poisoned]
This allows numeric_limits to be used in code shared between CPU and CUDA
implementations.

[ghstack-poisoned]
This allows numeric_limits to be used in code shared between CPU and CUDA
implementations.

[ghstack-poisoned]
#include <float.h>

// NumericLimits.h is a holder for numeric limits definitions of commonly used
// types. This header is very specific to ROCm HIP and may be removed in the
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

cc @ngimel

If this file is really intended only to support ROCm and std::numeric_limits is preferred, should we really make this change?

Follow-up question: has ROCm fixed its std::numeric_limits handling since this was written? Is it still necessary?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

cc @jeffdaily for ROCm question. ROCm has improved a lot since this was written, it's very possible that it's no longer needed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

std and var are implemented in SharedReduceOps.h which gets included in both CPU and CUDA code. So, this is useful, assuming the file is still necessary for ROCm compilation.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'll need a bit of time to confirm the ROCm question.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hey @jeffdaily - do you have an idea for how long this will take to review?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would like confirmation if the support of std::numeric_limits is limited to ROCm and not CUDA? I can't tell whether CUDA supports all features of numeric_limits?

Copy link
Copy Markdown
Collaborator Author

@peterbell10 peterbell10 Feb 6, 2021

Choose a reason for hiding this comment

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

Everything in std::numeric_limits is constexpr, so at least in theory should work in CUDA device code when the nvcc flag --expt-relaxed-constexpr is used (which PyTorch does).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

cc @ptrblck and @zasdfgbnm

Does CUDA support std::numeric_limits? @colesbury's comment in this file says it does.

I don't want to take much more time on this issue, however. @peterbell10 can we just run the CI with this file removed and std::numeric_limits used and see what happens?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Seems to be compiling fine when I use std::numeric_limits inside of at::numeric_limits. However, it occurs to me that the warning is meaningless since the functions in at::numeric_limits have different names and meanings from the standard std::numeric_limits functions.

Either way, that should mean I don't need the changes in this PR any more.

This allows numeric_limits to be used in code shared between CPU and CUDA
implementations.

[ghstack-poisoned]
peterbell10 added a commit to peterbell10/pytorch that referenced this pull request Jan 29, 2021
This allows numeric_limits to be used in code shared between CPU and CUDA
implementations.

ghstack-source-id: e682efb
Pull Request resolved: pytorch#50902
This allows numeric_limits to be used in code shared between CPU and CUDA
implementations.

[ghstack-poisoned]
This allows numeric_limits to be used in code shared between CPU and CUDA
implementations.

[ghstack-poisoned]
This allows numeric_limits to be used in code shared between CPU and CUDA
implementations.

[ghstack-poisoned]
This allows numeric_limits to be used in code shared between CPU and CUDA
implementations.

[ghstack-poisoned]
@peterbell10 peterbell10 closed this Feb 8, 2021
@facebook-github-bot facebook-github-bot deleted the gh/peterbell10/46/head branch March 11, 2021 15:14
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.

6 participants