Skip to content

Commit 63d715a

Browse files
authored
Merge pull request #69 from mkinsner/accessor_no_uses
Clarify accessor mode union, and requirements for accessors without uses
2 parents 75d82d8 + bf10cf0 commit 63d715a

File tree

2 files changed

+37
-7
lines changed

2 files changed

+37
-7
lines changed

latex/accessors.tex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
An \codeinline{accessor} provides access to the data managed by a \gls{buffer}
1313
or \gls{image}, or to shared \gls{local-memory} allocated by the runtime. An
1414
\gls{accessor} allows users to define \textbf{requirements} to memory objects
15-
(see Section~\ref{sub.section.memmodel.app}).
15+
(see Section~\ref{sub.section.memmodel.app}). Note that construction of an
16+
\gls{accessor} is what defines a memory object requirement, and these
17+
requirements are independent of whether there are any uses of an \gls{accessor}.
1618

1719
The SYCL \codeinline{accessor} class template takes five template parameters:
1820

latex/architecture.tex

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -475,11 +475,12 @@ \subsection{SYCL Application Memory Model}
475475
consistent access to the memory from the different devices to the memory
476476
objects.
477477

478-
To access memory objects from inside a kernel, the user must create an
478+
To access a memory object, the user must create an
479479
\gls{accessor} object which parameterizes the type of access
480-
the kernel requires.
480+
to the memory object that a kernel or the host requires.
481481
The \gls{accessor} object defines a requirement to access a memory
482-
object from a \gls{command-group}.
482+
object, and this requirement is defined by
483+
construction of an accessor, regardless of whether there are any uses in a kernel or by the host.
483484
The \codeinline{cl::sycl::accessor} object specifies
484485
whether the access is via global memory, constant memory or image samplers and
485486
their associated access functions. The \gls{accessor} also specifies whether the
@@ -532,9 +533,36 @@ \subsection{SYCL Application Memory Model}
532533
\gls{command-group} is irrelevant to the requirements they define.
533534
All accessors always apply to the entire \gls{command-group} object where
534535
they are defined.
535-
When multiple \glspl{accessor} in the same \gls{command-group} define requirements to the same memory object, the access mode is resolved as the union of
536-
all the different access modes, e.g. $CG(b1_{R},b1_{W})$ is equivalent
537-
to $CG(b1_{RW})$.
536+
537+
When multiple \glspl{accessor} in the same \gls{command-group} define different
538+
access modes to the same memory object, the combined memory object requirement is
539+
resolved according to Table~\ref{table.access.mode.union}.
540+
The atomic access mode acts as if it was read-write (RW) when determining the combined requirement.
541+
The rules in Table~\ref{table.access.mode.union} are commutative and associative.
542+
543+
\begin{table}[!h]
544+
\centering
545+
\begin{tabular}{| p{1.5 in} | p{1.5 in} | p{1.5 in} |}
546+
\hline
547+
\cellcolor{lightgray} \textbf{One access mode}
548+
& \cellcolor{lightgray} \textbf{Other access mode}
549+
& \cellcolor{lightgray} \textbf{Combined requirement} \\
550+
\hline
551+
read (RO) & write (WO) & read-write (RW) \\
552+
read (RO) & read-write (RW) & read-write (RW) \\
553+
write (WO) & read-write (RW) & read-write (RW) \\
554+
discard-write (DW) & discard-read-write (DRW) & discard-read-write (DRW) \\
555+
discard-write (DW) & write (WO) & write (WO) \\
556+
discard-write (DW) & read (RO) & read-write (RW) \\
557+
discard-write (DW) & read-write (RW) & read-write (RW) \\
558+
discard-read-write (DRW) & write (WO) & read-write (RW) \\
559+
discard-read-write (DRW) & read (RO) & read-write (RW) \\
560+
discard-read-write (DRW) & read-write (RW) & read-write (RW) \\
561+
\hline
562+
\end{tabular}
563+
\caption{Combined requirement from two different accessor access modes within the same \gls{command-group}. The rules are commutative and associative}
564+
\label{table.access.mode.union}
565+
\end{table}
538566

539567
A buffer created from a range of an existing buffer is called
540568
a \keyword{sub-buffer}.

0 commit comments

Comments
 (0)