diff --git a/tools/kokoro/tests/test_kokoro_layer_options.cpp b/tools/kokoro/tests/test_kokoro_layer_options.cpp index 7fdd8e520..533d0fef4 100644 --- a/tools/kokoro/tests/test_kokoro_layer_options.cpp +++ b/tools/kokoro/tests/test_kokoro_layer_options.cpp @@ -102,10 +102,19 @@ int main() { detail::KokoroLayerOptionsScope s(opts(true)); snake1d_forward(x1.data(), 4, 1000, a.data()); } + // Both paths round the final x + sin^2(a x) / a to float, so each + // can be up to half an ulp of the output away from the exact value. + // Subtract that one-ulp allowance, then scale by |a| so the result + // is in sin^2 units and comparable to the fast_sin2 bound. double e = 0; for (int c = 0; c < 4; ++c) - for (int t = 0; t < 1000; ++t) - e = std::max(e, std::fabs((double) x[c * 1000 + t] - x1[c * 1000 + t]) * std::fabs(a[c])); + for (int t = 0; t < 1000; ++t) { + const float r = x[c * 1000 + t]; + const double ulp = (double) std::nextafter(std::fabs(r), INFINITY) - std::fabs(r); + const double d = std::fabs((double) r - x1[c * 1000 + t]); + e = std::max(e, std::max(0.0, d - ulp) * std::fabs(a[c])); + } + std::printf("snake1d fast vs libm: max excess over output rounding %.3g\n", e); CHECK(e < 1e-6, "snake mismatch %.3g", e); } diff --git a/tools/misaki-g2p/src/espeak.cpp b/tools/misaki-g2p/src/espeak.cpp index 338825995..2db51fc7f 100644 --- a/tools/misaki-g2p/src/espeak.cpp +++ b/tools/misaki-g2p/src/espeak.cpp @@ -270,6 +270,7 @@ u32 EspeakFallback::phonemize_line(const u32 & text) { return out; #else (void) text; + (void) data_dir_; return u32(); #endif } diff --git a/tools/misaki-g2p/src/lexicon.cpp b/tools/misaki-g2p/src/lexicon.cpp index 5349048d8..459f2f45d 100644 --- a/tools/misaki-g2p/src/lexicon.cpp +++ b/tools/misaki-g2p/src/lexicon.cpp @@ -2,6 +2,7 @@ // Reader for misaki-en-us.lex (written by convert_misaki_lexicon.py). #include "misaki-internal.h" +#include #include #include #include @@ -124,7 +125,7 @@ std::unique_ptr LexFile::open(const std::string & path, std::string & e LexFile::~LexFile() { #if !defined(MISAKI_NO_MMAP) - if (mapped_ && base_) munmap((void *) base_, size_); + if (mapped_ && base_) munmap(const_cast(base_), size_); #endif } diff --git a/tools/misaki-g2p/src/misaki-internal.h b/tools/misaki-g2p/src/misaki-internal.h index 7d9d7d3d1..8324c3da5 100644 --- a/tools/misaki-g2p/src/misaki-internal.h +++ b/tools/misaki-g2p/src/misaki-internal.h @@ -156,7 +156,7 @@ class EspeakFallback { u32 phonemize_line(const u32 & text); // libespeak-ng is process-global: another handle may have re-initialised // it with a different data directory since this one was opened. - [[maybe_unused]] std::string data_dir_; + std::string data_dir_; }; bool espeak_linked(); diff --git a/tools/misaki-g2p/src/tagger.cpp b/tools/misaki-g2p/src/tagger.cpp index 9de6d6766..3110b8dba 100644 --- a/tools/misaki-g2p/src/tagger.cpp +++ b/tools/misaki-g2p/src/tagger.cpp @@ -9,6 +9,7 @@ // so the rules aim at those decisions, not at full tagging accuracy. #include "misaki-internal.h" +#include #include #include diff --git a/tools/misaki-g2p/tests/test_agreement.cpp b/tools/misaki-g2p/tests/test_agreement.cpp index 8a930d977..cbf052b4a 100644 --- a/tools/misaki-g2p/tests/test_agreement.cpp +++ b/tools/misaki-g2p/tests/test_agreement.cpp @@ -12,6 +12,7 @@ #include "misaki-g2p.h" #include "misaki-internal.h" +#include #include #include #include diff --git a/tools/parakeet/tests/test_parakeet_kernels.cpp b/tools/parakeet/tests/test_parakeet_kernels.cpp index 903ba2d60..54d3ffae3 100644 --- a/tools/parakeet/tests/test_parakeet_kernels.cpp +++ b/tools/parakeet/tests/test_parakeet_kernels.cpp @@ -6,6 +6,7 @@ #include "pk-ops.h" #include "pk-pool.h" +#include #include #include #include diff --git a/tools/parakeet/tools/parakeet-cli.cpp b/tools/parakeet/tools/parakeet-cli.cpp index 3563da3cb..8487153b9 100644 --- a/tools/parakeet/tools/parakeet-cli.cpp +++ b/tools/parakeet/tools/parakeet-cli.cpp @@ -6,6 +6,7 @@ #include "parakeet.h" #include "pk-wav.h" +#include #include #include #include diff --git a/tools/parakeet/tools/pk-wav.h b/tools/parakeet/tools/pk-wav.h index ed1f9fc6e..3c4ceb15e 100644 --- a/tools/parakeet/tools/pk-wav.h +++ b/tools/parakeet/tools/pk-wav.h @@ -3,6 +3,7 @@ // windowed-sinc resampler to 16 kHz. #pragma once +#include #include #include #include