Skip to content
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

P1928R12 #100

Merged
merged 37 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
4c20e20
Improve FIXME and INFO presentation
mattkretz Sep 13, 2024
7ebc2ea
D1928R12
mattkretz Jul 16, 2024
3e8975a
Add Fixme to generator ctor constraints
mattkretz Jul 19, 2024
8981352
Make destructible<simd<string>> well-formed
mattkretz Aug 28, 2024
d6a26b2
Typo: given
mattkretz Aug 28, 2024
e9e59ec
Remove FIXME: LWG agrees the wording is fine as is
mattkretz Aug 28, 2024
016816f
Small wording tweak
mattkretz Aug 28, 2024
3a27ada
Extend value-preserving to arithmetic and fix generator ctor
mattkretz Aug 28, 2024
b0c5a03
Restrict broadcast args From::value to arithmetic types
mattkretz Aug 28, 2024
8276419
Fix a minor typo: s/a/an/
mattkretz Sep 4, 2024
fb9d4d5
Reword notes on intent of enabling simd(mask) specializations
mattkretz Sep 4, 2024
5a3456e
Add indefinite articles
mattkretz Sep 4, 2024
6793935
Say binary_op instead of BinaryOperation
mattkretz Sep 4, 2024
222d85e
Improve presentation of inputs given to GENERALIZED_SUM
mattkretz Sep 4, 2024
d16bdbe
Fix use of the simd broadcast constructor in precondition of reduce.
mattkretz Sep 11, 2024
e007f39
Drop notes on intent of disabling specializations
mattkretz Sep 11, 2024
73ec26e
Reorder binary_op and identity_element on masked reduce
mattkretz Sep 11, 2024
b4140d6
Add exposition-only concept and use it for BinaryOperation in reduce
mattkretz Sep 11, 2024
c379db4
Fix markup of N
mattkretz Sep 11, 2024
3869e77
Remove std:: qualification
mattkretz Sep 11, 2024
a4f8b34
“Equivalent to” wording for simd_select
mattkretz Sep 11, 2024
d73e157
Mandate an identity element argument for masked reduce
mattkretz Sep 12, 2024
205bf34
Simplify precondition on identity element using only simd<T, 1>
mattkretz Sep 12, 2024
a2ebfde
Add constraints for simd_split and simd_cat
mattkretz Sep 12, 2024
3cb9c4a
Specify minmax using “Equivalent to:” wording.
mattkretz Sep 12, 2024
47c36c1
Add missing "is true"
mattkretz Sep 12, 2024
621939e
Change linebreaks to avoid overrun
mattkretz Sep 12, 2024
c2849a1
Turn the masked reduce mandates into a constraints
mattkretz Sep 12, 2024
ad41058
Remove spurious colon
mattkretz Sep 13, 2024
9061cd4
WIP: Spell out all cmath overloads and annotate wording with design i…
mattkretz Sep 12, 2024
7cacd41
Copy wording improvement form simd to mask; add note to LWG
mattkretz Oct 11, 2024
ad29797
Clarify design intent note in [simd.math]
mattkretz Oct 11, 2024
4900f78
Move exposition only stuff into new section above the synopsis
mattkretz Oct 11, 2024
076f09b
Discuss exposition only simd_flags
mattkretz Oct 11, 2024
b923691
Consistently write "exposition only" without hyphen
mattkretz Oct 11, 2024
dd95651
Remove space in "template <"
mattkretz Oct 11, 2024
c362a6f
P1928R12
mattkretz Oct 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 51 additions & 5 deletions P1928/changelog.tex
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ \section{Changelog}
\item Use \code{indirectly_writable} instead of \code{output_iterator}.
\item Replace most \code{size_t} and \code{int} uses by \code{\textit{simd-size-type}} signed integer type.
\item Remove everything in \code{simd_abi} and the namespace itself.
\item Reword section on ABI tags using exposition-only ABI tag aliases.
\item Reword section on ABI tags using exposition only ABI tag aliases.
\item Guarantee generator ctor calls callable exactly once per index.
\item Remove \code{int}/\code{unsigned int} exception from conversion rules of broadcast ctor.
\item Rename \code{loadstore_flags} to \code{simd_flags}.
Expand All @@ -97,7 +97,7 @@ \section{Changelog}
\item Rename \code{simd<T, Abi>} to \code{basic_simd<Bytes, Abi>} and replace all occurrences accordingly.
\item Remove \code{long double} from the set of vectorizable types.
\item Remove \code{is_abi_tag}, \code{is_simd}, and \code{is_simd_mask} traits.
\item Make \code{simd_size} exposition-only.
\item Make \code{simd_size} exposition only.
\end{revision}

