-
Notifications
You must be signed in to change notification settings - Fork 319
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
Use sysctls available in macOS 12/iOS 15 for Apple silicon #65
Use sysctls available in macOS 12/iOS 15 for Apple silicon #65
Conversation
The patch applies to ARM and should not change any behavior for x86_64 / Intel. In general, it'll use newer sysctls when they're available, but fallback to previous implementations when they're not present. Newer sysctls are available in iOS 15 and macOS Monterey 12. - Added FHM ARM ISA feature - Added support for Apple chips to have different cache configurations for the different core types in the same package - Updated cache-info to print various cache configurations if multiple are present - Updated package.name to also query machdep.cpu.brand_string if decode of hw.machine fails - Updated README.md to include macOS ARM64 support Example output: Previous cpu-info running on macOS / M1: Packages: 0: Microarchitectures: 4x Firestorm 4x Icestorm Cores: 0: 1 processor (0), Apple Firestorm 1: 1 processor (1), Apple Firestorm 2: 1 processor (2), Apple Firestorm 3: 1 processor (3), Apple Firestorm 4: 1 processor (4), Apple Icestorm 5: 1 processor (5), Apple Icestorm 6: 1 processor (6), Apple Icestorm 7: 1 processor (7), Apple Icestorm Logical processors: 0 1 2 3 4 5 6 7 cpu-info running on macOS / M1 after patch: Packages: 0: Apple M1 Microarchitectures: 4x Firestorm 4x Icestorm Cores: 0: 1 processor (0), Apple Firestorm 1: 1 processor (1), Apple Firestorm 2: 1 processor (2), Apple Firestorm 3: 1 processor (3), Apple Firestorm 4: 1 processor (4), Apple Icestorm 5: 1 processor (5), Apple Icestorm 6: 1 processor (6), Apple Icestorm 7: 1 processor (7), Apple Icestorm Logical processors: 0 1 2 3 4 5 6 7 Previous isa-info running on macOS / M1: Instruction sets: ARM v8.1 atomics: yes ARM v8.1 SQRDMLxH: no ARM v8.2 FP16 arithmetics: yes ARM v8.3 dot product: yes ARM v8.3 JS conversion: no ARM v8.3 complex: no SIMD extensions: ARM SVE: no ARM SVE 2: no Cryptography extensions: AES: yes SHA1: yes SHA2: yes PMULL: yes CRC32: yes isa-info running on macOS Monterey 12 / M1 after patch: Instruction sets: ARM v8.1 atomics: yes ARM v8.1 SQRDMLxH: yes ARM v8.2 FP16 arithmetics: yes ARM v8.2 FHM: yes ARM v8.3 dot product: yes ARM v8.3 JS conversion: yes ARM v8.3 complex: yes SIMD extensions: ARM SVE: no ARM SVE 2: no Cryptography extensions: AES: yes SHA1: yes SHA2: yes PMULL: yes CRC32: yes Previous cache-info running on macOS / M1: Max cache size (upper bound): 4194304 bytes L1 instruction cache: 8 x 128 KB, 4-way set associative (256 sets), 128 byte lines, shared by 1 processors L1 data cache: 8 x 64 KB, 4-way set associative (128 sets), 128 byte lines, shared by 1 processors L2 data cache: 4 MB (exclusive), 8-way set associative (4096 sets), 128 byte lines, shared by 8 processors cache-info running on macOS Monterey 12 / M1 after patch: Max cache size (upper bound): 12582912 bytes L1 instruction cache: 4 x 192 KB, 4-way set associative (384 sets), 128 byte lines, shared by 1 processors L1 instruction cache: 4 x 128 KB, 4-way set associative (256 sets), 128 byte lines, shared by 1 processors L1 data cache: 4 x 128 KB, 4-way set associative (256 sets), 128 byte lines, shared by 1 processors L1 data cache: 4 x 64 KB, 4-way set associative (128 sets), 128 byte lines, shared by 1 processors L2 data cache: 12 MB (exclusive), 8-way set associative (12288 sets), 128 byte lines, shared by 4 processors L2 data cache: 4 MB (exclusive), 8-way set associative (4096 sets), 128 byte lines, shared by 4 processors
Hi @Developer-Ecosystem-Engineering! 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! |
Closing as duplicated in #96 |
…ne fails 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.
…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. Before this change, on MacBook: $ cpu-info ... Warning (cpuinfo): parsing "hw.machine" failed ... Packages: 0: After this change: $ cpu-info ... Debug (cpuinfo): machdep.cpu.brand_string: Apple M2 Pro ... Packages: 0: Apple M2 Pro
…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. Before this change, on a recent MacBook Pro: $ cpu-info ... Warning (cpuinfo): parsing "hw.machine" failed ... Packages: 0: After this change: $ cpu-info ... Debug (cpuinfo): machdep.cpu.brand_string: Apple M2 Pro ... Packages: 0: Apple M2 Pro
…ding hw.machine This functionality was implemented in pytorch#65 (described as "Updated package.name to also query machdep.cpu.brand_string if decode of hw.machine fails"), but then it was omitted from the subsequent refactoring in 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 ... Warning (cpuinfo): parsing "hw.machine" failed ... Packages: 0: After this change: $ cpu-info ... Debug (cpuinfo): machdep.cpu.brand_string: Apple M2 Pro ... Packages: 0: Apple M2 Pro
…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. 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
…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
…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
The patch applies to ARM and should not change any behavior for x86_64 / Intel. In general, it'll use newer sysctls when they're available, but fallback to previous implementations when they're not present. Newer sysctls are available in iOS 15 and macOS Monterey 12.
Example output:
Previous cpu-info running on macOS / M1:
cpu-info running on macOS / M1 after patch:
Previous isa-info running on macOS / M1:
isa-info running on macOS Monterey 12 / M1 after patch:
Previous cache-info running on macOS / M1:
cache-info running on macOS Monterey 12 / M1 after patch: