[PATCH] libstdc++: Make PSTL algorithms accept C++20 iterators [PR110512]
Dvorskiy, Mikhail
mikhail.dvorskiy@intel.com
Fri Jan 26 17:48:25 GMT 2024
Hi everyone,
Let me explain a reason of the issue connected with _PSTL_USAGE_WARNINGS macro with GCC14.
Firstly, there is no such issue on version GCC 13.2.0, because _PSTL_PRAGMA_MESSAGE is defined in #pragma message only if _PSTL_USAGE_WARNINGS > 0, please have a look:
https://github.com/gcc-mirror/gcc/blob/releases/gcc-13.2.0/libstdc%2B%2B-v3/include/pstl/pstl_config.h#L160
On GCC trunk there is another preprocessor logic - _PSTL_PRAGMA_MESSAGE is defined in #pragma message when _PSTL_USAGE_WARNINGS is merely defined.
https://github.com/gcc-mirror/gcc/blame/9693459e030977d6e906ea7eb587ed09ee4fddbd/libstdc%2B%2B-v3/include/pstl/pstl_config.h#L180
while _PSTL_USAGE_WARNINGS is defined to 0 by default:
https://github.com/gcc-mirror/gcc/blame/9693459e030977d6e906ea7eb587ed09ee4fddbd/libstdc%2B%2B-v3/include/pstl/pstl_config.h#L29
Best regards,
Mikhail Dvorskiy
-----Original Message-----
From: Jonathan Wakely <jwakely@redhat.com>
Sent: Saturday, January 13, 2024 12:20 PM
To: Pilar Latiesa <pilarlatiesa@gmail.com>
Cc: libstdc++@gcc.gnu.org; gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] libstdc++: Make PSTL algorithms accept C++20 iterators [PR110512]
On Sat, 13 Jan 2024 at 09:36, Pilar Latiesa <pilarlatiesa@gmail.com> wrote:
>
> Hi Jonathan
>
> Thanks so much for implementing this.
>
> There are a couple of typos in the patch description: 's/C==17RandomAccessIterator/Cpp17RandomAccessIterator/' and 's/__or_/__and_/'.
Thanks for the comments, I'll fix those.
>
> I've applied your patch localy and it works fine for all my use cases, which admitedly simply consist of using views::zip and views::enumerate with std::for_each. My tbb version is 2020.1.
Thanks for checking it, all feedback is useful.
>
> Unrelated to your patch, with GCC 14, I'm getting a ton of notes for code like:
>
> void f(std::vector<int> &v)
> { std::for_each(std::execution::par, v.begin(), v.end(), [](int &i)
> { i *= 2; }); }
>
> indicating that some internal functions are not vectorized.
>
> I very much like getting warnings if an algorithm happens to fall back to its serial version, but in this case I didn't even asked for (unseq) vectorization, yet I got bunch of notes: "Vectorized algorithm unimplemented, redirected to serial" and the algorithm itself is indeed parallelized.
>
> The notes are so confusing that I would suggest undefining _PSTL_USAGE_WARNINGS for G++ (in fact, I don't understand the logic that uses this macro in pstl_config.h).
Yeah, I've seen some of those, and I'm afraid I don't have any ideas about them for now. Could you report it to bugzilla so we don't forget to look into it? Thanks!
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
More information about the Libstdc++
mailing list