Skip to content

[PGO] [BUILD] Compilation fails with --enable-pgo-use #55852

Description

@ptr1337

Version

23.2.0

Platform

6.11.7

Subsystem

No response

What steps will reproduce the bug?

Archlinux enviroment:

git clone https://github.com/cachyos/cachyos-pkgbuilds
cd nodejs
makepkg -si

How often does it reproduce? Is there a required condition?

All time

What is the expected behavior? Why is that the expected behavior?

Compilation is successful

What do you see instead?

The profile is gathered with "make test". See here:
https://github.com/CachyOS/CachyOS-PKGBUILDS/blob/master/nodejs/PKGBUILD#L53-L83

This issue has been started with node 23.1 - before the compilation was successful
Compilation fails at the second compilation with the PGO profile:

../deps/ada/ada.cpp:13698:6: error: number of counters in profile data for function ‘ada::url_aggregator::set_host_or_hostname<true>(std::basic_string_view<char, std::char_traits<char> >)bool’ does not match its profile data (counter ‘arcs’, expected 246 and have 244) [-Werror=coverage-mismatch]
13698 | bool url_aggregator::set_host_or_hostname(const std::string_view input) {
      |      ^~~~~~~~~~~~~~
../deps/ada/ada.cpp:13698:6: error: the control flow of function ‘ada::url_aggregator::set_host_or_hostname<true>(std::basic_string_view<char, std::char_traits<char> >)bool’ does not match its profile data (counter ‘time_profiler’) [-Werror=coverage-mismatch]
../deps/ada/ada.cpp: In member function ‘ada::url_aggregator::set_host_or_hostname<false>(std::basic_string_view<char, std::char_traits<char> >)bool’:
../deps/ada/ada.cpp:13698:6: error: number of counters in profile data for function ‘ada::url_aggregator::set_host_or_hostname<false>(std::basic_string_view<char, std::char_traits<char> >)bool’ does not match its profile data (counter ‘arcs’, expected 251 and have 249) [-Werror=coverage-mismatch]
../deps/ada/ada.cpp:13698:6: error: the control flow of function ‘ada::url_aggregator::set_host_or_hostname<false>(std::basic_string_view<char, std::char_traits<char> >)bool’ does not match its profile data (counter ‘time_profiler’) [-Werror=coverage-mismatch]
../deps/ada/ada.cpp: In member function ‘ada::url::set_host_or_hostname<true>(std::basic_string_view<char, std::char_traits<char> >)bool’:
../deps/ada/ada.cpp:11912:6: error: the control flow of function ‘ada::url::set_host_or_hostname<true>(std::basic_string_view<char, std::char_traits<char> >)bool’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
11912 | bool url::set_host_or_hostname(const std::string_view input) {
      |      ^~~
../deps/ada/ada.cpp:11912:6: error: the control flow of function ‘ada::url::set_host_or_hostname<true>(std::basic_string_view<char, std::char_traits<char> >)bool’ does not match its profile data (counter ‘time_profiler’) [-Werror=coverage-mismatch]
../deps/ada/ada.cpp: In member function ‘ada::url::set_host_or_hostname<false>(std::basic_string_view<char, std::char_traits<char> >)bool’:
../deps/ada/ada.cpp:11912:6: error: the control flow of function ‘ada::url::set_host_or_hostname<false>(std::basic_string_view<char, std::char_traits<char> >)bool’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
../deps/ada/ada.cpp:11912:6: error: the control flow of function ‘ada::url::set_host_or_hostname<false>(std::basic_string_view<char, std::char_traits<char> >)bool’ does not match its profile data (counter ‘time_profiler’) [-Werror=coverage-mismatch]
../deps/ada/ada.cpp: In function ‘ada::parser::parse_url_impl<ada::url_aggregator, false>(std::basic_string_view<char, std::char_traits<char> >, ada::url_aggregator const*)ada::url_aggregator’:
../deps/ada/ada.cpp:12144:13: error: number of counters in profile data for function ‘ada::parser::parse_url_impl<ada::url_aggregator, false>(std::basic_string_view<char, std::char_traits<char> >, ada::url_aggregator const*)ada::url_aggregator’ does not match its profile data (counter ‘arcs’, expected 601 and have 596) [-Werror=coverage-mismatch]
12144 | result_type parse_url_impl(std::string_view user_input,
      |             ^~~~~~~~~~~~~~
../deps/ada/ada.cpp:12144:13: error: the control flow of function ‘ada::parser::parse_url_impl<ada::url_aggregator, false>(std::basic_string_view<char, std::char_traits<char> >, ada::url_aggregator const*)ada::url_aggregator’ does not match its profile data (counter ‘time_profiler’) [-Werror=coverage-mismatch]
../deps/ada/ada.cpp: In member function ‘ada::url_aggregator::consume_prepared_path(std::basic_string_view<char, std::char_traits<char> >)’:
../deps/ada/ada.cpp:14751:13: error: the control flow of function ‘ada::url_aggregator::consume_prepared_path(std::basic_string_view<char, std::char_traits<char> >)’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
14751 | inline void url_aggregator::consume_prepared_path(std::string_view input) {
      |             ^~~~~~~~~~~~~~
../deps/ada/ada.cpp:14751:13: error: the control flow of function ‘ada::url_aggregator::consume_prepared_path(std::basic_string_view<char, std::char_traits<char> >)’ does not match its profile data (counter ‘time_profiler’) [-Werror=coverage-mismatch]
  g++ -o /tmp/pkg/src/node/out/Release/obj.target/v8_libbase/deps/v8/src/base/platform/semaphore.o ../deps/v8/src/base/platform/semaphore.cc '-D_GLIBCXX_USE_CXX11_ABI=1' '-DNODE_OPENSSL_CONF_NAME=nodejs_conf' '-DICU_NO_USER_DATA_OVERRIDE' '-DV8_GYP_BUILD' '-DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64' '-D__STDC_FORMAT_MACROS' '-DV8_TARGET_ARCH_X64' '-DV8_HAVE_TARGET_OS' '-DV8_TARGET_OS_LINUX' '-DV8_EMBEDDER_STRING="-node.11"' '-DENABLE_DISASSEMBLER' '-DV8_PROMISE_INTERNAL_FIELD_COUNT=1' '-DV8_ENABLE_PRIVATE_MAPPING_FORK_OPTIMIZATION' '-DV8_SHORT_BUILTIN_CALLS' '-DOBJECT_PRINT' '-DV8_INTL_SUPPORT' '-DV8_ATOMIC_OBJECT_FIELD_WRITES' '-DV8_ENABLE_LAZY_SOURCE_POSITIONS' '-DV8_USE_SIPHASH' '-DV8_SHARED_RO_HEAP' '-DNDEBUG' '-DV8_WIN64_UNWINDING_INFO' '-DV8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH' '-DV8_USE_ZLIB' '-DV8_ENABLE_SPARKPLUG' '-DV8_ENABLE_MAGLEV' '-DV8_ENABLE_TURBOFAN' '-DV8_ENABLE_WEBASSEMBLY' '-DV8_ENABLE_JAVASCRIPT_PROMISE_HOOKS' '-DV8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA' '-DV8_ALLOCATION_FOLDING' '-DV8_ALLOCATION_SITE_TRACKING' '-DV8_ADVANCED_BIGINT_ALGORITHMS' '-DBUILDING_V8_BASE_SHARED' -I../deps/v8 -I../deps/v8/include  -pthread -Wno-unused-parameter -Wno-strict-overflow -Wno-return-type -Wno-int-in-bool-context -Wno-deprecated -Wno-stringop-overflow -Wno-stringop-overread -Wno-restrict -Wno-array-bounds -Wno-nonnull -Wno-dangling-pointer -flax-vector-conversions -m64 -m64 -O3 -flto=4 -fuse-linker-plugin -ffat-lto-objects -fno-omit-frame-pointer -fprofile-use -fprofile-correction -fdata-sections -ffunction-sections -O3 -fno-rtti -fno-exceptions -fno-strict-aliasing -std=gnu++20 -Wno-invalid-offsetof -MMD -MF /tmp/pkg/src/node/out/Release/.deps//tmp/pkg/src/node/out/Release/obj.target/v8_libbase/deps/v8/src/base/platform/semaphore.o.d.raw  -march=native -O3 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -mpclmul -fno-semantic-interposition -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/tmp/pkg/src=/usr/src/debug/nodejs -fno-semantic-interposition -c
../deps/ada/ada.cpp: In member function ‘ada::url_aggregator::set_protocol(std::basic_string_view<char, std::char_traits<char> >)’:
../deps/ada/ada.cpp:13392:6: error: the control flow of function ‘ada::url_aggregator::set_protocol(std::basic_string_view<char, std::char_traits<char> >)’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
13392 | bool url_aggregator::set_protocol(const std::string_view input) {
      |      ^~~~~~~~~~~~~~
../deps/ada/ada.cpp:13392:6: error: the control flow of function ‘ada::url_aggregator::set_protocol(std::basic_string_view<char, std::char_traits<char> >)’ does not match its profile data (counter ‘time_profiler’) [-Werror=coverage-mismatch]
../deps/ada/ada.cpp: In function ‘ada::parser::parse_url_impl<ada::url_aggregator, true>(std::basic_string_view<char, std::char_traits<char> >, ada::url_aggregator const*)ada::url_aggregator’:
../deps/ada/ada.cpp:12144:13: error: the control flow of function ‘ada::parser::parse_url_impl<ada::url_aggregator, true>(std::basic_string_view<char, std::char_traits<char> >, ada::url_aggregator const*)ada::url_aggregator’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
12144 | result_type parse_url_impl(std::string_view user_input,
      |             ^~~~~~~~~~~~~~
../deps/ada/ada.cpp:12144:13: error: the control flow of function ‘ada::parser::parse_url_impl<ada::url_aggregator, true>(std::basic_string_view<char, std::char_traits<char> >, ada::url_aggregator const*)ada::url_aggregator’ does not match its profile data (counter ‘time_profiler’) [-Werror=coverage-mismatch]
../deps/ada/ada.cpp: In function ‘ada::parser::parse_url_impl<ada::url, true>(std::basic_string_view<char, std::char_traits<char> >, ada::url const*)ada::url’:
../deps/ada/ada.cpp:12144:13: error: number of counters in profile data for function ‘ada::parser::parse_url_impl<ada::url, true>(std::basic_string_view<char, std::char_traits<char> >, ada::url const*)ada::url’ does not match its profile data (counter ‘arcs’, expected 747 and have 740) [-Werror=coverage-mismatch]
../deps/ada/ada.cpp:12144:13: error: the control flow of function ‘ada::parser::parse_url_impl<ada::url, true>(std::basic_string_view<char, std::char_traits<char> >, ada::url const*)ada::url’ does not match its profile data (counter ‘time_profiler’) [-Werror=coverage-mismatch]
../deps/ada/ada.cpp: In member function ‘ada::url::set_protocol(std::basic_string_view<char, std::char_traits<char> >)’:
../deps/ada/ada.cpp:12091:6: error: the control flow of function ‘ada::url::set_protocol(std::basic_string_view<char, std::char_traits<char> >)’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
12091 | bool url::set_protocol(const std::string_view input) {
      |      ^~~
../deps/ada/ada.cpp:12091:6: error: the control flow of function ‘ada::url::set_protocol(std::basic_string_view<char, std::char_traits<char> >)’ does not match its profile data (counter ‘time_profiler’) [-Werror=coverage-mismatch]
../deps/ada/ada.cpp: In member function ‘ada::url::set_pathname(std::basic_string_view<char, std::char_traits<char> >)’:
../deps/ada/ada.cpp:12082:6: error: number of counters in profile data for function ‘ada::url::set_pathname(std::basic_string_view<char, std::char_traits<char> >)’ does not match its profile data (counter ‘arcs’, expected 428 and have 424) [-Werror=coverage-mismatch]
12082 | bool url::set_pathname(const std::string_view input) {
      |      ^~~
../deps/ada/ada.cpp:12082:6: error: the control flow of function ‘ada::url::set_pathname(std::basic_string_view<char, std::char_traits<char> >)’ does not match its profile data (counter ‘time_profiler’) [-Werror=coverage-mismatch]
../deps/ada/ada.cpp: In function ‘ada::href_from_file[abi:cxx11](std::basic_string_view<char, std::char_traits<char> >)’:
../deps/ada/ada.cpp:10366:13: error: number of counters in profile data for function ‘ada::href_from_file[abi:cxx11](std::basic_string_view<char, std::char_traits<char> >)’ does not match its profile data (counter ‘arcs’, expected 206 and have 202) [-Werror=coverage-mismatch]
10366 | std::string href_from_file(std::string_view input) {
      |             ^~~~~~~~~~~~~~
../deps/ada/ada.cpp:10366:13: error: the control flow of function ‘ada::href_from_file[abi:cxx11](std::basic_string_view<char, std::char_traits<char> >)’ does not match its profile data (counter ‘time_profiler’) [-Werror=coverage-mismatch]
  g++ 

Additional information

No response

Activity

  1. avivkeller commented on Nov 14, 2024

    @avivkeller
    Member

    Can you reproduce this without the external installation script? Just by building manually?

  2. anonrig commented on Nov 14, 2024

    @anonrig
    Member

    can you open an issue to github.com/ada-url/ada? any ideas @lemire?

  3. ptr1337 commented on Nov 14, 2024

    @ptr1337
    Author

    I have checked right now, if disabling shared-zlib helps, since we recently switched to zlib-ng, but that does not seem to help.
    Ill try a local compilation without the PKGBUILD on the weekend.

  4. ptr1337 commented on Nov 14, 2024

    @ptr1337
    Author

    Here is also the complete build log, in case you need it.

    nodejs-pgo-build.txt

  5. lemire commented on Nov 14, 2024

    @lemire
    Member

    The reporter gets a warning due to -Wcoverage-mismatch.

    Here is the GCC documentation

    Warn if feedback profiles do not match when using the -fprofile-use option. If a source file is changed between compiling with -fprofile-generate and with -fprofile-use, the files with the profile feedback can fail to match the source file and GCC cannot use the profile feedback information. By default, this warning is enabled and is treated as an error. -Wno-coverage-mismatch can be used to disable the warning or -Wno-error=coverage-mismatch can be used to disable the error.

    The most likely explanation is that user is using profile data from one version of the source, and then (likely by accident) trying to use it for profile-guided optimization with another version of the source code.

  6. ptr1337 commented on Nov 15, 2024

    @ptr1337
    Author

    Yes, this helps. Thank you :)

  7. ptr1337 commented on Nov 15, 2024

    @ptr1337
    Author

    FYI, I still think that the upstream ada project shouldnt kill the pgo compilation due that.
    They might want to disable to error there.

    Having mismatches with the PGO profile is pretty common.

  8. lemire commented on Nov 15, 2024

    @lemire
    Member

    @ptr1337

    The issue is not due to ada. Ada does not kill PGO compilation. Within Node.js, ada is just two source files. It does not know anything about PGO. As far as I can tell, the ada library appears to be causing the problem, but it is not. Or rather, it is merely the fact that some C++ functions within ada were changed between the time you acquired the profile and the time you attempted a PGO-guided built.

    The PGO support is provided by Node.js. -Wno-error=coverage-mismatch when the flag --enable-pgo-use is enabled, but that is a Node.js issue. The flag --enable-pgo-use was introduced in this PR:

    #21596

    Notice how it does not turn on -Wno-error=coverage-mismatch.

    I understand that you want, by default, to be able to do PGO built with profile data acquired from an older version of the code. So you want the flag -Wno-error=coverage-mismatch.

    If you want this change, I recommend you prepare a Node.js pull request with a justification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions