Avoid affinity related warnings on Apple. Refs #625

PiperOrigin-RevId: 778895832
This commit is contained in:
Jan Wassenberg 2025-07-03 08:21:52 -07:00 committed by Copybara-Service
parent e1585ecaf5
commit fea9a07d9b
2 changed files with 11 additions and 5 deletions

View File

@ -77,9 +77,12 @@ class Pinning {
if (HWY_LIKELY(want_pin_)) { if (HWY_LIKELY(want_pin_)) {
if (HWY_UNLIKELY(!hwy::PinThreadToLogicalProcessor(lps[task]))) { if (HWY_UNLIKELY(!hwy::PinThreadToLogicalProcessor(lps[task]))) {
fprintf( // Apple does not support pinning, hence do not warn there.
stderr, "Pinning failed for task %d of %zu to %zu (size %zu)\n", if (!HWY_OS_APPLE) {
static_cast<int>(task), pool.NumWorkers(), lps[task], lps.size()); HWY_WARN("Pinning failed for task %d of %zu to %zu (size %zu)\n",
static_cast<int>(task), pool.NumWorkers(), lps[task],
lps.size());
}
(void)any_error_.test_and_set(); (void)any_error_.test_and_set();
} }
} }

View File

@ -59,8 +59,11 @@ static LPS EnabledLPs(const BoundedSlice& lp_slice) {
}); });
} else { } else {
const size_t num_lps = hwy::TotalLogicalProcessors(); const size_t num_lps = hwy::TotalLogicalProcessors();
HWY_WARN("unknown OS affinity, max %zu LPs and slice %zu.", num_lps, // Do not warn on Apple, where affinity is not supported.
lp_slice.Num(num_lps)); if (!HWY_OS_APPLE) {
HWY_WARN("unknown OS affinity, max %zu LPs and slice %zu.", num_lps,
lp_slice.Num(num_lps));
}
for (size_t lp = 0; lp < num_lps; ++lp) { for (size_t lp = 0; lp < num_lps; ++lp) {
if (lp_slice.Contains(num_lps, lp)) { if (lp_slice.Contains(num_lps, lp)) {
enabled_lps.Set(lp); enabled_lps.Set(lp);