Skip to content

Commit

Permalink
fix: Ensure that instances with accelerators that are not Neuron are …
Browse files Browse the repository at this point in the history
…populated correctly
  • Loading branch information
bryantbiggs committed Sep 11, 2024
1 parent fb3c9cf commit 3014f8e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/providers/instancetype/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,14 @@ func computeRequirements(info *ec2.InstanceTypeInfo, offerings cloudprovider.Off
requirements.Get(v1.LabelInstanceGPUCount).Insert(fmt.Sprint(aws.Int64Value(gpu.Count)))
requirements.Get(v1.LabelInstanceGPUMemory).Insert(fmt.Sprint(aws.Int64Value(gpu.MemoryInfo.SizeInMiB)))
}
// Accelerators - excluding Neuron
if info.InferenceAcceleratorInfo != nil && len(info.InferenceAcceleratorInfo.Accelerators) == 1 && info.NeuronInfo == nil {
accelerator := info.InferenceAcceleratorInfo.Accelerators[0]
requirements.Get(v1.LabelInstanceAcceleratorName).Insert(lowerKabobCase(aws.StringValue(accelerator.Name)))
requirements.Get(v1.LabelInstanceAcceleratorManufacturer).Insert(lowerKabobCase(aws.StringValue(accelerator.Manufacturer)))
requirements.Get(v1.LabelInstanceAcceleratorCount).Insert(fmt.Sprint(aws.Int64Value(accelerator.Count)))
requirements.Get(v1.LabelInstanceAcceleratorMemory).Insert(fmt.Sprint(aws.Int64Value(info.InferenceAcceleratorInfo.TotalInferenceMemoryInMiB)))
}
// Neuron
if info.NeuronInfo != nil && len(info.NeuronInfo.NeuronDevices) == 1 {
device := info.NeuronInfo.NeuronDevices[0]
Expand Down Expand Up @@ -297,7 +305,6 @@ func awsNeuronCores(info *ec2.InstanceTypeInfo) *resource.Quantity {
if info.NeuronInfo != nil {
neuronDevice := info.NeuronInfo.NeuronDevices[0]
neuronCorePerDevice := neuronDevice.CoreInfo.Count

count = *neuronDevice.Count * *neuronCorePerDevice
}
return resources.Quantity(fmt.Sprint(count))
Expand Down
3 changes: 3 additions & 0 deletions website/content/en/preview/reference/instance-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -5186,6 +5186,9 @@ below are the resources available with some assumptions and after the instance o
#### Labels
| Label | Value |
|--|--|
|karpenter.k8s.aws/instance-accelerator-count|8|
|karpenter.k8s.aws/instance-accelerator-manufacturer|qualcomm|
|karpenter.k8s.aws/instance-accelerator-name|qualcomm-ai100|
|karpenter.k8s.aws/instance-category|dl|
|karpenter.k8s.aws/instance-cpu|96|
|karpenter.k8s.aws/instance-cpu-manufacturer|intel|
Expand Down

0 comments on commit 3014f8e

Please sign in to comment.