8000 HPX: Suppress -Wmaybe-uninitialized by masterleinad · Pull Request #8017 · kokkos/kokkos · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

HPX: Suppress -Wmaybe-uninitialized #8017

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 28, 2025

Conversation

masterleinad
Copy link
Contributor
@masterleinad masterleinad commented Apr 23, 2025

I was able to reproduce the errors linked in the source code, e.g., https://github.com/kokkos/kokkos/actions/runs/14537421172/job/40793403561 but don't have a better idea than to suppress for now.

Copy link
Member
@dalg24 dalg24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is a a pragma diagnostic ignored push/pop and option rather than wholesale disabling the warning?

@masterleinad
Copy link
Contributor Author

Is a a pragma diagnostic ignored push/pop and option rather than wholesale disabling the warning?

I tried that now:

/app/kokkos_hpx/kokkos_newest/core/src/View/Kokkos_BasicView.hpp:100:32: error: unknown warning group '-Wmaybe-uninitialized', ignored [clang-diagnostic-unknown-warning-option]
  100 | #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
      |                                ^

@dalg24
Copy link
Member
dalg24 commented Apr 24, 2025

Try

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunknown-warning-option"
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"

@masterleinad masterleinad marked this pull request as draft April 25, 2025 01:26
@masterleinad masterleinad force-pushed the hpx_suppress_maybe_uninitialized branch from 4c5ec82 to c24d6d7 Compare April 25, 2025 02:41
Signed-off-by: Daniel Arndt <arndtd@ornl.gov>
This reverts commit 1ed1d17.

Signed-off-by: Daniel Arndt <arndtd@ornl.gov>
Signed-off-by: Daniel Arndt <arndtd@ornl.gov>
@masterleinad masterleinad force-pushed the hpx_suppress_maybe_uninitialized branch from c24d6d7 to 476bcdb Compare April 25, 2025 02:42
@masterleinad
Copy link
Contributor Author

We need different suppressions for the compiler, gcc, and for clang-tidy.

@masterleinad masterleinad marked this pull request as ready for review April 25, 2025 02:43
@masterleinad masterleinad requested a review from dalg24 April 25, 2025 15:28
Copy link
8000
Member
@dalg24 dalg24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine with the diagnostic suppression in HPX/Kokkos_HPX.hpp but I do not love them in Kokkos_BasicView.hpp

@dalg24 dalg24 requested a review from msimberg April 25, 2025 15:41
Copy link
Member
@crtrott crtrott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I don't like the BasicView thing either, but I guess the only alternatives are turning the unused variable warning globally off for the HPX build, or turn warnings as error off for the HPX build. Given these options I guess I am ok with the push pop in BasicView. But I think the condition at the bottom is wrong or?

@@ -619,6 +629,11 @@ class BasicView {
template <class, class, class, class>
friend class BasicView;
};

#if defined(KOKKOS_ENABLE_HPX) && !defined(__clang__)
#pragma GCC diagnostic pop
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't this need to happen independent of clang? The diagnostic push up there is just dependent on HPX?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Copy link
Contributor
@msimberg msimberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to have a closer look at the HPX constructor warning next week. It smells like bogus, but can't be completely sure.

The BasicView warning is triggered also by just the serial backend, so I think that should not be guarded by KOKKOS_ENABLE_HPX.

Comment on lines +99 to +108
// FIXME_HPX spurious warnings like
// error: 'SR.14123' may be used uninitialized [-Werror=maybe-uninitialized]
#if defined(KOKKOS_ENABLE_HPX)
#pragma GCC diagnostic push
#if !defined(__clang__)
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
#pragma GCC diagnostic ignored "-Wuninitialized"
#endif

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I managed to reproduce this with just the serial backend enabled over here: https://github.com/msimberg/kokkos/actions/runs/14673110353/job/41184658454#step:10:343 (note that on the log posted in the PR description the error is also triggered from a serial backend test). It's otherwise the same as the HPX configuration, so it's likely something from the fedora image that's triggering it compared to the other serial CI configuration (there are a few other differences, not sure which are relevant)?

Comment on lines 172 to 173
: m_instance_data(Kokkos::Impl::HostSharedPtr<instance_data>(
&m_default_instance_data, &default_instance_deleter)) {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a few small tests, and one of the other things that silences the warning is initializing m_instance_data inside the body of the constructor. I think this points to the warning indeed being bogus. I'm thinking perhaps the static analyzer gets confused by the throwing execution path of HostSharedPtr or something like that?

In any case, I think, if this is indeed a false positive, the #pragma GCC diagnostic ignored is in my opinion clearer than e.g. moving the initialization to the constructor body (or another code change that silences the warning).

Signed-off-by: Daniel Arndt <arndtd@ornl.gov>
@masterleinad masterleinad requested a review from crtrott April 28, 2025 12:40
@masterleinad
Copy link
Contributor Author

The BasicView warning is triggered also by just the serial backend, so I think that should not be guarded by KOKKOS_ENABLE_HPX.

I'd prefer to just get our CI running again for now and investigate that in a follow-up. Compiling with OpenMP seems to be fine with the same image. 🤷.

@masterleinad masterleinad requested a review from msimberg April 28, 2025 12:43
Copy link
Member
@crtrott crtrott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this basically passed testing: I am ok merging it, but Daniel open a follow on PR to take away the #ifdef HPX. Since this reproduces with Serial only it seems a general issue. I am not convinced that it's worth it to spend 20 hours tracking down exactly which GCC version/header library or what not triggers it. If other people feel differently I will assign someone.

Copy link
Contributor
@nmm0 nmm0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with it, though it does seem a bit sketch. It's hard to tell whether it's a compiler bug or not -- and both GCC and clang warn?

@masterleinad
Copy link
Contributor Author

both GCC and clang warn?

Yes, but only after updating the toolchain. Technically, we compile with g++ and clang-tidy is also complaining.

@masterleinad
Copy link
Contributor Author

It's hard to tell whether it's a compiler bug or not -

Yes, the warning isn't very helpful but we haven't found anything obvious.

@masterleinad masterleinad dismissed msimberg’s stale review April 28, 2025 16:53

We will follow-up on the cause and possibly suppress the warning for more backends.

@diehlpk
Copy link
Contributor
diehlpk commented Apr 28, 2025

@hkaiser Any remarks with respect to HPX?

@hkaiser
Copy link
Contributor
hkaiser commented Apr 28, 2025

@hkaiser Any remarks with respect to HPX?

As @msimberg pointed out, this is not specific to the HPX backend.

@crtrott
Copy link
Member
crtrott commented Apr 28, 2025

I gonna merge, and we need to figure out what exact condition we need for the push in a follow on. As it was pointed out it's NOT HPX, but rather depending on some toolchain specific stuff. But that will likely take a few days and we need to get our CI working.

@crtrott crtrott merged commit 96859ab into kokkos:develop Apr 28, 2025
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants
0