many versions of simdid
This commit is contained in:
@@ -134,14 +134,15 @@ AVX Feature (bits 47..40)
|
||||
|
||||
| bit | 47 | 46 | 45 | 44 | 43 | 42 | 41 | 40 |
|
||||
|-----|----|----|----|----|----|----|----|----|
|
||||
| use | R | R | R | R | F16C | FMA | AVX2 | AVX |
|
||||
| use | R | R | R | DUAL | F16C | FMA | AVX2 | AVX |
|
||||
|
||||
Rules:
|
||||
- **AVX (bit 40)**: AVX present.
|
||||
- **AVX2 (bit 41)**: AVX2 present. For the AVX feature byte to be considered valid, both AVX and AVX2 must be set.
|
||||
- **FMA (bit 42)**: FMA present.
|
||||
- **F16C (bit 43)**: F16C present.
|
||||
- **[44..47]**: Reserved for other AVX-family extensions (e.g., BMI/BMI2, IFMA, XOP) as needed.
|
||||
- **DUAL (bit 44)**: YMM execution is **glued/split-lane** (two fused 128-bit units rather than a native 256-bit path). Detection: AMD Zen1/Zen+ (Family 0x17, model < 0x30), Hygon (all, Zen1-based), VIA/Zhaoxin (all). When set, code using YMM operations may incur split-register overhead; prefer 128-bit SSE paths on these targets.
|
||||
- **[45..47]**: Reserved for other AVX-family extensions (e.g., IFMA, XOP) as needed.
|
||||
|
||||
---
|
||||
|
||||
@@ -207,17 +208,36 @@ When `MainLevel < AMX`, this byte can be all zeros.
|
||||
|
||||
## 11) uArchHi ([63..56], 8 bits)
|
||||
|
||||
Purpose: optional high-byte strategy field to address issues like early Intel/AMD "glue" AVX512 that are not expressible purely via CPUID subsets. Defaults to 0.
|
||||
Purpose: **bitmask** byte encoding core topology classification and SIMD execution-width policy for the detected core. All bits default to 0.
|
||||
|
||||
Suggested minimal use:
|
||||
- `0`: unused
|
||||
- `1`: ForceDual (treat as AVX512-DUAL even if impl is unknown)
|
||||
- `2`: ForceNative (treat as AVX512-NATIVE even if impl is unknown)
|
||||
- `3..`: Implementation-maintained uArch enumeration (e.g., SKX/ICL/SPR/ZEN4/ZEN5…)
|
||||
uArchHi bitmask layout:
|
||||
|
||||
Practical strategy for a single maintainer:
|
||||
- AMD: detection side sets `AVX512_IMPL = DUAL` directly (no uArch needed)
|
||||
- Intel: enumerate only selected models of interest; otherwise Unknown follows default policy
|
||||
| bit (relative to [63..56]) | Name | Note |
|
||||
|---:|------|------|
|
||||
| 0 | HYBRID_E | E-core (efficiency/small core) in a hybrid-topology processor (e.g., Intel Alder Lake+ E-core) |
|
||||
| 1 | HYBRID_P | P-core (performance/big core) in a hybrid-topology processor (e.g., Intel Alder Lake+ P-core) |
|
||||
| 2 | SIMD_DUAL | SIMD execution is glued/dual (not full-width). Summary flag: set when `AVX_DUAL=1` **or** `AVX512_IMPL=DUAL`. |
|
||||
| 3..7 | Reserved | |
|
||||
|
||||
Core topology encoding (bits [1..0], numerically comparable — higher = stronger):
|
||||
|
||||
| bits [1..0] | Value | Meaning |
|
||||
|:-----------:|:-----:|----------|
|
||||
| 00 | 0 | Unknown — undetected hybrid type or pre-CPUID.1A hardware |
|
||||
| 01 | 1 | **Hybrid-E** — efficiency/small core (a3) |
|
||||
| 10 | 2 | **Hybrid-P** — performance/big core (a2) |
|
||||
| 11 | 3 | **Unified** — confirmed non-hybrid; full-topology core (a1) |
|
||||
|
||||
The 2-bit field is directly comparable as an unsigned integer: `unified(3) > P-core(2) > E-core(1) > unknown(0)`.
|
||||
|
||||
Detection:
|
||||
- **Non-hybrid (unified)**: if `CPUID.7.0 EDX[15]` (HYBRID) is **not** set, the CPU is confirmed non-hybrid → set both `HYBRID_P` and `HYBRID_E` (topology = 11).
|
||||
- **Hybrid P-core**: HYBRID flag set and `CPUID.0x1A.0 EAX[31:24] == 0x40` → set only `HYBRID_P` (topology = 10).
|
||||
- **Hybrid E-core**: HYBRID flag set and `CPUID.0x1A.0 EAX[31:24] == 0x20` → set only `HYBRID_E` (topology = 01).
|
||||
- **Unknown hybrid** (flag set but core type unrecognised): leave topology at 00.
|
||||
- **SIMD_DUAL**: set when any of the following: `AVX Feature DUAL=1` (glued YMM), or `AVX512_IMPL=DUAL`.
|
||||
|
||||
`sn_get_unite_simd` computes topology bits [1..0] with bitwise **AND** (conservative intersection — weaker topology wins) and SIMD_DUAL with bitwise **OR** (dual if either core is dual). `sn_compare_simd` compares topology value numerically as step 6 and SIMD_DUAL as the final (step 7) tie-break.
|
||||
|
||||
---
|
||||
|
||||
@@ -232,7 +252,7 @@ Practical strategy for a single maintainer:
|
||||
- Intel: Decide DUAL/NATIVE based on family/model or policy table; if uncertain, use Unknown
|
||||
- When VNNI/BF16/FP16/VBMI/VBMI2 are detected, set the corresponding bits.
|
||||
4) If `MainLevel >= AMX`: fill the AMX byte.
|
||||
5) When AVX/AVX2 are present, populate the AVX Feature byte: set AVX and AVX2; set FMA and F16C when detected; leave reserved bits for future extensions.
|
||||
5) When AVX/AVX2 are present, populate the AVX Feature byte: set `AVX` and `AVX2`; set `FMA` and `F16C` when detected; set `DUAL` when the YMM execution path is split/glued (AMD Zen1/Zen+ Family 0x17 model < 0x30, Hygon all models, VIA/Zhaoxin all models).
|
||||
6) **AVX10 detection** (requires `CPUID leaf 7 subleaf 1, EDX[19] == 1` as the AVX10 convergence bit):
|
||||
- If AVX10 is indicated, query `CPUID leaf 0x24, subleaf 0`:
|
||||
- Read `EBX[7:0]` for version number; set `AVX10`, `V1`, and optionally `V2`.
|
||||
@@ -240,10 +260,16 @@ Practical strategy for a single maintainer:
|
||||
- Read `EBX[18]` for 512-bit support → set `512W`.
|
||||
- Promote `MainLevel` to `AVX10` (value 7).
|
||||
- The `AVX512 Feature` field should still be filled for backward compatibility.
|
||||
7) Use uArchHi only when additional policy is needed; otherwise leave as 0.
|
||||
7) Populate uArchHi:
|
||||
- If `CPUID.7.0 EDX[15]` (HYBRID) **not** set: set `HYBRID_P | HYBRID_E` (unified = 11).
|
||||
- If HYBRID is set, read `CPUID.0x1A.0 EAX[31:24]`:
|
||||
- `0x40` (P-core) → set only `HYBRID_P` (topology = 10).
|
||||
- `0x20` (E-core) → set only `HYBRID_E` (topology = 01).
|
||||
- Otherwise leave topology at 00 (unknown hybrid).
|
||||
- If `AVX Feature DUAL=1` or `AVX512_IMPL=DUAL`, set `SIMD_DUAL`.
|
||||
|
||||
---
|
||||
|
||||
## 13) Choice for High Bits Reservation
|
||||
|
||||
`[31..24]` is reserved for AVX512 extensions/AI. `[47..44]` is reserved for AVX-family extensions beside the AVX byte. `[55..53]` is reserved for future AVX10 versions. uArchHi `[63..56]` remains available for minimal policy hints. If IFMA or other extensions are more important, repurpose the reserved bits while keeping `BASE`, `Impl`, and `AVX10` core bits unchanged.
|
||||
`[31..24]` is reserved for AVX512 extensions/AI. `[47..45]` is reserved for AVX-family extensions (bit 44 is now `DUAL`). `[55..53]` is reserved for future AVX10 versions. uArchHi `[63..56]` bits [3..7] are reserved; bits [0..2] encode hybrid topology and SIMD-dual policy.
|
||||
Reference in New Issue
Block a user