1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2024-12-14 11:57:51 +00:00

Merge pull request #1673 from marquiz/devel/avx10

cpu: advertise AVX10 version
This commit is contained in:
Kubernetes Prow Robot 2024-05-24 04:20:14 -07:00 committed by GitHub
commit 891d163990
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 48 additions and 0 deletions

View file

@ -41,6 +41,17 @@ spec:
- "SSE42"
- "SSSE3"
- name: "nfd built-in cpu-cpuid non-bool labels"
labelsTemplate: |
{{ range .cpu.cpuid }}cpu-cpuid.{{ .Name }}={{ .Value }}
{{ end }}
matchFeatures:
- feature: cpu.cpuid
matchName:
op: In
value:
- "AVX10_VERSION"
- name: "nfd built-in cpu-hardware_multithreading label"
labelsTemplate: |
{{ range .cpu.topology }}cpu-{{ .Name }}={{ .Value }}

View file

@ -959,6 +959,8 @@ The following features are available for matching:
| ---------------- | ------------ | -------- | ---------- | ----------- |
| **`cpu.cpuid`** | flag | | | Supported CPU capabilities |
| | | **`<cpuid-flag>`** | | CPUID flag is present |
| | attribute | | | CPU capability attributes |
| | | **AVX10_VERSION** | int | AVX10 vector ISA version (if supported) |
| **`cpu.cstate`** | attribute | | | Status of cstates in the intel_idle cpuidle driver |
| | | **`enabled`** | bool | 'true' if cstates are set, otherwise 'false'. Does not exist of intel_idle driver is not active. |
| **`cpu.model`** | attribute | | | CPU model related attributes |

View file

@ -47,6 +47,7 @@ feature.node.kubernetes.io/<feature> = <value>
| Feature name | Value | Description |
| ----------------------------------- | ------ | --------------------------------------------------------------------------- |
| **`cpu-cpuid.<cpuid-flag>`** | true | CPU capability is supported. **NOTE:** the capability might be supported but not enabled. |
| **`cpu-cpuid.<cpuid-attribute>`** | string | CPU attribute value |
| **`cpu-hardware_multithreading`** | true | Hardware multithreading, such as Intel HTT, enabled (number of logical CPUs is greater than physical CPUs) |
| **`cpu-coprocessor.nx_gzip`** | true | Nest Accelerator for GZIP is supported(Power). |
| **`cpu-power.sst_bf.enabled`** | true | Intel SST-BF ([Intel Speed Select Technology][intel-sst] - Base frequency) enabled |
@ -123,6 +124,12 @@ configuration options to change the behavior.
See the full list in [github.com/klauspost/cpuid][klauspost-cpuid].
#### X86 CPUID attributes
| Attribute | Description |
| ------------------ | ------------------------------------------------------- |
| AVX10_VERSION | AVX10 vector ISA version (if supported) |
#### Arm CPUID flags (partial list)
| Flag | Description |

View file

@ -149,6 +149,9 @@ func (s *cpuSource) GetLabels() (source.FeatureLabels, error) {
labels["cpuid."+f] = true
}
}
for f, v := range features.Attributes[CpuidFeature].Elements {
labels["cpuid."+f] = v
}
// CPU model
for k, v := range features.Attributes[Cpumodel].Elements {
@ -203,6 +206,9 @@ func (s *cpuSource) Discover() error {
// Detect CPUID
s.features.Flags[CpuidFeature] = nfdv1alpha1.NewFlagFeatures(getCpuidFlags()...)
if cpuidAttrs := getCpuidAttributes(); cpuidAttrs != nil {
s.features.Attributes[CpuidFeature] = nfdv1alpha1.NewAttributeFeatures(cpuidAttrs)
}
// Detect CPU model
s.features.Attributes[Cpumodel] = nfdv1alpha1.NewAttributeFeatures(getCPUModel())

View file

@ -17,6 +17,8 @@ limitations under the License.
package cpu
import (
"strconv"
"github.com/klauspost/cpuid/v2"
)
@ -24,3 +26,13 @@ import (
func getCpuidFlags() []string {
return cpuid.CPU.FeatureSet()
}
func getCpuidAttributes() map[string]string {
ret := map[string]string{}
if cpuid.CPU.AVX10Level > 0 {
ret["AVX10_VERSION"] = strconv.Itoa(int(cpuid.CPU.AVX10Level))
}
return ret
}

View file

@ -119,3 +119,5 @@ func getCpuidFlags() []string {
}
return r
}
func getCpuidAttributes() map[string]string { return nil }

View file

@ -199,3 +199,5 @@ func getCpuidFlags() []string {
}
return r
}
func getCpuidAttributes() map[string]string { return nil }

View file

@ -153,3 +153,5 @@ func getCpuidFlags() []string {
}
return r
}
func getCpuidAttributes() map[string]string { return nil }

View file

@ -95,3 +95,5 @@ func getCpuidFlags() []string {
}
return r
}
func getCpuidAttributes() map[string]string { return nil }

View file

@ -20,3 +20,5 @@ limitations under the License.
package cpu
func getCpuidFlags() []string { return nil }
func getCpuidAttributes() map[string]string { return nil }