From e4fa569fb213a93d11a69d1ad8d053cbc5da91db Mon Sep 17 00:00:00 2001 From: Shaw Date: Wed, 14 Oct 2026 03:27:42 -0400 Subject: [PATCH 1/2] misaki-g2p/parakeet: fix GCC and clang-cl CI build breaks - tagger.cpp used std::all_of without ; GCC and the Windows clang toolchains reject it. Include in every misaki-g2p and parakeet source that uses std::min/std::max/std::all_of. - GCC ignores [[maybe_unused]] on a non-static data member and -Werror=attributes turned that into an error in misaki-internal.h. Drop the attribute and reference data_dir_ in the no-espeak path so clang's -Wunused-private-field stays quiet. - lexicon.cpp munmap cast dropped const via a C cast (-Wcast-qual). Co-Authored-By: Claude Opus 5.5 --- tools/misaki-g2p/src/espeak.cpp | 1 + tools/misaki-g2p/src/lexicon.cpp | 3 ++- tools/misaki-g2p/src/misaki-internal.h | 2 +- tools/misaki-g2p/src/tagger.cpp | 1 + tools/misaki-g2p/tests/test_agreement.cpp | 1 + tools/parakeet/tests/test_parakeet_kernels.cpp | 1 + tools/parakeet/tools/parakeet-cli.cpp | 1 + tools/parakeet/tools/pk-wav.h | 1 + 8 files changed, 9 insertions(+), 2 deletions(-) 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 From b52b6a6be121988475b7f9942dbceeab212a6c23 Mon Sep 17 00:00:00 2001 From: Shaw Date: Wed, 14 Oct 2026 03:46:45 -0400 Subject: [PATCH 2/2] kokoro tests: allow output rounding in the fast-Snake comparison test-kokoro-layer-options compared the fast and libm Snake paths with a fixed 1e-6 bound on |diff| * |a|. Both paths round x + sin^2(a x) / a to float, so for |x| near 8-16 the output ulp alone (~9.5e-7) times |a| exceeds that bound. Every Linux, Windows and macOS-x64 job now reaches this test (misaki-g2p no longer stops the build first), and all of them failed it with 1.06e-06. Subtract one output ulp before scaling, so the check still bounds the fast_sin2 error (observed 2.4-2.8e-07) and no longer counts float rounding of the sum. Co-Authored-By: Claude Opus 5.5 --- tools/kokoro/tests/test_kokoro_layer_options.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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); }