Skip to content

Add x86 ACEV1 ISA detection - #454

Open
fbarchard wants to merge 1 commit into
pytorch:mainfrom
fbarchard:ace
Open

fbarchard wants to merge 1 commit into
pytorch:mainfrom
fbarchard:ace

Conversation

@fbarchard

@fbarchard fbarchard commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Detect x86 AI Compute Extensions (ACE v1) in cpuinfo_x86_detect_isa, expose cpuinfo_has_x86_ace_v1(), and print ACE_V1 support in isa-info. Use ace_v1 in struct cpuinfo_x86_isa (with an inline comment distinguishing it from VIA PadLock) so the existing VIA PadLock ace field remains untouched.

Specification Reference

Per Section 3.2 (Detection Algorithm), Section 15.4.1, and Appendix A of the x86 Ecosystem Advisory Group's AI Compute Extensions (ACE) Specification v1.15:

  1. OS XSAVE state enabled (CR4.OSXSAVE = 1, CPUID.01H:ECX[27:26] = 0b11):
    • AVX-512 state: XCR0[7:5] = 0b111 and XCR0[2:1] = 0b11 (0x000000E6, avx512_regs)
    • ACE state: XCR0[20,18:17] = 0b111 (0x00160000, ace_regs — TILECFG bit 17, TILEDATA bit 18, and 128-byte SCALEDATA/BSR bit 20)
  2. CPUID feature flags:
    • (AVX10.1 && AVX10_V1_AUX) || AVX10.2, where AVX10_V1_AUX is CPUID.(EAX=24H, ECX=01H):ECX[2]
    • AVX10_V2_AUX: CPUID.(EAX=24H, ECX=01H):ECX[3]
    • ACE: CPUID.(EAX=07H, ECX=01H):ECX[11]
    • MAX_PALETTE >= 2: CPUID.(EAX=1DH, ECX=00H):EAX >= 2
    • ACE_VSN >= 1: CPUID.(EAX=1DH, ECX=02H):EAX[7:0] >= 1

Testing

Verified under Intel SDE 10.13.1:

cmake -B build && cmake --build build
ctest --test-dir build --output-on-failure
sde64 -spr -- ./build/isa-info                                # ACE_V1: no
sde64 -gnr -- ./build/isa-info                                # ACE_V1: no
sde64 -dmr -- ./build/isa-info                                # ACE_V1: no
sde64 -future-ag -- ./build/isa-info                          # ACE_V1: yes
sde64 -future-ag -xsave_default 0x600e7 -- ./build/isa-info   # ACE_V1: no
sde64 -future-ag -xsave_default 0x1600e7 -- ./build/isa-info  # ACE_V1: yes

@meta-cla meta-cla Bot added the cla signed label Nov 2, 2026
Comment thread include/cpuinfo.h Outdated
bool sha;
bool rng;
bool ace;
bool padlock_ace;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what is this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

struct cpuinfo_x86_isa already had a legacy bool ace field for VIA PadLock cryptography (if (vendor == cpuinfo_vendor_via)), which collided with adding bool ace for x86 AI Compute Extensions. Removed padlock_ace so VIA PadLock's ace field is untouched, and named the new internal struct member ace_v1 (matching avx10_1 / avx10_2) while keeping cpuinfo_has_x86_ace() unchanged.

@kimishpatel

Copy link
Copy Markdown
Contributor

please add how you arrive at these values I guess. or if it tested on some hardware then add details

@fbarchard fbarchard changed the title Add x86 ACE ISA detection Add x86 ACEV1 ISA detection Nov 10, 2026
@fbarchard

Copy link
Copy Markdown
Contributor Author

Updated the PR description and inline code comments with the exact CPUID and XCR0 bit definitions from Section 3.2 (Detection Algorithm), Section 15.4.1, and Appendix A of the x86 Ecosystem Advisory Group's AI Compute Extensions (ACE) Specification v1.15, and verified isa-info under Intel SDE 10.13.1 (-spr, -gnr, -dmr -> ACE: no; -future-ag -> ACE: yes). Also removed padlock_ace in favor of ace_v1 in struct cpuinfo_x86_isa so the existing VIA PadLock ace field is untouched.

