@@ -7150,10 +7150,12 @@ static void print_backend_features(ggml_backend_t backend) {
7150
7150
7151
7151
static bool test_cpu_variant (const char * variant_name, const char * op_names_filter,
7152
7152
const char * params_filter, printer * output_printer) {
7153
- std::string backend_ref_name = " CPU-ref" ;
7154
- std::string variant = std::string (variant_name).substr (4 );
7155
- ggml_backend_load_variant (" cpu" , variant.c_str ());
7153
+ // Load the variant first so that extra buffer types created only use that
7154
+ // backend as the features of the backend can determine if the extra buf
7155
+ // types are enabled or not.
7156
+ ggml_backend_load_variant (" cpu" , std::string (variant_name).substr (4 ).c_str ());
7156
7157
7158
+ // Load extra buffer types and allocate a buffer from each type.
7157
7159
std::unordered_map<ggml_backend_buffer_type_t , ggml_backend_buffer_t > extra_buf_map;
7158
7160
{
7159
7161
auto * cpu_dev = ggml_backend_dev_by_type (GGML_BACKEND_DEVICE_TYPE_CPU);
@@ -7165,7 +7167,7 @@ static bool test_cpu_variant(const char * variant_name, const char * op_names_fi
7165
7167
ggml_backend_buffer_type_t * extra_bufts = ggml_backend_dev_get_extra_bufts_fn (cpu_dev);
7166
7168
while (extra_bufts && *extra_bufts) {
7167
7169
// TODO: What should the size be here? Do extra buffer types need a size even?
7168
- // We need to have a value larger than 0 to avoid the default buffer to be used.
7170
+ // We need to have a value larger than 0 to avoid the dummy backend buffer to be used.
7169
7171
extra_buf_map[*extra_bufts] = ggml_backend_buft_alloc_buffer (*extra_bufts, 1 );
7170
7172
++extra_bufts;
7171
7173
}
@@ -7178,7 +7180,8 @@ static bool test_cpu_variant(const char * variant_name, const char * op_names_fi
7178
7180
}
7179
7181
printf (" \n " );
7180
7182
7181
- ggml_backend_load_variant (" cpu" , " ref" );
7183
+ std::string backend_ref_name = " CPU-ref" ;
7184
+ ggml_backend_load_variant (" cpu" , std::string (backend_ref_name).substr (4 ).c_str ());
7182
7185
7183
7186
ggml_backend_t backend_ref = ggml_backend_init_by_name (backend_ref_name.c_str (), nullptr );
7184
7187
if (backend_ref == nullptr ) {
0 commit comments