Changeset 1099 for docs


Ignore:
Timestamp:
Apr 8, 2011, 8:18:00 PM (8 years ago)
Author:
ksherdy
Message:

Re-write many sections.

Location:
docs/PACT2011
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • docs/PACT2011/03-research.tex

    r1087 r1099  
    3232% Hence, one of the foci in our study is the manner in which straight line SIMD code influences energy usage.
    3333
    34 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}.
     34This section provides an overview of the SIMD-based parallel bit stream 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}.
    3535
    3636\subsection{Parabix1}
     
    3838% Our first generation parallel bitstream XML parser---Parabix1---uses employs a less conventional approach of SIMD technology to represent text in parallel bitstreams. Bits of each stream are in one-to-one-correspondence with the bytes of a character stream. A transposition step first transforms sequential byte stream data into eight basis bitstreams for the bits of each byte.
    3939
    40 At a high level, Parabix1 processes source XML in a functionally equivalent manner as a traditional processor. That is, Parabix1 moves sequentially through the source document, maintaining a single cursor position throughout the parsing process. Where Parabix1 differs from the traditional parser is that it scans for key markup characters using a series of basis bitstreams.
    41 A bitstream is simply a sequence of $0$s and $1$s, where there is one such bit in the bitstream for each character in a source data stream. A basis bitstream is a bitstream that consists of only transposed textual XML data.
    42 In other words, a source character consisting of $M$ bits can be represented with $M$ bitstreams and
     40Parabix1 processes source XML in a functionally equivalent manner as that of many traditional recursive descent XML parsers. That is, Parabix1 moves sequentially through the source document, maintaining a single cursor position throughout the parsing process, and parsers recursively, depth first. Where Parabix1 differs from the traditional parser is that it scans for key markup characters using a series of basis bit streams.
     41A bit stream is simply a sequence of $0$s and $1$s, where there is one such bit in the bit stream for each character in a source data stream. A basis bit stream is a bit stream that consists of only transposed textual XML data.
     42In other words, a source character consisting of $M$ bits can be represented with $M$ bit streams and
    4343by utilizing $M$ SIMD registers of width $W$, it is possible to scan through $W$ characters in parallel.
    4444The register width $W$ varies between 64-bit for MMX, 128-bit for SSE, and 256-bit for AVX.
    45 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.
     45Figure \ref{fig:BitstreamsExample} presents an example of the basis bit stream representation of 8-bit ASCII characters. $B_0 \ldots B_7$ are the individual bit streams. The $0$ bits in the bit streams are represented by periods to emphasize the $1$ bits.
    4646
    4747\begin{figure}[h]
     
    5959\end{tabular}
    6060\end{center}
    61 \caption{Parallel Bitstream Example}
     61\caption{Example 8-bit ASCII Character Basis Bit Streams}
    6262\label{fig:BitstreamsExample}
    6363\end{figure}
    6464
    65 In order to 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.
    66 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 {\em bit scan} 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 start tag validation. Starts tags begin with `<' and end with either ``/>'' or ``>'' (depending whether the element tag is an empty element tag or not, respectively).
     65To transform byte-oriented character data to parallel bit stream representation, source data is first loaded into SIMD registered in sequential order. It is then converted to the transposed basis bit stream representation through a series of packs, shifts, and logical bitwise operations. Using the SIMD capabilities of current commodity processors, the transposition of source data to basis bit stream format incurs an amortized cost of approximately 1 cycle per byte \cite{CameronHerdyLin2008}.
     66
     67Throughout the XML parsing process we must identify significant XML characters. For example, the next opening angle bracket character `<'. For this purpose, we combine the basis bit streams using bitwise logic and compute character-class bit streams. Character-class streams mark the positions of characters as a single $1$-bit if present, $0$ otherwise. Each bit position in the computed bit stream is in one-to-one correspondence to the source data byte positions. 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 generated, single cycle built-in {\em bit scan} operations are used to locate the positions significant XML character throughout parsing.
     68
     69A common operation in XML parsing is XML start tag validation. Starts tags begin with `<' and end with either ``/>'' or ``>'' (depending whether the element tag is an empty element tag or not, respectively). Figure \ref{fig:Parabix1StarttagExample} demonstrates the concept of start tag validation as performed in Parabix1 using character-class streams together with the processor built-in bit scan operation. The first bit 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 bit 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 `>'. 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 in sequence until until all start tags are validated. Unlike traditional parsers, these sequential operations are accelerated significantly since the bit scan operation can skip up to $w$ positions, where $w$ is the processor word width in bits. 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, Herdy2008, Cameron2009}.
    6770
    6871\begin{figure}[h]
     
    8790\end{figure}
    8891
    89 Figure \ref{fig:Parabix1StarttagExample} demonstrates the concept of start tag validation as performed in Parabix1. 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 `>'. 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 in this manner until all start tags are validated.
    90 
    91 Unlike traditional parsers, these sequential operations are accelerated significantly since the bit-scan operation can skip up to $w$ positions, where $w$ is the processor word width in bits. 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, Herdy2008, Cameron2009}.
    92 
    9392\subsection{Parabix2}
    9493
    95 In Parabix2, we replaced the sequential single-cursor parsing using bit scan instructions with a parallel parsing method using bitstream addition.
     94In Parabix2, the sequential single-cursor parsing approach using bit scan instructions is replaced by a parallel parsing approach, using multiple cursors when possible, and bit stream addition operations to advance cursor positions.
    9695Unlike the single-cursor approach of Parabix1 (and conceptually of all sequential XML parsers),
    9796Parabix2 processes multiple cursors in parallel. For example, using the source data from
    98 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, see the technical report \cite{Cameron2010}.
     97Figure \ref{fig:Parabix1StarttagExample}, Figure \ref{fig:Parabix2StarttagExample} shows how Parabix2 identifies and advances each of the start tag bit streams. Unlike Parabix1, Parabix2 begins scanning by creating two character-class bit 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 bit stream. $M_0$ is 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 uses the bitwise AND operation of the negation of $N$ to find only the true end tags of $M_1$. Because an end tag may end on an `/' or '>', $scanto$ is called again to advance any cursor from `/' to `>'. For additional details, refer to the technical report \cite{Cameron2010}.
    9998
    10099
     
    114113\end{figure}
    115114
    116 In general, the set of bit positions in a marker bitstream may be considered to be the current parsing
    117 positions of multiple parses taking place in parallel throughout the source data stream.
    118 A further aspect of the parallel method is that conditional branch statements used to identify
    119 syntax error at each each parsing position are eliminated. Although we do not show it in the prior examples,
    120 error bitstreams can be used to identify any well-formedness errors found during the parsing process. Error positions are gathered and
    121 processed in as a final post processing step. Hence, Parabix2 offers additional parallelism over Parabix1 in the form of multiple cursor
    122 parsing as well as further reducing branch misprediction penalties.
     115In general, the set of bit positions in a bit stream may be considered to be the current parsing
     116positions of multiple parses taking place in parallel throughout the source data stream. Although it is not explicitly shown in these prior examples,
     117error bit streams can be used to identify any well-formedness errors found during the parsing process. Error positions are gathered and
     118processed in as a final post processing step. A further aspect of the parallel cursor method with bit stream addition is that the conditional branch statements used to identify
     119syntax error at each each parsing position are eliminated. Hence, Parabix2 offers additional parallelism over Parabix1 in the form of multiple cursor
     120parsing as well as further reducing branch misprediction penalties.
    123121
    124122
Note: See TracChangeset for help on using the changeset viewer.