这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions hwy/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,21 @@

#endif // !HWY_COMPILER_MSVC

#if (HWY_COMPILER_GCC_ACTUAL && HWY_COMPILER_GCC_ACTUAL < 1200) || \
(HWY_COMPILER_ICC && !HWY_COMPILER_ICX)
// The use of __attribute__((unused)) in private class member variables triggers
// a compiler warning with GCC 11 and earlier and ICC

// GCC 11 and earlier and ICC also do not emit -Wunused-private-field warnings
// for unused private class member variables
#define HWY_MEMBER_VAR_MAYBE_UNUSED
#else
// Clang and ICX need __attribute__((unused)) in unused private class member
// variables to suppress -Wunused-private-field warnings unless this warning is
// ignored by using HWY_DIAGNOSTICS_OFF
#define HWY_MEMBER_VAR_MAYBE_UNUSED HWY_MAYBE_UNUSED
#endif

//------------------------------------------------------------------------------
// Builtin/attributes (no more #include after this point due to namespace!)

Expand Down
1 change: 1 addition & 0 deletions hwy/contrib/thread_pool/spin.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ static inline const char* ToString(SpinType type) {
case SpinType::kPause:
return "Pause";
case SpinType::kSentinel:
default:
return nullptr;
}
}
Expand Down
8 changes: 5 additions & 3 deletions hwy/contrib/thread_pool/thread_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ struct Config { // 4 bytes

SpinType spin_type;
WaitType wait_type;
HWY_MAYBE_UNUSED uint8_t reserved[2];
HWY_MEMBER_VAR_MAYBE_UNUSED uint8_t reserved[2];
};
static_assert(sizeof(Config) == 4, "");

Expand Down Expand Up @@ -352,7 +352,8 @@ class alignas(HWY_ALIGNMENT) Worker { // HWY_ALIGNMENT bytes
// thread_pool_test requires nonzero epoch.
uint32_t worker_epoch_ = 1;

HWY_MAYBE_UNUSED uint8_t padding_[HWY_ALIGNMENT - 64 - sizeof(victims_)];
HWY_MEMBER_VAR_MAYBE_UNUSED uint8_t
padding_[HWY_ALIGNMENT - 64 - sizeof(victims_)];
};
static_assert(sizeof(Worker) == HWY_ALIGNMENT, "");

Expand Down Expand Up @@ -992,7 +993,8 @@ class alignas(HWY_ALIGNMENT) ThreadPool {
// passed to `ThreadFunc`. Padding ensures that the workers' cache lines are
// not unnecessarily invalidated when the main thread writes other members.
alignas(HWY_ALIGNMENT) pool::Tasks tasks_;
HWY_MAYBE_UNUSED char padding_[HWY_ALIGNMENT - sizeof(pool::Tasks)];
HWY_MEMBER_VAR_MAYBE_UNUSED char
padding_[HWY_ALIGNMENT - sizeof(pool::Tasks)];

// In debug builds, detects if functions are re-entered.
std::atomic_flag busy_ = ATOMIC_FLAG_INIT;
Expand Down
10 changes: 5 additions & 5 deletions hwy/detect_targets.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,9 @@
// SVE[2] require recent clang or gcc versions.

#ifndef HWY_BROKEN_SVE // allow override
// GCC 10+. Clang 21 still has many test failures for SVE. No Apple CPU (at
// least up to and including M4 and A18) has SVE.
#if (HWY_COMPILER_CLANG && HWY_COMPILER_CLANG < 2200) || \
// GCC 10+. Clang 22 still has test failures for SVE, including MSAN. No Apple
// CPU (at least up to and including M4 and A18) has SVE.
#if (HWY_COMPILER_CLANG && HWY_COMPILER_CLANG < 2300) || \
(HWY_COMPILER_GCC_ACTUAL && HWY_COMPILER_GCC_ACTUAL < 1000) || \
HWY_OS_APPLE
#define HWY_BROKEN_SVE (HWY_SVE | HWY_SVE_256)
Expand All @@ -280,8 +280,8 @@
#endif // HWY_BROKEN_SVE

#ifndef HWY_BROKEN_SVE2 // allow override
// Clang 21 still has many test failures for SVE2.
#if (HWY_COMPILER_CLANG && HWY_COMPILER_CLANG < 2200) || \
// Clang 21 still has test failures for SVE2, including MSAN.
#if (HWY_COMPILER_CLANG && HWY_COMPILER_CLANG < 2300) || \
(HWY_COMPILER_GCC_ACTUAL && HWY_COMPILER_GCC_ACTUAL < 1000) || \
HWY_OS_APPLE
#define HWY_BROKEN_SVE2 (HWY_SVE2 | HWY_SVE2_128)
Expand Down