这是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
17 changes: 6 additions & 11 deletions hwy/auto_tune.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
#endif

#ifdef HWY_AUTOTUNE_STDSORT
#include <algorithm> // std::sort
#include <algorithm> // std::sort
#else
#include "hwy/contrib/sort/vqsort.h" // VQSort
#include "hwy/contrib/sort/vqsort.h" // VQSort
#endif

// Infrastructure for auto-tuning (choosing optimal parameters at runtime).
Expand Down Expand Up @@ -263,15 +263,11 @@ class CostDistribution {
OnlineNotify(copy[i]);
}
HWY_DASSERT(IsOnline());

#if SIZE_MAX == 0xFFFFFFFFu
(void)padding_;
#endif
}

size_t num_values_ = 0; // size of `values_` <= `kMaxValues`
#if SIZE_MAX == 0xFFFFFFFFu
uint32_t padding_ = 0;
HWY_MAYBE_UNUSED uint32_t padding_ = 0;
#endif

double online_n_ = 0.0; // number of calls to `OnlineNotify`.
Expand Down Expand Up @@ -422,10 +418,9 @@ class AutoTune {
const Config* Best() const { return best_; }

// If false, caller must call `SetCandidates` before `NextConfig`.
bool HasCandidates() const {
HWY_DASSERT(!Best());
return !candidates_.empty();
}
// NOTE: also called after Best() is non-null.
bool HasCandidates() const { return !candidates_.empty(); }

// WARNING: invalidates `Best()`, do not call if that is non-null.
void SetCandidates(std::vector<Config> candidates) {
HWY_DASSERT(!Best() && !HasCandidates());
Expand Down
12 changes: 10 additions & 2 deletions hwy/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -399,11 +399,19 @@ HWY_DLLEXPORT HWY_NORETURN void HWY_FORMAT(3, 4)
#endif

// For enabling HWY_DASSERT and shortening tests in slower debug builds
//
// Note: `HWY_IS_UBSAN` is specifically excluded from engaging debug
// builds. This is in service of Chromium's `-fsanitize=array-bounds` by
// default, where we don't want Highway to unconditionally build in
// debug mode.
//
// See also:
// https://docs.google.com/document/d/1eCtY4AZF-SiFHxhIYWzEytdIx3C24de7ccD6Y5Gn2H8/edit?tab=t.9zkn85hr82ms#heading=h.efcshvfql42c
#if !defined(HWY_IS_DEBUG_BUILD)
// Clang does not define NDEBUG, but it and GCC define __OPTIMIZE__, and recent
// MSVC defines NDEBUG (if not, could instead check _DEBUG).
#if (!defined(__OPTIMIZE__) && !defined(NDEBUG)) || HWY_IS_SANITIZER || \
defined(__clang_analyzer__)
#if (!defined(__OPTIMIZE__) && !defined(NDEBUG)) || \
(HWY_IS_SANITIZER && !HWY_IS_UBSAN) || defined(__clang_analyzer__)
#define HWY_IS_DEBUG_BUILD 1
#else
#define HWY_IS_DEBUG_BUILD 0
Expand Down
6 changes: 3 additions & 3 deletions hwy/contrib/sort/sort_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ void TestAllSort() {
Algo::kVQSort, Algo::kHeapSort,
};

for (int num : {129, 504, 3 * 1000, 34567}) {
for (int num : {129, 504, 3 * 1000, 14567}) {
const size_t num_lanes = AdjustedReps(static_cast<size_t>(num));
CallAllSortTraits(algos, num_lanes);
}
Expand All @@ -237,7 +237,7 @@ void TestAllSort() {
void TestAllPartialSort() {
const std::vector<Algo> algos{Algo::kVQPartialSort, Algo::kHeapPartialSort};

for (int num : {129, 504, 3 * 1000, 34567}) {
for (int num : {129, 504, 3 * 1000, 14567}) {
const size_t num_lanes = AdjustedReps(static_cast<size_t>(num));
CallAllSortTraits(algos, num_lanes);
}
Expand All @@ -246,7 +246,7 @@ void TestAllPartialSort() {
void TestAllSelect() {
const std::vector<Algo> algos{Algo::kVQSelect, Algo::kHeapSelect};

for (int num : {129, 504, 3 * 1000, 34567}) {
for (int num : {129, 504, 3 * 1000, 14567}) {
const size_t num_lanes = AdjustedReps(static_cast<size_t>(num));
CallAllSortTraits(algos, num_lanes);
}
Expand Down
Loading
Loading