public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/113376] New: Confusing notes when using C++17 parallel algorithms
@ 2024-01-13 13:04 pilarlatiesa at gmail dot com
2024-01-13 14:26 ` [Bug libstdc++/113376] " redi at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: pilarlatiesa at gmail dot com @ 2024-01-13 13:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113376
Bug ID: 113376
Summary: Confusing notes when using C++17 parallel algorithms
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: pilarlatiesa at gmail dot com
Target Milestone: ---
With GCC 14, the following code:
#include <algorithm>
#include <execution>
#include <vector>
void f(std::vector<int> &v)
{
std::for_each(std::execution::par, v.begin(), v.end(),
[](int &i) { i *= 2; });
}
when compiled emits a lot of notes like:
/home/pililatiesa/gcc-14/include/c++/14.0.0/pstl/algorithm_impl.h: In function
'_RandomAccessIterator
__pstl::__internal::__brick_unique(_RandomAccessIterator,
_RandomAccessIterator, _BinaryPredicate, std::true_type)':
/home/pililatiesa/gcc-14/include/c++/14.0.0/pstl/algorithm_impl.h:1219:5: note:
'#pragma message: [Parallel STL message]: "Vectorized algorithm unimplemented,
redirected to serial"'
1219 | _PSTL_PRAGMA_MESSAGE("Vectorized algorithm unimplemented,
redirected to serial");
| ^~~~~~~~~~~~~~~~~~~~
I don't understand why all these functions are even instantiated as they appear
to be related to the vectorization of other algorithms.
Furthermore, in pstl_config.h we have:
// Check the user-defined macro for warnings
#if defined(PSTL_USAGE_WARNINGS)
# undef _PSTL_USAGE_WARNINGS
# define _PSTL_USAGE_WARNINGS PSTL_USAGE_WARNINGS
// Check the internal macro for warnings
#elif !defined(_PSTL_USAGE_WARNINGS)
# define _PSTL_USAGE_WARNINGS 0
#endif
and later in this file:
#if defined(_PSTL_USAGE_WARNINGS)
# define _PSTL_PRAGMA_MESSAGE(x) _PSTL_PRAGMA_MESSAGE_IMPL(x)
# define _PSTL_PRAGMA_MESSAGE_POLICIES(x) _PSTL_PRAGMA_MESSAGE_IMPL(x)
#else
# define _PSTL_PRAGMA_MESSAGE(x)
# define _PSTL_PRAGMA_MESSAGE_POLICIES(x)
#endif
i.e. is checking defined(_PSTL_USAGE_WARNINGS) instead of just
_PSTL_USAGE_WARNINGS. This logic doesn't seem right.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/113376] Confusing notes when using C++17 parallel algorithms
2024-01-13 13:04 [Bug libstdc++/113376] New: Confusing notes when using C++17 parallel algorithms pilarlatiesa at gmail dot com
@ 2024-01-13 14:26 ` redi at gcc dot gnu.org
2024-01-15 8:50 ` pilarlatiesa at gmail dot com
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2024-01-13 14:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113376
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2024-01-13
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
CC| |rodgertq at gcc dot gnu.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/113376] Confusing notes when using C++17 parallel algorithms
2024-01-13 13:04 [Bug libstdc++/113376] New: Confusing notes when using C++17 parallel algorithms pilarlatiesa at gmail dot com
2024-01-13 14:26 ` [Bug libstdc++/113376] " redi at gcc dot gnu.org
@ 2024-01-15 8:50 ` pilarlatiesa at gmail dot com
2024-01-15 10:17 ` redi at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pilarlatiesa at gmail dot com @ 2024-01-15 8:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113376
--- Comment #1 from Pilar Latiesa <pilarlatiesa at gmail dot com> ---
(In reply to Pilar Latiesa from comment #0)
> I don't understand why all these functions are even instantiated as they
> appear to be related to the vectorization of other algorithms.
Pragma messages are shown irrespectively of whether the function is
instantiated.
> i.e. is checking defined(_PSTL_USAGE_WARNINGS) instead of just
> _PSTL_USAGE_WARNINGS. This logic doesn't seem right.
This change was made as part of r14-2109-g3162ca09dbdc2e:
- #if _PSTL_USAGE_WARNINGS
+ #if defined(_PSTL_USAGE_WARNINGS)
I don’t think this change is correct.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/113376] Confusing notes when using C++17 parallel algorithms
2024-01-13 13:04 [Bug libstdc++/113376] New: Confusing notes when using C++17 parallel algorithms pilarlatiesa at gmail dot com
2024-01-13 14:26 ` [Bug libstdc++/113376] " redi at gcc dot gnu.org
2024-01-15 8:50 ` pilarlatiesa at gmail dot com
@ 2024-01-15 10:17 ` redi at gcc dot gnu.org
2024-01-15 15:13 ` pilarlatiesa at gmail dot com
2024-01-15 16:05 ` redi at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2024-01-15 10:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113376
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Pilar Latiesa from comment #1)
> (In reply to Pilar Latiesa from comment #0)
> > I don't understand why all these functions are even instantiated as they
> > appear to be related to the vectorization of other algorithms.
>
> Pragma messages are shown irrespectively of whether the function is
> instantiated.
Yeah, I don't know if Clang works differently (I don't think so?) or if those
pragmas are just misused. They come from the upstream PSTL project.
>
> > i.e. is checking defined(_PSTL_USAGE_WARNINGS) instead of just
> > _PSTL_USAGE_WARNINGS. This logic doesn't seem right.
>
> This change was made as part of r14-2109-g3162ca09dbdc2e:
>
> - #if _PSTL_USAGE_WARNINGS
> + #if defined(_PSTL_USAGE_WARNINGS)
>
> I don’t think this change is correct.
Good catch.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/113376] Confusing notes when using C++17 parallel algorithms
2024-01-13 13:04 [Bug libstdc++/113376] New: Confusing notes when using C++17 parallel algorithms pilarlatiesa at gmail dot com
` (2 preceding siblings ...)
2024-01-15 10:17 ` redi at gcc dot gnu.org
@ 2024-01-15 15:13 ` pilarlatiesa at gmail dot com
2024-01-15 16:05 ` redi at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: pilarlatiesa at gmail dot com @ 2024-01-15 15:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113376
--- Comment #3 from Pilar Latiesa <pilarlatiesa at gmail dot com> ---
It seems that what is missing is a corresponding change in the macro definition
logic. It should have been changed to:
// Check the user-defined macro for warnings
#if defined(PSTL_USAGE_WARNINGS)
# define _PSTL_USAGE_WARNINGS
#endif
See
https://github.com/llvm/llvm-project/blob/5ccf19ded09f68bef43275c81c20b0e65f7c0b75/pstl/include/pstl/internal/pstl_config.h#L26
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/113376] Confusing notes when using C++17 parallel algorithms
2024-01-13 13:04 [Bug libstdc++/113376] New: Confusing notes when using C++17 parallel algorithms pilarlatiesa at gmail dot com
` (3 preceding siblings ...)
2024-01-15 15:13 ` pilarlatiesa at gmail dot com
@ 2024-01-15 16:05 ` redi at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2024-01-15 16:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113376
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
https://github.com/llvm/llvm-project/commit/c4823cc5db69f16bb5c96cf7d1b0d070da83605e
changed the logic upstream, but it looks like that didn't come downstream with
r14-2109-g3162ca09dbdc2e
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-01-15 16:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-13 13:04 [Bug libstdc++/113376] New: Confusing notes when using C++17 parallel algorithms pilarlatiesa at gmail dot com
2024-01-13 14:26 ` [Bug libstdc++/113376] " redi at gcc dot gnu.org
2024-01-15 8:50 ` pilarlatiesa at gmail dot com
2024-01-15 10:17 ` redi at gcc dot gnu.org
2024-01-15 15:13 ` pilarlatiesa at gmail dot com
2024-01-15 16:05 ` redi at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).