Skip to content

Commit 39e73ae

Browse files
authored
common : Add a warning when we can't match samplers from a string or char. (#13330)
1 parent 1f73301 commit 39e73ae

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

common/sampling.cpp

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "sampling.h"
22

33
#include "common.h"
4+
#include "log.h"
45

56
#include <cmath>
67
#include <unordered_map>
@@ -534,14 +535,16 @@ std::vector<common_sampler_type> common_sampler_types_from_names(const std::vect
534535
auto sampler = sampler_canonical_name_map.find(name);
535536
if (sampler != sampler_canonical_name_map.end()) {
536537
samplers.push_back(sampler->second);
537-
} else {
538-
if (allow_alt_names) {
539-
sampler = sampler_alt_name_map.find(name);
540-
if (sampler != sampler_alt_name_map.end()) {
541-
samplers.push_back(sampler->second);
542-
}
538+
continue;
539+
}
540+
if (allow_alt_names) {
541+
sampler = sampler_alt_name_map.find(name);
542+
if (sampler != sampler_alt_name_map.end()) {
543+
samplers.push_back(sampler->second);
544+
continue;
543545
}
544546
}
547+
LOG_WRN("%s: unable to match sampler by name '%s'\n", __func__, name.c_str());
545548
}
546549

547550
return samplers;
@@ -568,6 +571,8 @@ std::vector<common_sampler_type> common_sampler_types_from_chars(const std::stri
568571
const auto sampler = sampler_name_map.find(c);
569572
if (sampler != sampler_name_map.end()) {
570573
samplers.push_back(sampler->second);
574+
} else {
575+
LOG_WRN("%s: unable to match sampler by char '%c'\n", __func__, c);
571576
}
572577
}
573578

0 commit comments

Comments
 (0)