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

Added changes to support AVX 10.1 support #269

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

rrwinterton
Copy link

detect AVX10.1 ISA

@facebook-github-bot
Copy link
Contributor

Hi @rrwinterton!

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!

src/x86/isa.c Outdated
/*
* AVX 10.1 instructions:
*/
isa.avx10_1 = (structured_feature_info1.edx & UINT32_C(1 << 19));
Copy link
Contributor

Choose a reason for hiding this comment

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

refer a UINT32_C constant like the others
Replace UINT32_C(1 << 19)
with UINT32_C(0x00080000)

To confirm the bits, I look at libyuv AVX10 support

It is in the same register as avxvnniint8
((cpu_einfo7[3] & 0x00000010) ? kCpuHasAVXVNNIINT8 : 0);
((cpu_einfo7[3] & 0x00080000) ? kCpuHasAVX10 : 0)

It looks right except in libyuv it checks for if ((GetXCR0() & 0xe0) == 0xe0) which says the OS supports saving ymm16 to ymm31.
So I think you should also check avx512_regs &&

Copy link
Author

Choose a reason for hiding this comment

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

The reason I didn't check for AVX512 is because in the future there may not be 512 on some systems that support AVX10.2 in 256 bit form but that is still TBD. I think it is a good idea for now since we can change this in the future if this is the case.

@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!

Copy link
Contributor

@fbarchard fbarchard left a comment

Choose a reason for hiding this comment

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

Comment about other avx10 is not needed and subject to change.
The 'avx512 registers' is a misnomer. The OSS indicates the OS supports saving 32 vector registers.

src/x86/isa.c Outdated
/*
* AVX 10.1 instructions:
*/
isa.avx10_1 = avx512_regs && !!(structured_feature_info1.edx & UINT32_C(0x00080000));
Copy link
Contributor

Choose a reason for hiding this comment

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

indent is wrong. Make it the same as lines above

Copy link
Contributor

Choose a reason for hiding this comment

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

to be clear, you should use 1 tab, not 4 spaces

tools/isa-info.c Outdated
@@ -70,6 +70,10 @@ int main(int argc, char** argv) {
printf("\tAVX512VP2INTERSECT: %s\n", cpuinfo_has_x86_avx512vp2intersect() ? "yes" : "no");
printf("\tAVX512_4VNNIW: %s\n", cpuinfo_has_x86_avx512_4vnniw() ? "yes" : "no");
printf("\tAVX512_4FMAPS: %s\n", cpuinfo_has_x86_avx512_4fmaps() ? "yes" : "no");

//avx10.1 (in future will add other avx10 version)
Copy link
Contributor

Choose a reason for hiding this comment

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

this comment is not needed and inconsistent with other printf's

tools/isa-info.c Outdated

//avx10.1 (in future will add other avx10 version)
printf("\tAVX10_1: %s\n", cpuinfo_has_x86_avx10_1() ? "yes" : "no");

Copy link
Contributor

Choose a reason for hiding this comment

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

remove blank lines. avx10_1 is an ISA and should be grouped with the rest

Copy link
Contributor

@malfet malfet Jan 8, 2025

Choose a reason for hiding this comment

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

CI have linter automation that should detect this

@rrwinterton rrwinterton changed the title Added changes to cpuinfo.h, isa.c and isa-info.c Added changes to support AVX 10.1 and AVX 10.2 support Jan 8, 2025
Copy link
Contributor

@fbarchard fbarchard left a comment

Choose a reason for hiding this comment

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

Change title for this PR to Added changes to support AVX 10.1
Have a follow up PR for 10.2

@malfet
Copy link
Contributor

malfet commented Jan 8, 2025

@rrwinterton can you please put a reference to some public doc on what AVX10 is and list 1-2 CPUs currently support it?

tools/isa-info.c Outdated Show resolved Hide resolved
@rrwinterton rrwinterton changed the title Added changes to support AVX 10.1 and AVX 10.2 support Added changes to support AVX 10.1 support Jan 8, 2025
src/x86/isa.c Outdated Show resolved Hide resolved
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.

5 participants