\begin{revision}
Expand All @@ -119,7 +119,7 @@ \section{Changelog}
\begin{revision}
\item Include \code{std::optional} return value from \code{reduce_min_index} and \code{reduce_max_index} in the exploration.
\item Fix \LaTeX{} markup errors.
\item Remove repetitive mention of “exposition-only” before \deducet.
\item Remove repetitive mention of “exposition only” before \deducet.
\item Replace “TU” with “translation unit”.
\item Reorder first paragraphs in the wording, especially reducing the note on compiling down to SIMD instructions.
\item Replace cv-unqualified arithmetic types with a more precise list of types.
Expand All @@ -139,7 +139,7 @@ \section{Changelog}
\item Add instructions to add \code{<simd>} to the table of headers in [headers].
\item Add instructions to add a new subclause to the table in [numerics.general].
\item Add instructions to add \code{<simd>} [diff.23.library].
\item Add \simdsizev to the wording and replace \code{simd_size_v} to actually implement “Make \code{simd_size} exposition-only.”
\item Add \simdsizev to the wording and replace \code{simd_size_v} to actually implement “Make \code{simd_size} exposition only.”
\item Restored precondition (and removed \code{noexcept}) on
\code{reduce_min_index} and \code{reduce_max_index} as directed by LEWG.
\end{revision}
Expand Down Expand Up @@ -173,7 +173,7 @@ \section{Changelog}
\item Fix constraints on shift operators with \simdsizetype{} on the right operand.
\item Remove wording removed by P3275 (non-const \code{operator[]}).
\item Make intrinsics conversion recommended practice.
\item Make \code{simd_flags} template arguments exposition-only.
\item Make \code{simd_flags} template arguments exposition only.
\item Make \code{simd_alignment} \emph{not} implementation-defined.
\item Reword “supported” to “enabled or disabled”.
\item Apply improved wording from \ref{sec:simd.overview} to \ref{sec:simd.mask.overview}.
Expand All @@ -182,6 +182,52 @@ \section{Changelog}
\item Use \code{to_address} on contiguous iterators (\ref{sec:simd.ctor} and \ref{sec:simd.copy}).
This is more explicit about allowing memcpy on the complete range rather than
having to iterate the range per element.
\end{revision}

\begin{revision}
\item Fix default size of \code{simd} and \code{simd_mask} aliases
(\ref{sec:simd.syn}, necessary for
\std\code{destructible<\MayBreak{}\std{}simd<\MayBreak\std{}string>>} to be well-formed).
\item Extend value-preserving to encompass conversions from all arithmetic
types. Use this new freedom in \ref{sec:simd.ctor} to fully constrain the
generator constructor and to plug a specification hole in the broadcast
constructor.
\item Fix broadcast constructor wording by constraining \constexprwrapperlike
arguments to arithmetic types.
\item Reword the note in \ref{sec:simd.overview} and
\ref{sec:simd.mask.overview} to talk about the “architecture of the execution
environment” as used in the note on \code{int} in [basic.fundamental].
\item Say \code{binary_op} instead of \code{BinaryOperation} in “\ldots does
not modify \code{x}”. (\ref{sec:simd.reductions})
\item Improve presentation of inputs given to
\code{\placeholdernc{GENERALIZED_SUM}} in \ref{sec:simd.reductions}.
\item Fix use of the simd broadcast constructor in precondition of
\code{reduce}.
\item Drop the notes that were trying to explain the intent behind
enabling/disabling simd(mask) specializations.
\item Reorder \code{binary_op} and \code{identity_element} on masked
\code{reduce}. Provide \code{std::plus<>} as default \code{BinaryOperation}
and specify a default argument for \code{identity_element}
(\ref{sec:simd.reductions}).
\item Use “Equivalent to” wording for \code{simd_select} and carve out an
exception for ADL for \simdselect (\ref{sec:simd.alg}).
\item Add a constraint for a provided identity element argument for masked
reduce if the binary operation isn't one of the five known operations.
\item Add exposition only concept \reductionoperation with additional semantic
constraints and use it in the \code{reduce} constraints
(\ref{sec:simd.reductions}).
\item Simplify precondition on identity element, using only \code{simd<T, 1>}
instead of all possible ABI tags. The latter follows from the former through
mandating an \emph{element-wise binary operation}.
\item Add constraints for \code{simd_split} and \code{simd_cat}, requiring
enabled \code{basic_simd}/\code{basic_simd_mask} types
(\ref{sec:simd.creation}).
\item Specify \code{minmax} using “Equivalent to:” wording.
(\ref{sec:simd.alg})
\item Discuss whether we could/should make \code{simd_flags} exposition only.
(\sect{sec:simd_flags-expos})
\item Move all exposition only types, variables, and concepts into their own
section before the synopsis. (\ref{sec:simd.expos})

