@@ -66,6 +66,17 @@ const (
6666 LocalStoreBackend = "local-store"
6767)
6868
69+ var llamaCPPVariants = []string {
70+ LLamaCPPAVX2 ,
71+ LLamaCPPAVX ,
72+ LLamaCPPFallback ,
73+ LLamaCPPCUDA ,
74+ LLamaCPPHipblas ,
75+ LLamaCPPSycl16 ,
76+ LLamaCPPSycl32 ,
77+ LLamaCPPGRPC ,
78+ }
79+
6980func backendPath (assetDir , backend string ) string {
7081 return filepath .Join (assetDir , "backend-assets" , "grpc" , backend )
7182}
@@ -107,40 +118,14 @@ ENTRY:
107118 if AutoDetect {
108119 // if we find the llama.cpp variants, show them of as a single backend (llama-cpp) as later we are going to pick that up
109120 // when starting the service
110- foundLCPPAVX , foundLCPPAVX2 , foundLCPPFallback , foundLCPPGRPC , foundLCPPCuda , foundLCPPHipblas , foundSycl16 , foundSycl32 := false , false , false , false , false , false , false , false
121+ foundVariants := map [ string ] bool {}
111122 if _ , ok := backends [LLamaCPP ]; ! ok {
112123 for _ , e := range entry {
113- if strings .Contains (e .Name (), LLamaCPPAVX2 ) && ! foundLCPPAVX2 {
114- backends [LLamaCPP ] = append (backends [LLamaCPP ], LLamaCPPAVX2 )
115- foundLCPPAVX2 = true
116- }
117- if strings .Contains (e .Name (), LLamaCPPAVX ) && ! foundLCPPAVX {
118- backends [LLamaCPP ] = append (backends [LLamaCPP ], LLamaCPPAVX )
119- foundLCPPAVX = true
120- }
121- if strings .Contains (e .Name (), LLamaCPPFallback ) && ! foundLCPPFallback {
122- backends [LLamaCPP ] = append (backends [LLamaCPP ], LLamaCPPFallback )
123- foundLCPPFallback = true
124- }
125- if strings .Contains (e .Name (), LLamaCPPGRPC ) && ! foundLCPPGRPC {
126- backends [LLamaCPP ] = append (backends [LLamaCPP ], LLamaCPPGRPC )
127- foundLCPPGRPC = true
128- }
129- if strings .Contains (e .Name (), LLamaCPPCUDA ) && ! foundLCPPCuda {
130- backends [LLamaCPP ] = append (backends [LLamaCPP ], LLamaCPPCUDA )
131- foundLCPPCuda = true
132- }
133- if strings .Contains (e .Name (), LLamaCPPHipblas ) && ! foundLCPPHipblas {
134- backends [LLamaCPP ] = append (backends [LLamaCPP ], LLamaCPPHipblas )
135- foundLCPPHipblas = true
136- }
137- if strings .Contains (e .Name (), LLamaCPPSycl16 ) && ! foundSycl16 {
138- backends [LLamaCPP ] = append (backends [LLamaCPP ], LLamaCPPSycl16 )
139- foundSycl16 = true
140- }
141- if strings .Contains (e .Name (), LLamaCPPSycl32 ) && ! foundSycl32 {
142- backends [LLamaCPP ] = append (backends [LLamaCPP ], LLamaCPPSycl32 )
143- foundSycl32 = true
124+ for _ , v := range llamaCPPVariants {
125+ if strings .Contains (e .Name (), v ) && ! foundVariants [v ] {
126+ backends [LLamaCPP ] = append (backends [LLamaCPP ], v )
127+ foundVariants [v ] = true
128+ }
144129 }
145130 }
146131 }
0 commit comments