aboutsummaryrefslogtreecommitdiff
path: root/openmp/runtime
diff options
context:
space:
mode:
authorJonathan Peyton <jonathan.l.peyton@intel.com>2022-10-03 15:12:08 -0500
committerJonathan Peyton <jonathan.l.peyton@intel.com>2022-10-28 15:21:07 -0500
commitb03d67f7f58b305a26bb742860a444ad837f1f42 (patch)
tree16ff01def233b1363772cb8cbe7b31b265b95ca6 /openmp/runtime
parent174502fc14d08ad4aeee81a2ff7e551138b77152 (diff)
downloadllvm-b03d67f7f58b305a26bb742860a444ad837f1f42.zip
llvm-b03d67f7f58b305a26bb742860a444ad837f1f42.tar.gz
llvm-b03d67f7f58b305a26bb742860a444ad837f1f42.tar.bz2
[OpenMP][libomp] Make affinity warnings parameterized
Separate change for the warnings to depend on the relevant affinity settings verbose and warnings settings. Differential Revision: https://reviews.llvm.org/D135112
Diffstat (limited to 'openmp/runtime')
-rw-r--r--openmp/runtime/src/kmp_affinity.cpp66
1 files changed, 34 insertions, 32 deletions
diff --git a/openmp/runtime/src/kmp_affinity.cpp b/openmp/runtime/src/kmp_affinity.cpp
index 2309d0a..6c204ec6 100644
--- a/openmp/runtime/src/kmp_affinity.cpp
+++ b/openmp/runtime/src/kmp_affinity.cpp
@@ -141,14 +141,12 @@ const char *__kmp_hw_get_core_type_string(kmp_hw_core_type_t type) {
#if KMP_AFFINITY_SUPPORTED
// If affinity is supported, check the affinity
// verbose and warning flags before printing warning
-#define KMP_AFF_WARNING(...) \
- if (__kmp_affinity.flags.verbose || \
- (__kmp_affinity.flags.warnings && \
- (__kmp_affinity.type != affinity_none))) { \
+#define KMP_AFF_WARNING(s, ...) \
+ if (s.flags.verbose || (s.flags.warnings && (s.type != affinity_none))) { \
KMP_WARNING(__VA_ARGS__); \
}
#else
-#define KMP_AFF_WARNING KMP_WARNING
+#define KMP_AFF_WARNING(s, ...) KMP_WARNING(__VA_ARGS__)
#endif
////////////////////////////////////////////////////////////////////////////////
@@ -809,7 +807,7 @@ void kmp_topology_t::set_granularity(kmp_affinity_t &affinity) const {
}
KMP_ASSERT(gran_type != KMP_HW_UNKNOWN);
// Warn user what granularity setting will be used instead
- KMP_AFF_WARNING(AffGranularityBad, env_var,
+ KMP_AFF_WARNING(affinity, AffGranularityBad, env_var,
__kmp_hw_get_catalog_string(affinity.gran),
__kmp_hw_get_catalog_string(gran_type));
affinity.gran = gran_type;
@@ -827,7 +825,7 @@ void kmp_topology_t::set_granularity(kmp_affinity_t &affinity) const {
int proc_group_depth = get_level(KMP_HW_PROC_GROUP);
if (gran_depth >= 0 && proc_group_depth >= 0 &&
gran_depth < proc_group_depth) {
- KMP_AFF_WARNING(AffGranTooCoarseProcGroup, env_var,
+ KMP_AFF_WARNING(affinity, AffGranTooCoarseProcGroup, env_var,
__kmp_hw_get_catalog_string(affinity.gran));
affinity.gran = gran_type = KMP_HW_PROC_GROUP;
}
@@ -982,7 +980,7 @@ bool kmp_topology_t::filter_hw_subset() {
if (equivalent_type != KMP_HW_UNKNOWN) {
__kmp_hw_subset->at(i).type = equivalent_type;
} else {
- KMP_AFF_WARNING(AffHWSubsetNotExistGeneric,
+ KMP_AFF_WARNING(__kmp_affinity, AffHWSubsetNotExistGeneric,
__kmp_hw_get_catalog_string(type));
return false;
}
@@ -990,7 +988,8 @@ bool kmp_topology_t::filter_hw_subset() {
// Check to see if current layer has already been
// specified either directly or through an equivalent type
if (specified[equivalent_type] != KMP_HW_UNKNOWN) {
- KMP_AFF_WARNING(AffHWSubsetEqvLayers, __kmp_hw_get_catalog_string(type),
+ KMP_AFF_WARNING(__kmp_affinity, AffHWSubsetEqvLayers,
+ __kmp_hw_get_catalog_string(type),
__kmp_hw_get_catalog_string(specified[equivalent_type]));
return false;
}
@@ -1001,7 +1000,7 @@ bool kmp_topology_t::filter_hw_subset() {
if (max_count < 0 ||
(num != kmp_hw_subset_t::USE_ALL && num + offset > max_count)) {
bool plural = (num > 1);
- KMP_AFF_WARNING(AffHWSubsetManyGeneric,
+ KMP_AFF_WARNING(__kmp_affinity, AffHWSubsetManyGeneric,
__kmp_hw_get_catalog_string(type, plural));
return false;
}
@@ -1024,21 +1023,24 @@ bool kmp_topology_t::filter_hw_subset() {
if ((using_core_effs || using_core_types) && !__kmp_is_hybrid_cpu()) {
if (item.num_attrs == 1) {
if (using_core_effs) {
- KMP_AFF_WARNING(AffHWSubsetIgnoringAttr, "efficiency");
+ KMP_AFF_WARNING(__kmp_affinity, AffHWSubsetIgnoringAttr,
+ "efficiency");
} else {
- KMP_AFF_WARNING(AffHWSubsetIgnoringAttr, "core_type");
+ KMP_AFF_WARNING(__kmp_affinity, AffHWSubsetIgnoringAttr,
+ "core_type");
}
using_core_effs = false;
using_core_types = false;
} else {
- KMP_AFF_WARNING(AffHWSubsetAttrsNonHybrid);
+ KMP_AFF_WARNING(__kmp_affinity, AffHWSubsetAttrsNonHybrid);
return false;
}
}
// Check if using both core types and core efficiencies together
if (using_core_types && using_core_effs) {
- KMP_AFF_WARNING(AffHWSubsetIncompat, "core_type", "efficiency");
+ KMP_AFF_WARNING(__kmp_affinity, AffHWSubsetIncompat, "core_type",
+ "efficiency");
return false;
}
@@ -1074,7 +1076,7 @@ bool kmp_topology_t::filter_hw_subset() {
(num != kmp_hw_subset_t::USE_ALL && num + offset > max_count)) {
kmp_str_buf_t buf;
__kmp_hw_get_catalog_core_string(item.attr[j], &buf, num > 0);
- KMP_AFF_WARNING(AffHWSubsetManyGeneric, buf.str);
+ KMP_AFF_WARNING(__kmp_affinity, AffHWSubsetManyGeneric, buf.str);
__kmp_str_buf_free(&buf);
return false;
}
@@ -1096,7 +1098,7 @@ bool kmp_topology_t::filter_hw_subset() {
}
kmp_str_buf_t buf;
__kmp_hw_get_catalog_core_string(other_attr, &buf, item.num[j] > 0);
- KMP_AFF_WARNING(AffHWSubsetIncompat,
+ KMP_AFF_WARNING(__kmp_affinity, AffHWSubsetIncompat,
__kmp_hw_get_catalog_string(KMP_HW_CORE), buf.str);
__kmp_str_buf_free(&buf);
return false;
@@ -1109,7 +1111,7 @@ bool kmp_topology_t::filter_hw_subset() {
kmp_str_buf_t buf;
__kmp_hw_get_catalog_core_string(item.attr[j], &buf,
item.num[j] > 0);
- KMP_AFF_WARNING(AffHWSubsetAttrRepeat, buf.str);
+ KMP_AFF_WARNING(__kmp_affinity, AffHWSubsetAttrRepeat, buf.str);
__kmp_str_buf_free(&buf);
return false;
}
@@ -1217,7 +1219,7 @@ bool kmp_topology_t::filter_hw_subset() {
// One last check that we shouldn't allow filtering entire machine
if (num_filtered == num_hw_threads) {
- KMP_AFF_WARNING(AffHWSubsetAllFiltered);
+ KMP_AFF_WARNING(__kmp_affinity, AffHWSubsetAllFiltered);
__kmp_free(filtered);
return false;
}
@@ -3370,7 +3372,7 @@ static void __kmp_create_os_id_masks(unsigned *numUnique,
KMP_INFORM(ThreadsMigrate, env_var, affinity.gran_levels);
}
if (affinity.gran_levels >= (int)depth) {
- KMP_AFF_WARNING(AffThreadsMayMigrate);
+ KMP_AFF_WARNING(affinity, AffThreadsMayMigrate);
}
// Run through the table, forming the masks for all threads on each core.
@@ -3455,7 +3457,7 @@ static int nextNewMask;
{ \
if (((_osId) > _maxOsId) || \
(!KMP_CPU_ISSET((_osId), KMP_CPU_INDEX((_osId2Mask), (_osId))))) { \
- KMP_AFF_WARNING(AffIgnoreInvalidProcID, _osId); \
+ KMP_AFF_WARNING(affinity, AffIgnoreInvalidProcID, _osId); \
} else { \
ADD_MASK(KMP_CPU_INDEX(_osId2Mask, (_osId))); \
} \
@@ -3507,7 +3509,7 @@ static void __kmp_affinity_process_proclist(kmp_affinity_t &affinity) {
// Copy the mask for that osId to the sum (union) mask.
if ((num > maxOsId) ||
(!KMP_CPU_ISSET(num, KMP_CPU_INDEX(osId2Mask, num)))) {
- KMP_AFF_WARNING(AffIgnoreInvalidProcID, num);
+ KMP_AFF_WARNING(affinity, AffIgnoreInvalidProcID, num);
KMP_CPU_ZERO(sumMask);
} else {
KMP_CPU_COPY(sumMask, KMP_CPU_INDEX(osId2Mask, num));
@@ -3539,7 +3541,7 @@ static void __kmp_affinity_process_proclist(kmp_affinity_t &affinity) {
// Add the mask for that osId to the sum mask.
if ((num > maxOsId) ||
(!KMP_CPU_ISSET(num, KMP_CPU_INDEX(osId2Mask, num)))) {
- KMP_AFF_WARNING(AffIgnoreInvalidProcID, num);
+ KMP_AFF_WARNING(affinity, AffIgnoreInvalidProcID, num);
} else {
KMP_CPU_UNION(sumMask, KMP_CPU_INDEX(osId2Mask, num));
setSize++;
@@ -3697,7 +3699,7 @@ static void __kmp_process_subplace_list(const char **scan,
if (**scan == '}' || **scan == ',') {
if ((start > maxOsId) ||
(!KMP_CPU_ISSET(start, KMP_CPU_INDEX(osId2Mask, start)))) {
- KMP_AFF_WARNING(AffIgnoreInvalidProcID, start);
+ KMP_AFF_WARNING(affinity, AffIgnoreInvalidProcID, start);
} else {
KMP_CPU_UNION(tempMask, KMP_CPU_INDEX(osId2Mask, start));
(*setSize)++;
@@ -3726,7 +3728,7 @@ static void __kmp_process_subplace_list(const char **scan,
for (i = 0; i < count; i++) {
if ((start > maxOsId) ||
(!KMP_CPU_ISSET(start, KMP_CPU_INDEX(osId2Mask, start)))) {
- KMP_AFF_WARNING(AffIgnoreInvalidProcID, start);
+ KMP_AFF_WARNING(affinity, AffIgnoreInvalidProcID, start);
break; // don't proliferate warnings for large count
} else {
KMP_CPU_UNION(tempMask, KMP_CPU_INDEX(osId2Mask, start));
@@ -3773,7 +3775,7 @@ static void __kmp_process_subplace_list(const char **scan,
for (i = 0; i < count; i++) {
if ((start > maxOsId) ||
(!KMP_CPU_ISSET(start, KMP_CPU_INDEX(osId2Mask, start)))) {
- KMP_AFF_WARNING(AffIgnoreInvalidProcID, start);
+ KMP_AFF_WARNING(affinity, AffIgnoreInvalidProcID, start);
break; // don't proliferate warnings for large count
} else {
KMP_CPU_UNION(tempMask, KMP_CPU_INDEX(osId2Mask, start));
@@ -3816,7 +3818,7 @@ static void __kmp_process_place(const char **scan, kmp_affinity_t &affinity,
KMP_ASSERT(num >= 0);
if ((num > maxOsId) ||
(!KMP_CPU_ISSET(num, KMP_CPU_INDEX(osId2Mask, num)))) {
- KMP_AFF_WARNING(AffIgnoreInvalidProcID, num);
+ KMP_AFF_WARNING(affinity, AffIgnoreInvalidProcID, num);
} else {
KMP_CPU_UNION(tempMask, KMP_CPU_INDEX(osId2Mask, num));
(*setSize)++;
@@ -3935,7 +3937,7 @@ void __kmp_affinity_process_placelist(kmp_affinity_t &affinity) {
(!KMP_CPU_ISSET(j + stride,
KMP_CPU_INDEX(osId2Mask, j + stride)))) {
if (i < count - 1) {
- KMP_AFF_WARNING(AffIgnoreInvalidProcID, j + stride);
+ KMP_AFF_WARNING(affinity, AffIgnoreInvalidProcID, j + stride);
}
continue;
}
@@ -4078,7 +4080,7 @@ static void __kmp_aux_affinity_initialize_masks(kmp_affinity_t &affinity) {
__kmp_avail_proc++;
}
if (__kmp_avail_proc > __kmp_xproc) {
- KMP_AFF_WARNING(ErrorInitializeAffinity);
+ KMP_AFF_WARNING(affinity, ErrorInitializeAffinity);
affinity.type = affinity_none;
KMP_AFFINITY_DISABLE();
return;
@@ -4252,7 +4254,7 @@ static bool __kmp_aux_affinity_initialize_topology(kmp_affinity_t &affinity) {
// Early exit if topology could not be created
if (!__kmp_topology) {
if (KMP_AFFINITY_CAPABLE()) {
- KMP_AFF_WARNING(ErrorInitializeAffinity);
+ KMP_AFF_WARNING(affinity, ErrorInitializeAffinity);
}
if (nPackages > 0 && nCoresPerPkg > 0 && __kmp_nThreadsPerCore > 0 &&
__kmp_ncores > 0) {
@@ -4339,7 +4341,7 @@ static void __kmp_aux_affinity_initialize(kmp_affinity_t &affinity) {
__kmp_affinity_process_placelist(affinity);
}
if (affinity.num_masks == 0) {
- KMP_AFF_WARNING(AffNoValidProcID);
+ KMP_AFF_WARNING(affinity, AffNoValidProcID);
affinity.type = affinity_none;
__kmp_create_affinity_none_places(affinity);
affinity.flags.initialized = TRUE;
@@ -4390,7 +4392,7 @@ static void __kmp_aux_affinity_initialize(kmp_affinity_t &affinity) {
case affinity_balanced:
if (depth <= 1) {
- KMP_AFF_WARNING(AffBalancedNotAvail, env_var);
+ KMP_AFF_WARNING(affinity, AffBalancedNotAvail, env_var);
affinity.type = affinity_none;
__kmp_create_affinity_none_places(affinity);
affinity.flags.initialized = TRUE;
@@ -4408,7 +4410,7 @@ static void __kmp_aux_affinity_initialize(kmp_affinity_t &affinity) {
int nproc = ncores * maxprocpercore;
if ((nproc < 2) || (nproc < __kmp_avail_proc)) {
- KMP_AFF_WARNING(AffBalancedNotAvail, env_var);
+ KMP_AFF_WARNING(affinity, AffBalancedNotAvail, env_var);
affinity.type = affinity_none;
affinity.flags.initialized = TRUE;
return;