Skip to content
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

Fixing Ampere Altra Processor detection #237

Merged
merged 2 commits into from
Apr 17, 2024

Conversation

ozanMSFT
Copy link
Contributor

@ozanMSFT ozanMSFT commented Apr 11, 2024

Summary:

Resolves #236

Also related to PR 220 change.

"Unknown chip model name 'Ampere(R) Altra(R) Processor'.
Please add new Windows on Arm SoC/chip support to arm/windows/init.c!"

Previous error details:

The error's reason was:

woa_chip_name (windows-arm-init.h) enum had only 4 elements (stored in woa_chip_name_last)

enum woa_chip_name {
	woa_chip_name_microsoft_sq_1 = 0,
	woa_chip_name_microsoft_sq_2 = 1,
	woa_chip_name_microsoft_sq_3 = 2,
	woa_chip_name_ampere_altra = 3,
	woa_chip_name_unknown = 4,
	woa_chip_name_last = woa_chip_name_unknown
};

However, woa_chips[] (init.c) has a duplicated value for woa_chip_name_microsoft_sq_3 due to different strings for same target after the PR 220

Strings are Snapdragon (TM) 8cx Gen 3 and Snapdragon Compute Platform

And this was causing following for loop (init.c) is not checking for all elements in woa_chips[].

for (uint32_t i = 0; i < (uint32_t)woa_chip_name_last; i++) {
	size_t compare_length = wcsnlen(woa_chips[i].chip_name_string, CPUINFO_PACKAGE_NAME_MAX);
	int compare_result = wcsncmp(text_buffer, woa_chips[i].chip_name_string, compare_length);
	if (compare_result == 0) {
		chip_info = woa_chips + i;
		break;
	}
}

Fix Details:

We added woa_chip_name_microsoft_sq_3_devkit to maintain one to one relationship between woa_chip_name (windows-arm-init.h) and woa_chips[] (init.c).

Also, we especially specified indexes with enums to prevent future duplications and increase readability of the code and relationship.

@facebook-github-bot
Copy link
Contributor

Hi @ozanMSFT!

Thank you for your pull request and welcome to our community.

Action Required

In 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.

Process

In 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 CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@everton1984
Copy link
Contributor

@ozanMSFT Thanks for the update, sorry as I had no other hardware to test. The changes look fair.

@kit1980 kit1980 requested a review from malfet April 15, 2024 17:44
@malfet malfet merged commit 5de5c70 into pytorch:main Apr 17, 2024
11 checks passed
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.

Ampere(R) Altra(R) Processor - CPU Detection Error
4 participants