Comment thread include/cpuinfo.h Outdated
* Reference: AI Compute Extensions (ACE) Specification v1.15, Section 3.2:
* https://x86ecosystem.org/wp-content/uploads/2026/06/ACE_v1_Specification_public_1_15.pdf
*/
static inline bool cpuinfo_has_x86_ace(void) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI review: Naming the field ace_v1 avoids the clash inside the struct, but the public function is still cpuinfo_has_x86_ace(). Every other cpuinfo_has_x86_X() returns cpuinfo_isa.X, and cpuinfo_isa.ace is already VIA PadLock ACE. Linux also calls the PadLock flag ace in /proc/cpuinfo. So readers will expect this function to return the PadLock bit. The header says the struct is not stable API but the functions are, so the function name is the part that is hard to change later. Could you call it cpuinfo_has_x86_ace_v1(), like cpuinfo_has_x86_avx10_1(), and print ACE_V1 in isa-info? A one-line comment on the field saying it is AI Compute Extensions, not PadLock, would also help.

Comment thread include/cpuinfo.h Outdated
* Reference: AI Compute Extensions (ACE) Specification v1.15, Section 3.2:
* https://x86ecosystem.org/wp-content/uploads/2026/06/ACE_v1_Specification_public_1_15.pdf
*/
static inline bool cpuinfo_has_x86_ace(void) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI review: Naming the field ace_v1 avoids the clash inside the struct, but the public function is still cpuinfo_has_x86_ace(). Every other cpuinfo_has_x86_X() returns cpuinfo_isa.X, and cpuinfo_isa.ace is already VIA PadLock ACE. Linux also calls the PadLock flag ace in /proc/cpuinfo. So readers will expect this function to return the PadLock bit. The header says the struct is not stable API but the functions are, so the function name is the part that is hard to change later. Could you call it cpuinfo_has_x86_ace_v1(), like cpuinfo_has_x86_avx10_1(), and print ACE_V1 in isa-info? A one-line comment on the field saying it is AI Compute Extensions, not PadLock, would also help.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done — rebased onto main, renamed the public accessor to cpuinfo_has_x86_ace_v1() (matching cpuinfo_has_x86_avx10_1()), updated isa-info to print ACE_V1, and added an inline comment on cpuinfo_x86_isa.ace_v1 noting that it is x86 AI Compute Extensions v1 rather than VIA PadLock ACE.

Detect x86 AI Compute Extensions (ACE v1) in cpuinfo_x86_detect_isa,
expose cpuinfo_has_x86_ace_v1(), and print ACE_V1 support in isa-info.
Use ace_v1 in struct cpuinfo_x86_isa so the existing VIA PadLock ace
field remains untouched.

Per Section 3.2 (Detection Algorithm) of the AI Compute Extensions (ACE)
Specification v1.15:
https://x86ecosystem.org/wp-content/uploads/2026/06/ACE_v1_Specification_public_1_15.pdf

1. OS XSAVE state enabled (CR4.OSXSAVE = 1, CPUID.01H:ECX[27:26] = 11b):
   - AVX-512 state: XCR0[7:5] = 111b and XCR0[2:1] = 11b (0x000000E6)
   - ACE state: XCR0[20,18:17] = 111b (0x00160000: TILECFG bit 17,
     TILEDATA bit 18, and SCALEDATA/BSR bit 20)
2. CPUID feature flags:
   - (AVX10.1 && AVX10_V1_AUX) || AVX10.2, with AVX10_V1_AUX in
     CPUID.(EAX=24H, ECX=01H):ECX[2]
   - AVX10_V2_AUX: CPUID.(EAX=24H, ECX=01H):ECX[3]
   - ACE: CPUID.(EAX=07H, ECX=01H):ECX[11]
   - MAX_PALETTE >= 2: CPUID.(EAX=1DH, ECX=00H):EAX >= 2
   - ACE_VSN >= 1: CPUID.(EAX=1DH, ECX=02H):EAX[7:0] >= 1

Verified under Intel SDE 10.13.1:
  sde64 -spr -- ./isa-info                                # ACE_V1: no
  sde64 -gnr -- ./isa-info                                # ACE_V1: no
  sde64 -dmr -- ./isa-info                                # ACE_V1: no
  sde64 -future-ag -- ./isa-info                          # ACE_V1: yes
  sde64 -future-ag -xsave_default 0x600e7 -- ./isa-info   # ACE_V1: no
  sde64 -future-ag -xsave_default 0x1600e7 -- ./isa-info  # ACE_V1: yes
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.

3 participants