# Changeset 1043 for docs

Ignore:
Timestamp:
Mar 25, 2011, 8:45:18 PM (8 years ago)
Message:

Edits.

File:
1 edited

### Legend:

Unmodified
 r1031 % Hence, one of the foci in our study is the manner in which straight line SIMD code influences energy usage. This section provides an overview of the SIMD-based parallel bitstream XML parsers, Parabix1 and Parabix2. A comprehensive study of Parabix2 can be found in the technical report Parallel Parsing with Bitstream Addition: An XML Case Study'' \cite{Cameron2010}. \subsection{Parabix1} by utilizing $M$ SIMD registers of width $W$, it is possible to scan through $W$ characters in parallel. The register width $W$ varies between 64-bit for MMX, 128-bit for SSE, and 256-bit for AVX. Figure \ref{fig:inputstreams} presents an example of how we represent 8-bit ASCII characters using eight bitstreams. $B_0 \ldots B_7$ are the individual bitstreams. The $0$ bits in the bitstreams are represented by periods, so that the $1$ bits stand out. Figure \ref{fig:BitstreamsExample} presents an example of how we represent 8-bit ASCII characters using eight bitstreams. $B_0 \ldots B_7$ are the individual bitstreams. The $0$ bits in the bitstreams are represented by periods, so that the $1$ bits stand out. \begin{figure}[h] \begin{center} \begin{tabular}{cr}\\ source data  & \verbabc\\ $B_0$ & \verb..1.1.1.1.1....1.\\ $B_1$ & \verb...1.11.1..1..111\\ $B_2$ & \verb11.1...111.111.11\\ $B_3$ & \verb1..1...11..11..11\\ $B_4$ & \verb1111...1.111111.1\\ $B_5$ & \verb11111111111111111\\ $B_6$ & \verb.1..111..1...1...\\ $B_7$ & \verb.................\\ source data & \verbabc\\ $B_0$ & \verb..1.1.1.1.1...11.1.\\ $B_1$ & \verb...1.11.1..1...1111\\ $B_2$ & \verb11.1...111.111.1.11\\ $B_3$ & \verb1..1...11..11....11\\ $B_4$ & \verb1111...1.11111..1.1\\ $B_5$ & \verb1111111111111111111\\ $B_6$ & \verb.1..111..1...111...\\ $B_7$ & \verb...................\\ \end{tabular} \end{center} \caption{Parallel Bitstream Example} \label{fig:inputstreams} \label{fig:BitstreamsExample} \end{figure} In order represent the byte-oriented character data as parallel bitstreams, the source data is first loaded in sequential order and converted into its transposed representation through a series of packs, shifts, and bitwise operations. Using the SIMD capabilities of current commodity processors, this transposition of source data to bitstreams incurs an amortized overhead of about 1 CPU cycle per byte for transposition \cite{CameronHerdyLin2008}. When parsing, we need to consider multiple properties of characters at different stages during the process. Using the basis bitstreams, it is possible to combine them using bitwise logic in order to compute character-class bitstreams;t hat is, streams that identify the positions at which characters belonging to a specific character class occur. For example, a ASCII character is an open angle bracket <' if and only if $B_2 \land \ldots \land B_5 =$ 1 and the other basis bitstreams are 0 at the same position within the basis bitstreams. Once these character-class bitstreams are created, bit-scan operations, common to commodity processors, can be used for sequential markup scanning and data validation operations. A common operation in all XML parsers is identifying the start tags (<') and their accompanying end tags (either />'' or >'' depending whether the element tag is an empty element tag or not, respectively). Using the SIMD capabilities of current commodity processors, this transposition of source data to bitstreams incurs an amortized overhead of about 1 CPU cycle per byte for transposition \cite{CameronHerdyLin2008}. When parsing, we need to consider multiple properties of characters at different stages during the process. Using the basis bitstreams, it is possible to combine them using bitwise logic in order to compute character-class bitstreams; that is, streams that identify the positions at which characters belonging to a specific character class occur. For example, the $j$-th character is an open angle bracket <' if and only if the $j$-th bit of $B_2, B_3, B_4, B_5 =$ 1 and the $j$-th bit of $B_0, B_1, B_6, B_7 =$ 0. Once these character-class bitstreams are created, a $bitscan$ operation, which is an 1-cycle intrinsic function for commodity processors, can be used for sequential markup scanning and data validation operations. A common operation in all XML parsers is identifying the start tags (<') and their accompanying end tags (either />'' or >'' depending whether the element tag is an empty element tag or not, respectively). \begin{figure}[h] \begin{center} \begin{tabular}{lr}\\ source data  & \verbabc\\ % $N =$ name chars & \verb.11.111.11...11..\\ $M_0 = 1$ & \verb1................\\ $M_1 = advance(M_0)$ & \verb.1...............\\ $M_2 = bitscan('>')$ & \verb...1.............\\ $M_3 = advance(M_2)$ & \verb....1............\\ $M_4 = bitscan('<')$ & \verb.......1.........\\ $M_5 = bitscan('/')$ & \verb..........1......\\ $M_6 = advance(M_5)$ & \verb...........1.....\\ $M_7 = bitscan('<')$ & \verb.............1...\\ $M_8 = bitscan('/')$ & \verb...............1.\\ $M_9 = advance(M_8)$ & \verb................1\\ % $M_2 \lor M_6 \lor M_9$    & \verb...1.......1....1\\ source data                                     & \verbabc\\ % $N =$ name chars                             & \verb.11.111.11...11..\\ $M_0 = bitscan(1, \texttt{<})$                  & \verb1..................\\ $M_1 = advance(M_0)$                            & \verb.1.................\\ $M_2 = bitscan(M_1, \texttt{/}, \texttt{>})$    & \verb...1...............\\ $M_3 = advance(M_2)$                            & \verb....1..............\\ $M_4 = bitscan(M_3, \texttt{<})$                & \verb.......1...........\\ $M_5 = bitscan(M_4, \texttt{/}, \texttt{>})$    & \verb..........1........\\ $M_6 = advance(M_5)$                            & \verb...........1.......\\ $M_7 = bitscan(M_6, \texttt{<})$                & \verb.............1.....\\ $M_8 = bitscan(M_7, \texttt{/}, \texttt{>})$    & \verb.................1.\\ $M_9 = advance(M_8)$                            & \verb..................1\\ \end{tabular} \end{center} \end{figure} In Figure \ref{fig:Parabix1StarttagExample}, the first marker stream $M_0$ is created and the parser begins scanning the source data for an open angle bracket <', starting at position 1. Since the source data begins with <', $M_0$ is assigned a cursor position of 1. The $advance$ operation then then shifts the $M_0$'s cursor position by 1, resulting in the creation of a new marker stream, $M_1$, with the cursor position at 2. The following $bitscan$ operation takes the cursor position from $M_1$ and sequentially scans every position until it locates either an /' or >'. It finds a >' at position 4 and returns that as the new cursor position for $M_2$. Calculating $M_3$ advances the cursor again, and the $bitscan$ used to create $M_4$ locates the new opening angle bracket. This process continues until every open and closing angle bracket is located within the basis stream, resulting in a process that requires 3 logical operations to find each individual start and end tag pair. Unlike traditional parsers, these sequential operations are accelerated significantly since bit scan operations can perform up to $W$ finite state transitions per clock cycle. This approach has recently been applied to Unicode transcoding and XML parsing to good effect, with research prototypes showing substantial speed-ups over even the best of byte-at-a-time alternatives \cite{CameronHerdyLin2008, CameronLin2009, Cameron2010}. % In section 3, we should try to explain a bit more detail of the % operation.   Under Parabix 1, a little bit on transposition % and calculation of the [<] bitstream would be good, perhaps % using the examples from the 2010 Technical Report or EuroPar submission. Unlike traditional parsers, these sequential operations are accelerated significantly since the bitscan operation can perform up to $W$ finite state transitions per clock cycle. This approach has recently been applied to Unicode transcoding and XML parsing to good effect, with research prototypes showing substantial speed-ups over even the best of byte-at-a-time alternatives \cite{CameronHerdyLin2008, CameronLin2009, Cameron2010}. \subsection{Parabix2} % Under Parabix 2 a little discussion of bitwise addition for % scanning, perhaps again excerpted from the TR/EuroPar submission % would be good. In Parabix2, we replaced the sequential single-cursor parsing using bit scan instructions with a parallel parsing method using bitstream addition. Unlike the single-cursor approach of Parabix1 (and conceptually of all sequential XML parsers), Parabix2 processes multiple cursors in parallel. For example, using the source data from Figure \ref{fig:Parabix1StarttagExample}, Figure \ref{fig:Parabix2StarttagExample} shows how Parabix2 identifies and moves each of the start tag markers forwards to the corresponding end tag. Unlike Parabix1, Parabix2 begins scanning by creating two character-class marker streams, $N$, denoting the position of every alpha numeric character within the basis stream, and $M_0$, marking the position of every potential start tag in the bitstream. $M_0$ is then advanced to create $M_1$, which is fed into the first $scanto$ operation along with $N$.  To handle variable length tag names, the $scanto$ operation effectively locates the cursor positions of the end tags in parallel by adding $M_1$ to $N$, and using the bitwise AND operation of the negation of $N$ to find only the true end tags of $M_1$. Because and end tag may end on an /' or '>', $scanto$ is called again to advance any cursor from /' to >'. For additional details, please refer to technical report Parallel Parsing with Bitstream Addition: An XML Case Study'' \cite{Cameron2010}. %In Parabix2, we replace the sequential single-cursor parsing using bit scan instructions with a parallel parsing method using bitstream addition. Unlike the single cursor approach of Parabix1 and conceptually of traditional sequential approach, in Parabix2 multiple cursors positions are processed in parallel. In Parabix2, we replace the sequential single-cursor parsing using bit scan instructions with a parallel parsing method using bitstream addition. Unlike the single-cursor approach of Parabix1 (and conceptually of all sequential XML parsers), Parabix2 processes multiple cursors in parallel. For example, using the source data from Figure \ref{fig:Parabix1StarttagExample}, Figure \ref{fig:Parabix2StarttagExample} shows how Parabix2 identifies and moves each of the start tag markers forwards to the corresponding end tag. %Like Parabix1, we assume that $N$ (the name chars) has been computed using the basis bitstreams and that \begin{figure}[h] \begin{center} \begin{tabular}{lr}\\ source data  & \verbabc\\ $N =$ name chars & \verb.11.111.11...11..\\ $M_0 = [<]$ & \verb1......1....1....\\ $M_1 = \texttt{advance}(M_0)$ & \verb.1......1....1...\\ $M_2 = \texttt{scanto}('/','>')$ & \verb...1......1....1.\\ $M_3 = \texttt{scanto}(>)$ & \verb...1.......1....1 source data                     & \verbabc\\ $N =$ alphanumerics            & \verb.11.111.11...1111..\\ $M_0 = \texttt{[<]}$            & \verb1......1....1......\\ $M_1 = advance(M_0)$            & \verb.1......1....1.....\\ $M_2 = scanto(M_1, N)$          & \verb...1......1......1.\\ $M_3 = scanto(M_2, N)$          & \verb...1.......1......1 \end{tabular} \end{center}