这是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
5 changes: 4 additions & 1 deletion BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,10 @@ cc_test(
name = "list_targets",
size = "small",
srcs = ["hwy/tests/list_targets.cc"],
deps = [":hwy"],
deps = [
":hwy",
":timer",
],
)

cc_test(
Expand Down
4 changes: 2 additions & 2 deletions hwy/detect_targets.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,10 @@
#endif // HWY_BROKEN_MSVC

#ifndef HWY_BROKEN_AVX10_2 // allow override
// AVX10_2 requires clang >= 20.1 (postpone to 22 due to "avx10.2-512" remnant,
// AVX10_2 requires clang >= 20.1 (postpone to 23 due to "avx10.2-512" remnant,
// only removed in https://github.com/llvm/llvm-project/pull/157034) or
// gcc >= 15.2 with binutils 2.44.
#if (HWY_COMPILER_CLANG < 2200) && (HWY_COMPILER_GCC_ACTUAL < 1502)
#if (HWY_COMPILER_CLANG < 2300) && (HWY_COMPILER_GCC_ACTUAL < 1502)
#define HWY_BROKEN_AVX10_2 HWY_AVX10_2
#else
#define HWY_BROKEN_AVX10_2 0
Expand Down
4 changes: 4 additions & 0 deletions hwy/ops/set_macros-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,11 @@
#endif

#if HWY_COMPILER_GCC_ACTUAL >= 1500 || HWY_COMPILER_CLANG >= 2200
#if HWY_HAVE_EVEX512
#define HWY_TARGET_STR_AVX10_2 HWY_TARGET_STR_AVX3_SPR ",avx10.2-512"
#else
#define HWY_TARGET_STR_AVX10_2 HWY_TARGET_STR_AVX3_SPR ",avx10.2"
#endif // HWY_HAVE_EVEX512
#else
#define HWY_TARGET_STR_AVX10_2 HWY_TARGET_STR_AVX3_SPR
#endif
Expand Down
46 changes: 36 additions & 10 deletions hwy/tests/list_targets.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,16 @@
#include <stdio.h>

#include "hwy/detect_compiler_arch.h"
#include "hwy/timer.h" // GetCpuString

#undef HWY_TARGET_INCLUDE
#define HWY_TARGET_INCLUDE "hwy/tests/list_targets.cc"
#include "hwy/foreach_target.h" // IWYU pragma: keep
#include "hwy/highway.h"

namespace {
HWY_BEFORE_NAMESPACE();
namespace hwy {
namespace HWY_NAMESPACE {

void PrintCompiler() {
if (HWY_COMPILER_ICX) {
Expand Down Expand Up @@ -80,9 +87,8 @@ void PrintConfig() {
const char* target_str = "";
#endif
fprintf(stderr,
"Target attributes: %s\nConfig: emu128:%d scalar:%d static:%d "
"all_attain:%d "
"is_test:%d\n",
"Target attributes: %s\n"
"Config: emu128:%d scalar:%d static:%d all_attain:%d is_test:%d\n",
target_str, only_emu128, only_scalar, only_static, all_attain,
is_test);
}
Expand All @@ -99,8 +105,7 @@ void PrintHave() {
void PrintTargets(const char* msg, int64_t targets) {
fprintf(stderr, "%s", msg);
// For each bit other than the sign bit:
for (int64_t x = targets & hwy::LimitsMax<int64_t>(); x != 0;
x = x & (x - 1)) {
for (int64_t x = targets & 0x7FFFFFFFFFFFFFFFLL; x != 0; x = x & (x - 1)) {
// Extract value of least-significant bit.
fprintf(stderr, " %s", hwy::TargetName(x & (~x + 1)));
}
Expand All @@ -116,9 +121,7 @@ void TestVisitor() {
}
}

} // namespace

int main() {
void PrintAll() {
PrintCompiler();
PrintConfig();
PrintHave();
Expand All @@ -129,7 +132,30 @@ int main() {
PrintTargets("HWY_STATIC_TARGET: ", HWY_STATIC_TARGET);
PrintTargets("HWY_BROKEN_TARGETS: ", HWY_BROKEN_TARGETS);
PrintTargets("HWY_DISABLED_TARGETS: ", HWY_DISABLED_TARGETS);
PrintTargets("Current CPU supports: ", hwy::SupportedTargets());
PrintTargets("CPU supports: ", hwy::SupportedTargets());

char cpu100[100];
(void)platform::GetCpuString(cpu100);
fprintf(stderr, "CPU: %s\n", cpu100);

TestVisitor();
}

// NOLINTNEXTLINE(google-readability-namespace-comments)
} // namespace HWY_NAMESPACE
} // namespace hwy
HWY_AFTER_NAMESPACE();

#if HWY_ONCE
namespace hwy {
namespace {
HWY_EXPORT(PrintAll);
void CallPrintAll() { HWY_DYNAMIC_DISPATCH(PrintAll)(); }
} // namespace
} // namespace hwy

int main() {
hwy::CallPrintAll();
return 0;
}
#endif // HWY_ONCE