-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
For Apple silicon, use machdep.cpu.brand_string in preference to decoding hw.machine #246
base: main
Are you sure you want to change the base?
Conversation
Hi @dlenski! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
@@ -275,7 +294,8 @@ void cpuinfo_arm_mach_init(void) { | |||
.core_start = i * cores_per_package, | |||
.core_count = cores_per_package, | |||
}; | |||
decode_package_name(packages[i].name); | |||
if (!read_package_name_from_brand_string(packages[i].name)) | |||
decode_package_name_from_hw_machine(packages[i].name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic in decode_package_name_from_hw_machine
has already become somewhat obsolete, which is why it makes sense to prefer read_package_name_from_brand_string
wherever it succeeds on newer devices/OSes.
For example, the package in iPhone 15 Pro should be described as Apple A17 Pro, rather than simply A17 (which is what the current logic would show, according to the hw.machine
values shown at: https://gist.github.com/adamawolf/3048717#file-apple_mobile_device_types-txt-L55-L56).
…ding hw.machine This functionality was implemented in pytorch#65 ("Updated package.name to also query machdep.cpu.brand_string if decode of hw.machine fails"), but then it was omitted from the subsequent pytorch#100, probably inadvertently. Adding that functionality back here, so that the package/device name can be shown correctly on recent devices and macOS/iOS versions. I have reversed the order so that `machdep.cpu.brand_string` is checked before attempting to decode `hw.machine`, since the former appears to be more future-proof. Before this change, on a recent MacBook Pro: $ cpu-info ... Debug (cpuinfo): hw.machine: arm64 Warning in cpuinfo: parsing "hw.machine" failed: Undefined error: 0 ... Packages: 0: After this change: $ cpu-info ... Debug (cpuinfo): machdep.cpu.brand_string: Apple M2 Pro ... Packages: 0: Apple M2 Pro
This functionality was implemented in #65 ("Updated package.name to also query machdep.cpu.brand_string if decode of hw.machine fails"), but then it was omitted from the subsequent #100, probably inadvertently.
Adding that functionality back here, so that the package/device name can be shown correctly on recent devices and macOS/iOS versions. I have reversed the order so that
machdep.cpu.brand_string
is checked before attemptingto decode
hw.machine
, since the former appears to be more future-proof.Before this change, on a recent MacBook Pro:
After this change: