# Changeset 4499 for docs

Ignore:
Timestamp:
Feb 11, 2015, 4:12:01 PM (4 years ago)
Message:

Cleaned up architecture discussion a bit more

Location:
docs/Working/icGrep
Files:
7 edited

Unmodified
Removed
• ## docs/Working/icGrep/architecture.tex

 r4493 As shown in Figure \ref{fig:compiler}, \icGrep{} comprises three logical layers: \RegularExpression{}, \Pablo{} and the LLVM layer, each with their own intermediate representation compilation in \icGrep{} comprises three logical layers: \RegularExpression{}, \Pablo{} and the LLVM layer, each with their own intermediate representation (IR), transformation and compilation modules. % As we traverse the layers, the IR becomes significantly more complex as it begins to mirror the final machine code. As we traverse the layers, the IR becomes more complex as it begins to mirror the final machine code. % The \REParser{} validates and transforms the input \RegularExpression{} into an abstract syntax tree (AST). The layering enables further optimization based on information available at each stage. % The initial \REParser{} validates and transforms the input \RegularExpression{} into an abstract syntax tree (AST). % %The AST is a minimalistic representation that, unlike traditional \RegularExpression{}, is not converted into a NFA or DFA for further processing. %Instead, \icGrep{} passes the AST into the transformation module, which includes a set of \RegularExpression{} specific optimization passes. % The initial \emph{Nullable} pass, determines whether the \RegularExpression{} contains any prefixes or suffixes that may be removed or modified whilst still providing the same number of matches as the original expression. Successive \RegularExpression{} Transformations exploit knowledge domain knowledge to optimize the regular expressions. % An initial \emph{Nullable} pass, determines whether the \RegularExpression{} contains prefixes or suffixes that may be removed or modified whilst matching the same lines of text as the original expression. % For example, \verb|a*bc+|'' is equivalent to \verb|bc|'' because the Kleene Star (Plus) operator matches zero (one) or more instances of a specific character. % The \emph{toUTF8} pass converts the Unicode character classes in the input \RegularExpression{} into the equivalent expression(s) that represent the sequences of 8-bit code units necessary to identify occurrences of the class. % The aforementioned \texttt{toUTF8} transformation also applies during this phase to generate code unit classes. %The \emph{toUTF8} pass converts the Unicode character classes in the input \RegularExpression{} into equivalent expression(s) that represent sequences %of 8-bit code units necessary to identify occurrences of the class. % %Since some characters have multiple logically equivalent representations, such as \textcolor{red}{\textbf{????}}, this may produce nested sequences or alternations. The \RegularExpression{} layer has two compilers: the \CodeUnitCompiler{} and \RegularExpressionCompiler{}, both of which produce \Pablo{} IR. The next layer transforms this AST into the instructions in the \Pablo{} IR. % %has two compilers: the \CodeUnitCompiler{} and \RegularExpressionCompiler{}, both of which produce \Pablo{} IR. % Recall that the \Pablo{} layer assumes a transposed view of the input data. % The \emph{\CodeUnitCompiler{}} transforms the input code unit classes, either extracted from the \RegularExpression{} or produced by the \emph{toUTF8} transformation, into a series of bit stream equations. The \emph{\RegularExpressionCompiler{}} first transforms all input code unit classes, analogous to non-Unicode character classes, into a series of equations over these transposed bitstreams. It next transforms the AST into \Pablo{} instructions that use the results of these equations. For instance, it converts alternations into a sequence of calculations that are merged with \verb|OR|s. The results of these passes are combined and transformed through typical optimization passes including dead code elimination (DCE), common subexpression elimination (CSE) and constant folding. These optimizations exploit redundancies that are harder to recognize in the \RegularExpression{} AST itself. % The \emph{\RegularExpressionCompiler{}} assumes that these have been calculated and transforms the \RegularExpression{} AST into a sequence of instructions. %The \emph{\CodeUnitCompiler{}} transforms the input code unit classes, %either extracted from the \RegularExpression{} or produced by the \emph{toUTF8} transformation, %into a series of bit stream equations. % For instance, it would convert any alternations into a sequence of calculations that are merged with \verb|OR|s. %The \emph{\RegularExpressionCompiler{}} %assumes that these have been calculated and %transforms the \RegularExpression{} AST into %a sequence of instructions. %\Pablo{} instructions that use the results of these equations. % The results of these passes are combined and transformed through a series of typical optimization passes, including dead code elimination (DCE), common subexpression elimination (CSE), and constant folding. %For instance, it converts alternations into a sequence of calculations that are merged with \verb|OR|s. % These are necessary at this stage because the \RegularExpression{} AST may include common subsequences that are costly to recognize in that form. %The results of these passes are combined and transformed through a series of typical optimization passes, including dead code elimination %(DCE), common subexpression elimination (CSE), and constant folding. % Similarly, to keep the \CodeUnitCompiler{} a linear time function, it may introduce redundant IR instructions as it applies traditional Boolean algebra transformations, such as de Morgan's law, to the computed streams. %These optimizations exploit redundancies that are harder to recognize in the \RegularExpression{} AST itself. %These are necessary at this stage because the \RegularExpression{} AST may include common subsequences that are costly to recognize in %that form. % %Similarly, to keep the \CodeUnitCompiler{} a linear time function, it may introduce redundant IR instructions as it applies traditional Boolean %algebra transformations, such as de Morgan's law, to the computed streams. % An intended side-effect of these passes is that they eliminate the need to analyze the data-dependencies inherent in the carry-bit logic, which is necessary for some \Pablo{} instructions but problematic for optimizers to reason about non-conservatively. %An intended side-effect of these passes is that they eliminate the need to analyze the data-dependencies inherent in the carry-bit logic, %which is necessary for some \Pablo{} instructions but problematic for optimizers to reason about non-conservatively. % The \PabloCompiler{} then converts the \Pablo{} IR into LLVM IR. The \PabloCompiler{} then directly converts the \Pablo{} IR into LLVM IR. % This is a relatively straightforward conversion: %This is a relatively straightforward conversion: % the only complexities it introduces is the generation of Phi nodes, linking of statically-compiled functions, and assignment of carry variables. %the only complexities it introduces is the generation of Phi nodes, linking of statically-compiled functions, and assignment of carry variables. % It produces the dynamically-generated match function used by the \icGrep{}. The LLVM Compiler framework provides flexible APIs for compilation and linking. Using these, \icGrep{} dynamically generates a match function for identifying occurrences of the \RegularExpression{}. \paragraph{Dynamic Grep Engine.} Transposition and the Required Streams Generator can be performed in a separate thread which can start even before the dynamic compilation starts. The output of Transposition and the Required Streams Generator, that is the 8 basis bits streams and the required streams, are stored in a shared memory buffer for susequent processing by the Dynamic Matcher once compilation is complete. are stored in a shared memory buffer for subsequent processing by the Dynamic Matcher once compilation is complete. A single thread performs both compilation and matching using the computed basis and required streams. To avoid L2 cache contention, we allocate only a limited amount of space for the shared data in a circular buffer. The performance is dependent on the slowest thread. In the case that the cost of transposition and required stream generation is more than the matching process, we can further divide up the work and assign two threads for Transposition and Required Streams Generator. we can further divide up the work and assign two threads for Transposition and the Required Streams Generator.
• ## docs/Working/icGrep/evaluation.tex

 r4498 For example, the option {\tt -print-REs} show the parsed regular expression as it goes through various transformations.   The internal Pablo code generated may be displayed with {\tt -print-pablo}.  This can be quite useful in through various transformations.   The internal \Pablo{} code generated may be displayed with {\tt -print-\Pablo{}}.  This can be quite useful in helping understand the match process.   It also possible to print out the generated LLVM IR code ({\tt -dump-generated-IR}), but this may be
• ## docs/Working/icGrep/fig-compiler.tex

 r4476 \node [block, below of=RE] (REParser) {\REParser{}}; \node [block, below of=REParser] (RETransform) {\RegularExpression{} Transformations}; \coordinate[below of=RETransform, node distance=3em] (Point); \node [block, left of=Point, node distance=10em] (CUCompiler) {\CodeUnitCompiler{}}; \node [block, right of=Point, node distance=10em] (RECompiler) {\RegularExpressionCompiler{}}; \node [block, below of=Point, node distance=3em] (PabloTransform) {\Pablo{} Transformations}; %    \coordinate[below of=RETransform, node distance=3em] (Point); %    \node [block, left of=Point, node distance=10em] (CUCompiler) {\CodeUnitCompiler{}}; %    \node [block, right of=Point, node distance=10em] (RECompiler) {\RegularExpressionCompiler{}}; \node [block, below of=RETransform] (RECompiler) {\RegularExpressionCompiler{}}; \node [block, below of=RECompiler] (PabloTransform) {\Pablo{} Transformations}; \node [block, below of=PabloTransform] (PabloCompiler) {\PabloCompiler{}}; \node [block, below of=PabloCompiler] (LLVMCompiler) {LLVM Compiler}; %\path [line] (RE) -- (PropertyExtraction); \path [line] (REParser) -- (RETransform); \path [line] (RETransform) -| (CUCompiler); \path [line] (RETransform) -| (RECompiler); \path [line] (CUCompiler) |- (PabloTransform); \path [line] (RECompiler) |- (PabloTransform); %    \path [line] (RETransform) -| (CUCompiler); %    \path [line] (RETransform) -| (RECompiler); %    \path [line] (CUCompiler) |- (PabloTransform); %   \path [line] (RECompiler) |- (PabloTransform); \path [line] (RETransform) -- (RECompiler); \path [line] (RECompiler) -- (PabloTransform); \path [line] (PabloTransform) -- (PabloCompiler); \path [line] (PabloCompiler) -- (LLVMCompiler); \path [separator] (REParser) -- (SR); \coordinate[left of=Point, node distance=15em] (PL); \coordinate[right of=Point, node distance=15em] (PR); \coordinate[left of=RECompiler, node distance=15em] (PL); \coordinate[right of=RECompiler, node distance=15em] (PR); \path [separator] (PL) -- (RECompiler); \path [separator] (RECompiler) -- (PR); %\path [separator] (PL) -- (CUCompiler); \path [separator] (CUCompiler) -- (RECompiler); %    \path [separator] (CUCompiler) -- (RECompiler); %\path [separator] (RECompiler) -- (PR); % Seperator text \node [draw=none,anchor=west] at ($(SL)!0.5!(PL)$) {1)~\RegularExpression{}}; \node [draw=none,anchor=west] at ($(SL)!0.5!(PL)$) {1)~\RegularExpression{} AST}; \node [draw=none,anchor=west] at ($(PL)!0.5!(LL)$) {2)~\Pablo{}}; \node [draw=none,anchor=west] at ($(LL)!0.5!(OL)$) {3)~LLVM}; \end{center} \caption{icGrep Architectural Diagram}\label{fig:compiler} \caption{icGrep compilation architecture}\label{fig:compiler} \end{figure}
• ## docs/Working/icGrep/fig-executor.tex

 r4498 \end{center} \caption{icGrep Execution Diagram} \label{fig:execution} \caption{Data flow in an icGrep execution} \label{fig:execution} \end{figure}
• ## docs/Working/icGrep/icgrep.tex

 r4498 \def\RegularExpression{RegEx} \def\Pablo{Pablo} \def\Pablo{Parabix} \def\CodeUnit{Code Unit} \def\REParser{\RegularExpression{} Parser}
• ## docs/Working/icGrep/unicode-re.tex

 r4495 over UTF-8 data streams is to translate Unicode regular expressions over codepoints to corresponding regular expressions over sequences of UTF-8 bytes.   The {\tt toUTF8} transformation sequences of UTF-8 bytes or \emph{code units}.   The {\tt toUTF8} transformation performs this as a regular expression transformation, transforming input expressions such as \verb:\u{244}[\u{2030}-\u{2137}]:
Note: See TracChangeset for help on using the changeset viewer.