@@ -25,6 +25,11 @@ import (
25
25
"gopkg.in/yaml.v2"
26
26
)
27
27
28
+ const (
29
+ // BackendTypeTensorRT indicates tensortt backend
30
+ BackendTypeTensorRT = "tensorrt"
31
+ )
32
+
28
33
// File represents the model files
29
34
type File struct {
30
35
Name string `yaml:"name" json:"name,omitempty"`
@@ -152,11 +157,17 @@ func MatchProfiles(modelSpec appsv1alpha1.ModelSpec, manifest NIMManifest, disco
152
157
continue
153
158
}
154
159
155
- // GPU matching logic
156
- if len (modelSpec .GPUs ) > 0 || len (discoveredGPUs ) > 0 {
157
- if ! matchGPUProfile (modelSpec , profile , discoveredGPUs ) {
160
+ // Perform GPU match only when optimized engine is selected or GPU filters are provided
161
+ if isOptimizedEngine (modelSpec .Engine ) || len (modelSpec .GPUs ) > 0 {
162
+ // Skip non optimized profiles
163
+ if ! isOptimizedEngine (backend ) {
158
164
continue
159
165
}
166
+ if len (modelSpec .GPUs ) > 0 || len (discoveredGPUs ) > 0 {
167
+ if ! matchGPUProfile (modelSpec , profile , discoveredGPUs ) {
168
+ continue
169
+ }
170
+ }
160
171
}
161
172
162
173
// Profile matched the given model parameters, add hash to the selected profiles
@@ -166,6 +177,10 @@ func MatchProfiles(modelSpec appsv1alpha1.ModelSpec, manifest NIMManifest, disco
166
177
return selectedProfiles , nil
167
178
}
168
179
180
+ func isOptimizedEngine (engine string ) bool {
181
+ return engine != "" && strings .Contains (strings .ToLower (engine ), BackendTypeTensorRT )
182
+ }
183
+
169
184
func matchGPUProfile (modelSpec appsv1alpha1.ModelSpec , profile NIMProfile , discoveredGPUs []string ) bool {
170
185
foundGPU := false
171
186
0 commit comments