%\todo Reorder \code{simd} and \code{simd_mask} specification in the wording (mask first).
\end{revision}
41 changes: 29 additions & 12 deletions P1928/main.tex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
\newcommand\wgTitle{std::simd --- merge data-parallel types from the Parallelism TS 2}
\newcommand\wgName{Matthias Kretz <[email protected]>}
\newcommand\wgDocumentNumber{P1928R11}
\newcommand\wgDocumentNumber{P1928R12}
\newcommand\wgGroup{LWG}
\newcommand\wgTarget{\CC{}26}
\newcommand\wgAcknowledgements{Thanks to Daniel Towner, Ruslan Arutyunyan, Jonathan Müller, Jeff Garland, and Nicolas Morales for discussions and/or pull requests on this/previous paper(s).}
Expand Down Expand Up @@ -39,6 +39,9 @@
\newcommand\convertflag{\UNSP{convert-flag}}
\newcommand\alignedflag{\UNSP{aligned-flag}}
\newcommand\overalignedflag{\UNSP{overaligned-flag}}
\newcommand\reductionoperation{\UNSP{reduction-binary-operation}}
\newcommand\simdfloatingpoint{\UNSP{simd-floating-point}}
\newcommand\multisimdfloatingpoint{\UNSP{multi-arg-simd-floating-point}}

\renewcommand{\lst}[1]{Listing~\ref{#1}}
\renewcommand{\sect}[1]{Section~\ref{#1}}
Expand Down Expand Up @@ -297,7 +300,7 @@ \subsection{Make use of \code{int} and \code{size_t} consistent}\label{sec:simds

Alignments and values identifying a \code{sizeof} still use \code{size_t}.

The type \simdsizetype{} is an exposition-only alias for a signed integer type.
The type \simdsizetype{} is an exposition only alias for a signed integer type.
I.e. the implementation is free to choose any signed integer type.

The rationale given in the LEWG discussion was a desire to avoid type
Expand Down Expand Up @@ -493,18 +496,32 @@ \subsection{No freestanding SIMD}\label{sec:freestanding}
Note that freestanding is just the baseline requirement and embedded targets
are still free to add \code{simd} support.

\section{Outlook}
\subsection{\code{element_reference} is overspecified}
\code{element_reference} is spelled out in a lot of detail.
It may be better to define its requirements in a list of requirements or a table instead.
\section{Design clarifications while in LWG review}
\subsection{Should the \code{simd_flags} template be exposition only?}\label{sec:simd_flags-expos}

This change is not reflected in the wording, pending encouragement from WG21 (mostly LWG).
The \code{simd_flags} class template could be exposition only in the standard
without breaking any of the direct use cases of the \simd interface.
However, if a user needs to write a function that passes \code{simd_flags} into
a function, how should the function parameter be constrained?
Do we want everyone to write an unconstrained:
\medskip\begin{lstlisting}[style=Vc]
void f(auto flags) { v.copy_to(data, flags); }
\end{lstlisting}
or do we want to enable:
\medskip\begin{lstlisting}[style=Vc]
template <typename... Flags>
void f(std::simd_flags<Flags...> flags) { v.copy_to(data, flags); }
\end{lstlisting}

As an alternative \cite{P3275R0} discusses removal of non-const subscripts
altogether.
This would imply removal of \code{element_reference}, simplifying the wording
by a good chunk.
If we make the \code{simd_flags} class template exposition only we should
consider adding a \code{concept} or at least a type trait in its place:
\medskip\begin{lstlisting}[style=Vc]
void f(std::simd_flags auto flags) { v.copy_to(data, flags); }
\end{lstlisting}
I don't think this is a clear improvement.
In any case, a change like this would need to go via LEWG.

\section{Outlook}
\subsection{Clean up math function overloads}
The wording that produces \simd overloads misses a few cases and leaves room for ambiguity.
There is also no explicit mention of integral overloads that are supported in \code{<cmath>} (e.g. \std\code{cos(1)} calling \std\code{cos(double)}).
Expand Down Expand Up @@ -592,7 +609,7 @@ \subsection{Formatting support}\label{sec:formatting}
%
%\subsection{\code{simd_select} overload set}\label{sec:simdselectwording}
%
%\wglink{P1928R6} presented the following overload set of the exposition-only
%\wglink{P1928R6} presented the following overload set of the exposition only
%hidden friend \code{\simdselect}:
%\begin{codeblock}
%template<class T, class Abi> class basic_simd {
Expand Down
Loading