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_UNLIKELY(!hwy::PinThreadToLogicalProcessor(lps[task]))) {
fprintf(
stderr, "Pinning failed for task %d of %zu to %zu (size %zu)\n",
static_cast<int>(task), pool.NumWorkers(), lps[task], lps.size());
// Apple does not support pinning, hence do not warn there.
if (!HWY_OS_APPLE) {
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();
}
}

View File

@ -59,8 +59,11 @@ static LPS EnabledLPs(const BoundedSlice& lp_slice) {
});
} else {
const size_t num_lps = hwy::TotalLogicalProcessors();
// Do not warn on Apple, where affinity is not supported.
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) {
if (lp_slice.Contains(num_lps, lp)) {
enabled_lps.Set(lp);