@@ -25,6 +25,11 @@ import (
2525 "gopkg.in/yaml.v2"
2626)
2727
28+ const (
29+ // BackendTypeTensorRT indicates tensortt backend
30+ BackendTypeTensorRT = "tensorrt"
31+ )
32+
2833// File represents the model files
2934type File struct {
3035 Name string `yaml:"name" json:"name,omitempty"`
@@ -152,11 +157,17 @@ func MatchProfiles(modelSpec appsv1alpha1.ModelSpec, manifest NIMManifest, disco
152157 continue
153158 }
154159
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 ) {
158164 continue
159165 }
166+ if len (modelSpec .GPUs ) > 0 || len (discoveredGPUs ) > 0 {
167+ if ! matchGPUProfile (modelSpec , profile , discoveredGPUs ) {
168+ continue
169+ }
170+ }
160171 }
161172
162173 // Profile matched the given model parameters, add hash to the selected profiles
@@ -166,6 +177,10 @@ func MatchProfiles(modelSpec appsv1alpha1.ModelSpec, manifest NIMManifest, disco
166177 return selectedProfiles , nil
167178}
168179
180+ func isOptimizedEngine (engine string ) bool {
181+ return engine != "" && strings .Contains (strings .ToLower (engine ), BackendTypeTensorRT )
182+ }
183+
169184func matchGPUProfile (modelSpec appsv1alpha1.ModelSpec , profile NIMProfile , discoveredGPUs []string ) bool {
170185 foundGPU := false
171186
0 commit comments