KEMBAR78
[C10] cpuinfo error handling by malfet · Pull Request #113771 · pytorch/pytorch · GitHub
Skip to content

Conversation

@malfet
Copy link
Contributor

@malfet malfet commented Nov 15, 2023

Stack from ghstack (oldest at bottom):

If cpuinfo_initalize returns false, call to subsequent cpuinfo functions may result in abort()
Also, defaultNumThreads() method is assumption if one method fails then try another, and finally return 1.

Alas there are no good way to test it on x86 platform, but on ARM one can replicate it by running sudo chmod 750 /sys and then python3 -c "import torch;torch._C.profiler.gather_traceback(True, True, True)"

🤖 Generated by Copilot at 4d942e8

cpuinfo fails
avoid undefined behavior
check before you count

Partially addresses #113568

If `cpuinfo_initalize` returns false, call to subsequent cpuinfo functions may result in `abort()`
Also, `defaultNumThreads()` method is assumption if one method fails then try another, and finally return 1.

Partially addresses #113568

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Nov 15, 2023

🔗 Helpful Links

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

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

✅ No Failures

As of commit 4d942e8 with merge base 9146ca6 (image):
💚 Looks good so far! There are no failures yet. 💚

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

malfet added a commit that referenced this pull request Nov 15, 2023
If `cpuinfo_initalize` returns false, call to subsequent cpuinfo functions may result in `abort()`
Also, `defaultNumThreads()` method is assumption if one method fails then try another, and finally return 1.

Partially addresses #113568

ghstack-source-id: 61b4198
Pull Request resolved: #113771
@malfet malfet requested a review from a team November 15, 2023 16:20
@malfet
Copy link
Contributor Author

malfet commented Nov 15, 2023

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Nov 15, 2023
@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: This PR needs a release notes: label
If your changes are user facing and intended to be a part of release notes, please use a label starting with release notes:.

If not, please add the topic: not user facing label.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "topic: not user facing"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Details for Dev Infra team Raised by workflow job

@malfet malfet added release notes: python_frontend python frontend release notes category topic: bug fixes topic category labels Nov 15, 2023
@malfet
Copy link
Contributor Author

malfet commented Nov 15, 2023

@pytorchbot merge

@pytorchmergebot
Copy link
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 pushed a commit that referenced this pull request Nov 18, 2023
It can fail on ARM platform if `/sys` folder is not accessible.
In that case, call `std::thread::hardware_concurrency()`, which is
aligned with the thread_pool initialization logic of `c10::TaskThreadPoolBase:defaultNumThreads()`

Further addresses issue raised in #113568
Pull Request resolved: #114011
Approved by: https://github.com/kit1980
ghstack dependencies: #113771
@facebook-github-bot facebook-github-bot deleted the gh/malfet/53/head branch November 19, 2023 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged release notes: python_frontend python frontend release notes category topic: bug fixes topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants