mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2024-12-14 11:57:51 +00:00
cpu: advertise AVX10 version
Add new cpuid label "feature.node.kubernetes.io/cpu-cpuid.AVX10_VERSION" that advertises the supported version of AVX10 vector ISA. Correspondingly, the patch adds AVX10_VERSION to the "cpu.cpuid" feature for NodeFeatureRules to consume. This makes cpu.cpuid on amd64 architecture a "multi-type" feature in that it contains "flags" and potentially also "attributes" (the only cpuid attribute so far is the AVX10_VERSION).
This commit is contained in:
parent
814255b7f1
commit
fa2f008d18
10 changed files with 48 additions and 0 deletions
|
@ -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 }}
|
||||
|
|
|
@ -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 |
|
||||
|
|
|
@ -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 |
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -119,3 +119,5 @@ func getCpuidFlags() []string {
|
|||
}
|
||||
return r
|
||||
}
|
||||
|
||||
func getCpuidAttributes() map[string]string { return nil }
|
||||
|
|
|
@ -199,3 +199,5 @@ func getCpuidFlags() []string {
|
|||
}
|
||||
return r
|
||||
}
|
||||
|
||||
func getCpuidAttributes() map[string]string { return nil }
|
||||
|
|
|
@ -153,3 +153,5 @@ func getCpuidFlags() []string {
|
|||
}
|
||||
return r
|
||||
}
|
||||
|
||||
func getCpuidAttributes() map[string]string { return nil }
|
||||
|
|
|
@ -95,3 +95,5 @@ func getCpuidFlags() []string {
|
|||
}
|
||||
return r
|
||||
}
|
||||
|
||||
func getCpuidAttributes() map[string]string { return nil }
|
||||
|
|
|
@ -20,3 +20,5 @@ limitations under the License.
|
|||
package cpu
|
||||
|
||||
func getCpuidFlags() []string { return nil }
|
||||
|
||||
func getCpuidAttributes() map[string]string { return nil }
|
||||
|
|
Loading…
Reference in a new issue