source: docs/Balisage13/Bal2013came0601/Bal2013came0601.html @ 3394

Last change on this file since 3394 was 3394, checked in by cameron, 6 years ago

Previous updates

File size: 101.3 KB
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
2<html lang="en">
4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
6<link rel="stylesheet" href="balisage-proceedings.css" type="text/css">
7<meta name="keywords" content="">
10<div id="balisage-header"><h1 style="text-align: right; font-family: serif; margin:0.25em">
11<i>Balisage:</i> <small>The Markup Conference</small>
13<html lang="en">
16<link rel="stylesheet" href="balisage-proceedings.css" type="text/css">
17<meta name="generator" content="Balisage Conference Proceedings XSLT (v1.2)">
18<script type="text/javascript">
19    function toggle(folderID) {
20      folder = document.getElementById("folder-"+folderID);
21      icon = document.getElementById("icon-"+folderID)
22      // need to:
23      //   switch between 'none' and 'block'
24      //   switch between collapse and expand icons
25      if ( != "block") {
26 = "block";
27        icon.src = "minus.png" ;
28        icon.alt = "collapse" ;
29      }
30      else {
31 = "none";
32        icon.src = "plus.png" ;
33        icon.alt = "expand" ;
34      };
35      return;
36    }
38   function hidecite(citeID) {
39     cite = document.getElementById(citeID);
40 = "none";
41     return;
42   }
44   function showcite(citeID,anchorID) {
45     cite = document.getElementById(citeID);
47     citeLeft =;
48     citeTop =;
50     if (citeLeft != (getLeft(anchorID)+"px") ||
51         citeTop != (getTop(anchorID)+"px")) {
52 = "none";
53     }
55     if ( != "table-cell") {
56        movebox(citeID, anchorID);
57 = "table-cell";
58     }
59     else {
60 = "none";
61     };
62     return;
63   }
65   function movebox(citeID, anchorID) {
67     cite = document.getElementById(citeID);
69     // alert(cite.offsetWidth + " by " + cite.offsetHeight)
71     horizontalOffset = getLeft(anchorID);
72     // horizontalOffset = (inMain(anchorID)) ?
73     // (horizontalOffset - 260) : (horizontalOffset + 20)
74     // (horizontalOffset - (20 + cite.offsetWidth)) : (horizontalOffset + 20)
76     verticalOffset = getTop(anchorID);
77     // verticalOffset = (inMain(anchorID)) ?
78     // (verticalOffset - 20) : (verticalOffset + 20)
79     // (verticalOffset - (20 + cite.offsetHeight)) : (verticalOffset + 20)
81     /*
82     horizontalOffset = getAbsoluteLeft(anchorID) - getScrollLeft(anchorID) + 20;
83     if (inMain(anchorID)) {
84       horizontalOffset = horizontalOffset - 300;
85     }
86     verticalOffset = getAbsoluteTop(anchorID) - getScrollTop(anchorID) - 40;
87     if (inMain(anchorID)) {
88       verticalOffset = verticalOffset - 300;
89     }
90     */
92 = horizontalOffset + "px";
93 = verticalOffset + "px";
94   }
96   function getLeft(objectID) {
97     var left = getAbsoluteLeft(objectID) - getScrollLeft(objectID);
98     left = (inMain(objectID)) ? (left - 260) : (left + 20)   
99     return left;
100   }
102   function getTop(objectID) {
103     var top = getAbsoluteTop(objectID) - getScrollTop(objectID);
104     top = (inMain(objectID)) ? (top - 50) : (top + 20)
105     return top;     
106   }
108   function getAbsoluteLeft(objectId) {
109   // Get an object left position from the upper left viewport corner
110     o = document.getElementById(objectId)
111     oLeft = o.offsetLeft            // Get left position from the parent object
112     while(o.offsetParent!=null) {   // Parse the parent hierarchy up to the document element
113       oParent = o.offsetParent    // Get parent object reference
114       oLeft += oParent.offsetLeft // Add parent left position
115       o = oParent
116      }
117    return oLeft
118    }
120    function getAbsoluteTop(objectId) {
121    // Get an object top position from the upper left viewport corner
122      o = document.getElementById(objectId)
123      oTop = o.offsetTop            // Get top position from the parent object
124      while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element
125        oParent = o.offsetParent  // Get parent object reference
126        oTop += oParent.offsetTop // Add parent top position
127        o = oParent
128      }
129    return oTop
130    }
132   function getScrollLeft(objectId) {
133     // Get a left scroll position
134     o = document.getElementById(objectId)
135     oLeft = o.scrollLeft            // Get left position from the parent object
136     while(o.offsetParent!=null) {   // Parse the parent hierarchy up to the document element
137       oParent = o.offsetParent    // Get parent object reference
138       oLeft += oParent.scrollLeft // Add parent left position
139       o = oParent
140      }
141    return oLeft
142    }
144    function getScrollTop(objectId) {
145    // Get a right scroll position
146      o = document.getElementById(objectId)
147      oTop = o.scrollTop            // Get top position from the parent object
148      while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element
149        oParent = o.offsetParent  // Get parent object reference
150        oTop += oParent.scrollTop // Add parent top position
151        o = oParent
152      }
153    return oTop
154    }
156    function inMain(objectId) {
157    // returns true if in div#main
158      o = document.getElementById(objectId)
159      while(o.parentNode != null) { // Parse the parent hierarchy up to div#main
160        oParent = o.parentNode
161        if ( == "main") { return true; }
162        o = oParent;
163      }
164    return false;
165    }
168   /*
169   function showcite(citeID) {
170      cite = document.getElementById(citeID);
171      if ( != "table-cell") {
172 = "table-cell";
173      }
174      else {
175 = "none";
176      };
177      return;
178    }
179    */
181      </script>
184<div class="inline-citation" id="cite-CameronHerdyLin2008" style="display:none;width: 240px">
185<a class="quiet" href="javascript:hidecite('cite-CameronHerdyLin2008')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">Cameron, Robert D., Herdy, Kenneth S. and Lin, Dan. High performance XML parsing using parallel bit stream technology. CASCON'08: Proc. 2008 conference of the center for advanced studies on collaborative research. 2008 New York, NY, USA</p>
187<div class="inline-citation" id="cite-papi" style="display:none;width: 240px">
188<a class="quiet" href="javascript:hidecite('cite-papi')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">Innovative Computing Laboratory, University of Texas. Performance Application Programming Interface.<a href="" class="link" target="_new"></a></p>
190<div class="inline-citation" id="cite-perf" style="display:none;width: 240px">
191<a class="quiet" href="javascript:hidecite('cite-perf')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">Eranian, Stephane, Gouriou, Eric, Moseley, Tipp and Bruijn, Willem de. Linux kernel profiling with perf.<a href="" class="link" target="_new"></a></p>
193<div class="inline-citation" id="cite-Cameron2008" style="display:none;width: 240px">
194<a class="quiet" href="javascript:hidecite('cite-Cameron2008')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">Cameron, Robert D.. A case study in SIMD text processing with parallel bit streams: UTF-8 to UTF-16 transcoding. Proc. 13th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming. 2008 New York, NY, USA</p>
196<div class="inline-citation" id="cite-ParaDOM2009" style="display:none;width: 240px">
197<a class="quiet" href="javascript:hidecite('cite-ParaDOM2009')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">Shah, Bhavik, Rao, Praveen, Moon, Bongki and Rajagopalan, Mohan. A Data Parallel Algorithm for XML DOM Parsing. Database and XML Technologies. 2009</p>
199<div class="inline-citation" id="cite-XMLSSE42" style="display:none;width: 240px">
200<a class="quiet" href="javascript:hidecite('cite-XMLSSE42')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">Lei, Zhai. XML Parsing Accelerator with Intel Streaming SIMD Extensions 4 (Intel SSE4). 2008<a href="Intel%20Software%20Network" class="link" target="_new">Intel Software Network</a></p>
202<div class="inline-citation" id="cite-Cameron2009" style="display:none;width: 240px">
203<a class="quiet" href="javascript:hidecite('cite-Cameron2009')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">Cameron, Rob, Herdy, Ken and Amiri, Ehsan Amiri. Parallel Bit Stream Technology as a Foundation for XML Parsing Performance. Int'l Symposium on Processing XML Efficiently: Overcoming Limits on Space, Time, or Bandwidth. 2009</p>
205<div class="inline-citation" id="cite-HilewitzLee2006" style="display:none;width: 240px">
206<a class="quiet" href="javascript:hidecite('cite-HilewitzLee2006')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">Hilewitz, Yedidya and Lee, Ruby B.. Fast Bit Compression and Expansion with Parallel Extract and Parallel Deposit Instructions. ASAP '06: Proc. IEEE 17th Int'l Conference on Application-specific Systems, Architectures and Processors. 2006 Washington, DC, USA</p>
208<div class="inline-citation" id="cite-Asanovic-EECS-2006-183" style="display:none;width: 240px">
209<a class="quiet" href="javascript:hidecite('cite-Asanovic-EECS-2006-183')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">Asanovic, Krste and others. The Landscape of Parallel Computing Research: A View from Berkeley. 2006</p>
211<div class="inline-citation" id="cite-GRID2006" style="display:none;width: 240px">
212<a class="quiet" href="javascript:hidecite('cite-GRID2006')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">Lu, Wei, Chiu, Kenneth and Pan, Yinfei. A Parallel Approach to XML Parsing. Proceedings of the 7th IEEE/ACM International Conference on Grid Computing. 2006 Washington, DC, USA</p>
214<div class="inline-citation" id="cite-cameron-EuroPar2011" style="display:none;width: 240px">
215<a class="quiet" href="javascript:hidecite('cite-cameron-EuroPar2011')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">Cameron, Robert D., Amiri, Ehsan, Herdy, Kenneth S., Lin, Dan, Shermer, Thomas C. and Popowich, Fred P.. Parallel Scanning with Bitstream Addition: An XML Case Study. Euro-Par 2011, LNCS 6853, Part II. 2011 Berlin, Heidelberg</p>
217<div class="inline-citation" id="cite-HPCA2012" style="display:none;width: 240px">
218<a class="quiet" href="javascript:hidecite('cite-HPCA2012')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">Lin, Dan, Medforth, Nigel, Herdy, Kenneth S., Shriraman, Arrvindh and Cameron, Rob. Parabix: Boosting the efficiency of text processing on commodity processors. International Symposium on High-Performance Computer Architecture. 2012 Los Alamitos, CA, USA</p>
220<div class="inline-citation" id="cite-HPCC2011" style="display:none;width: 240px">
221<a class="quiet" href="javascript:hidecite('cite-HPCC2011')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">You, Cheng-Han and Wang, Sheng-De. A Data Parallel Approach to XML Parsing and Query. 10th IEEE International Conference on High Performance Computing and Communications. 2011 Los Alamitos, CA, USA</p>
223<div class="inline-citation" id="cite-E-SCIENCE2007" style="display:none;width: 240px">
224<a class="quiet" href="javascript:hidecite('cite-E-SCIENCE2007')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">Pan, Yinfei, Zhang, Ying, Chiu, Kenneth and Lu, Wei. Parallel XML Parsing Using Meta-DFAs. International Conference on e-Science and Grid Computing. 2007 Los Alamitos, CA, USA</p>
226<div class="inline-citation" id="cite-ICWS2008" style="display:none;width: 240px">
227<a class="quiet" href="javascript:hidecite('cite-ICWS2008')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">Pan, Yinfei, Zhang, Ying and Chiu, Kenneth. Hybrid Parallelism for XML SAX Parsing. IEEE International Conference on Web Services. 2008 Los Alamitos, CA, USA</p>
229<div class="inline-citation" id="cite-IPDPS2008" style="display:none;width: 240px">
230<a class="quiet" href="javascript:hidecite('cite-IPDPS2008')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">Pan, Yinfei, Zhang, Ying and Chiu, Kenneth. Simultaneous transducers for data-parallel XML parsing. International Parallel and Distributed Processing Symposium. 2008 Los Alamitos, CA, USA</p>
232<div class="inline-citation" id="cite-HackersDelight" style="display:none;width: 240px">
233<a class="quiet" href="javascript:hidecite('cite-HackersDelight')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">Warren, Henry S.. Hacker's Delight. 2002</p>
235<div class="inline-citation" id="cite-lu2007advances" style="display:none;width: 240px">
236<a class="quiet" href="javascript:hidecite('cite-lu2007advances')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">Lu, C.T., Dos Santos, R.F., Sripada, L.N. and Kou, Y.. Advances in GML for geospatial applications. 2007</p>
238<div class="inline-citation" id="cite-lake2004geography" style="display:none;width: 240px">
239<a class="quiet" href="javascript:hidecite('cite-lake2004geography')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">Lake, R., Burggraf, D.S., Trninic, M. and Rae, L.. Geography mark-up language (GML) [foundation for the geo-web]. 2004</p>
241<div id="mast"><div class="content">
242<h2 class="article-title" id="idp77056"></h2>
243<div class="author">
244<h3 class="author">Nigel Medforth</h3>
245<div class="affiliation">
246<p class="jobtitle">Developer</p>
247<p class="orgname">International Characters Inc.</p>
249<div class="affiliation">
250<p class="jobtitle">Graduate Student</p>
251<p class="orgname">School of Computing Science, Simon Fraser University </p>
253<h5 class="author-email"><code class="email">&lt;<a class="email" href=""></a>&gt;</code></h5>
255<div class="author">
256<h3 class="author">Dan Lin</h3>
257<div class="affiliation">
258<p class="jobtitle">Graduate Student</p>
259<p class="orgname">School of Computing Science, Simon Fraser University </p>
261<h5 class="author-email"><code class="email">&lt;<a class="email" href=""></a>&gt;</code></h5>
263<div class="author">
264<h3 class="author">Kenneth Herdy</h3>
265<div class="affiliation">
266<p class="jobtitle">Graduate Student</p>
267<p class="orgname">School of Computing Science, Simon Fraser University </p>
269<h5 class="author-email"><code class="email">&lt;<a class="email" href=""></a>&gt;</code></h5>
271<div class="author">
272<h3 class="author">Rob Cameron</h3>
273<div class="affiliation">
274<p class="jobtitle">Professor of Computing Science</p>
275<p class="orgname">Simon Fraser University</p>
277<div class="affiliation">
278<p class="jobtitle">Chief Technology Officer</p>
279<p class="orgname">International Characters, Inc.</p>
281<h5 class="author-email"><code class="email">&lt;<a class="email" href=""></a>&gt;</code></h5>
283<div class="author">
284<h3 class="author">Arrvindh Shriraman</h3>
285<div class="affiliation">
286<p class="jobtitle">Assistant Professor</p>
287<p class="orgname">School of Computing Science, Simon Fraser University</p>
289<h5 class="author-email"><code class="email">&lt;<a class="email" href=""></a>&gt;</code></h5>
291<div class="mast-box">
292<p class="title"><a href="javascript:toggle('idp77616')" class="quiet"><img class="toc-icon" src="plus.png" alt="expand" id="icon-idp77616"></a> <span onclick="javascript:toggle('idp77616');return true">Abstract</span></p>
293<div class="folder" id="folder-idp77616" style="display:none"><p id="idp77920">Prior research on the acceleration of XML processing using SIMD and multi-core
294            parallelism has lead to a number of interesting research prototypes. This work
295            investigates the extent to which the techniques underlying these prototypes could result
296            in systematic performance benefits when fully integrated into a commercial XML parser.
297            The widely used Xerces-C++ parser of the Apache Software Foundation was chosen as the
298            foundation for the study. A systematic restructuring of the parser was undertaken, while
299            maintaining the existing API for application programmers. Using SIMD techniques alone,
300            an increase in parsing speed of at least 50% was observed in a range of applications.
301            When coupled with pipeline parallelism on dual core processors, improvements of 2x and
302            beyond were realized. </p></div>
304<div class="toc">
305<p><b>Table of Contents</b></p>
307<dt><span class="section"><a href="#idp285392" class="toc">Introduction</a></span></dt>
308<dt><span class="section"><a href="#background" class="toc">Background</a></span></dt>
310<dt><span class="section"><a href="#background-xerces" class="toc">Xerces C++ Structure</a></span></dt>
311<dt><span class="section"><a href="#idp359776" class="toc">The Parabix Framework</a></span></dt>
312<dt><span class="section"><a href="#idp454528" class="toc">Sequential vs. Parallel Paradigm</a></span></dt>
314<dt><span class="section"><a href="#architecture" class="toc">Architecture</a></span></dt>
316<dt><span class="section"><a href="#idp462208" class="toc">Overview</a></span></dt>
317<dt><span class="section"><a href="#character-set-adapter" class="toc">Character Set Adapters</a></span></dt>
318<dt><span class="section"><a href="#par-filter" class="toc">Combined Parallel Filtering</a></span></dt>
319<dt><span class="section"><a href="#contentstream" class="toc">Content Stream</a></span></dt>
320<dt><span class="section"><a href="#namespace-handling" class="toc">Namespace Handling</a></span></dt>
321<dt><span class="section"><a href="#errorhandling" class="toc">Error Handling</a></span></dt>
323<dt><span class="section"><a href="#multithread" class="toc">Multithreading with Pipeline Parallelism</a></span></dt>
324<dt><span class="section"><a href="#performance" class="toc">Performance</a></span></dt>
326<dt><span class="section"><a href="#idp625760" class="toc">Xerces C++ SAXCount</a></span></dt>
327<dt><span class="section"><a href="#idp652080" class="toc">GML2SVG</a></span></dt>
329<dt><span class="section"><a href="#conclusion" class="toc">Conclusion and Future Work</a></span></dt>
332<div class="mast-box">
333<p class="title"><a href="javascript:toggle('idp79344')" class="linkbox"><img class="toc-icon" src="plus.png" alt="expand" id="icon-idp79344"></a> <span onclick="javascript:toggle('idp79344');return true">Nigel Medforth</span></p>
334<div class="folder" id="folder-idp79344" style="display:none">
335<h5 class="author-email"><code class="email">&lt;<a class="email" href=""></a>&gt;</code></h5>
336<div class="affiliation">
337<p class="jobtitle">Developer</p>
338<p class="orgname">International Characters Inc.</p>
340<div class="affiliation">
341<p class="jobtitle">Graduate Student</p>
342<p class="orgname">School of Computing Science, Simon Fraser University </p>
344<div class="personblurb">
345<p id="idp61664">Nigel Medforth is a M.Sc. student at Simon Fraser University and the lead
346               developer of icXML. He earned a Bachelor of Technology in Information Technology at
347               Kwantlen Polytechnic University in 2009 and was awarded the Dean’s Medal for
348               Outstanding Achievement.</p>
349<p id="idp62672">Nigel is currently researching ways to leverage both the Parabix framework and
350               stream-processing models to further accelerate XML parsing within icXML.</p>
354<div class="mast-box">
355<p class="title"><a href="javascript:toggle('idp66272')" class="linkbox"><img class="toc-icon" src="plus.png" alt="expand" id="icon-idp66272"></a> <span onclick="javascript:toggle('idp66272');return true">Dan Lin</span></p>
356<div class="folder" id="folder-idp66272" style="display:none">
357<h5 class="author-email"><code class="email">&lt;<a class="email" href=""></a>&gt;</code></h5>
358<div class="affiliation">
359<p class="jobtitle">Graduate Student</p>
360<p class="orgname">School of Computing Science, Simon Fraser University </p>
362<div class="personblurb"><p id="idp67984">Dan Lin is a Ph.D student at Simon Fraser University. She earned a Master of Science
363             in Computing Science at Simon Fraser University in 2010. Her research focus on on high
364             performance algorithms that exploit parallelization strategies on various multicore platforms.
365           </p></div>
368<div class="mast-box">
369<p class="title"><a href="javascript:toggle('idp70528')" class="linkbox"><img class="toc-icon" src="plus.png" alt="expand" id="icon-idp70528"></a> <span onclick="javascript:toggle('idp70528');return true">Kenneth Herdy</span></p>
370<div class="folder" id="folder-idp70528" style="display:none">
371<h5 class="author-email"><code class="email">&lt;<a class="email" href=""></a>&gt;</code></h5>
372<div class="affiliation">
373<p class="jobtitle">Graduate Student</p>
374<p class="orgname">School of Computing Science, Simon Fraser University </p>
376<div class="personblurb">
377<p id="idp72256"> Ken Herdy completed an Advanced Diploma of Technology in Geographical Information
378               Systems at the British Columbia Institute of Technology in 2003 and earned a Bachelor
379               of Science in Computing Science with a Certificate in Spatial Information Systems at
380               Simon Fraser University in 2005. </p>
381<p id="idp72640"> Ken is currently pursuing PhD studies in Computing Science at Simon Fraser
382               University with industrial scholarship support from the Natural Sciences and
383               Engineering Research Council of Canada, the Mathematics of Information Technology and
384               Complex Systems NCE, and the BC Innovation Council. His research focus is an analysis
385               of the principal techniques that may be used to improve XML processing performance in
386               the context of the Geography Markup Language (GML). </p>
390<div class="mast-box">
391<p class="title"><a href="javascript:toggle('idp274496')" class="linkbox"><img class="toc-icon" src="plus.png" alt="expand" id="icon-idp274496"></a> <span onclick="javascript:toggle('idp274496');return true">Rob Cameron</span></p>
392<div class="folder" id="folder-idp274496" style="display:none">
393<h5 class="author-email"><code class="email">&lt;<a class="email" href=""></a>&gt;</code></h5>
394<div class="affiliation">
395<p class="jobtitle">Professor of Computing Science</p>
396<p class="orgname">Simon Fraser University</p>
398<div class="affiliation">
399<p class="jobtitle">Chief Technology Officer</p>
400<p class="orgname">International Characters, Inc.</p>
402<div class="personblurb"><p id="idp276160">Dr. Rob Cameron is Professor of Computing Science and Associate Dean of Applied
403               Sciences at Simon Fraser University. His research interests include programming
404               language and software system technology, with a specific focus on high performance
405               text processing using SIMD and multicore parallelism. He is the developer of the REX
406               XML shallow parser as well as the parallel bit stream (Parabix) framework for SIMD
407               text processing. </p></div>
411<div id="navbar"></div>
412<div id="balisage-header" style="background-color: #6699CC">
413<a class="quiet" href=""><img style="float:right;border:none" alt="Balisage logo" height="130" src=""></a><h2 class="page-header">Balisage: The Markup Conference</h2>
414<h1 class="page-header">Proceedings preview</h1>
416<div id="main">
417<div class="article">
418<h2 class="article-title" id="idp77056"></h2>
419<div class="section" id="idp285392">
420<h2 class="title" style="clear: both">Introduction</h2>
421<p id="idp286032">   
422        Parallelization and acceleration of XML parsing is a widely
423        studied problem that has seen the development of a number
424        of interesting research prototypes using both SIMD and
425        multicore parallelism.   Most works have investigated
426        data parallel solutions on multicore
427        architectures using various strategies to break input
428        documents into segments that can be allocated to different cores.
429        For example, one possibility for data
430        parallelization is to add a pre-parsing step to compute
431        a skeleton tree structure of an  XML document <a class="xref" id="idp286848" href="javascript:showcite('cite-GRID2006','idp286848')">Lu and Chiu 2006</a>.
432        The parallelization of the pre-parsing stage itself can be tackled with
433          state machines <a class="xref" id="idp299760" href="javascript:showcite('cite-E-SCIENCE2007','idp299760')">Pan and Zhang 2007</a>, <a class="xref" id="idp300352" href="javascript:showcite('cite-IPDPS2008','idp300352')">Pan and Zhang 2008</a>.
434        Methods without pre-parsing have used speculation <a class="xref" id="idp301200" href="javascript:showcite('cite-HPCC2011','idp301200')">You and Wang 2011</a> or post-processing that
435        combines the partial results <a class="xref" id="idp302032" href="javascript:showcite('cite-ParaDOM2009','idp302032')">Shah and Rao 2009</a>.
436        A hybrid technique that combines data and pipeline parallelism was proposed to
437        hide the latency of a "job" that has to be done sequentially <a class="xref" id="idp302896" href="javascript:showcite('cite-ICWS2008','idp302896')">Pan and Zhang 2008</a>.
438      </p>
439<p id="idp303776">
440        Fewer efforts have investigated SIMD parallelism, although this approach
441        has the potential advantage of improving single core performance as well
442        as offering savings in energy consumption <a class="xref" id="idp304240" href="javascript:showcite('cite-HPCA2012','idp304240')">Lin and Medforth 2012</a>.
443        Intel introduced specialized SIMD string processing instructions in the SSE 4.2 instruction set extension
444        and showed how they can be used to improve the performance of XML parsing <a class="xref" id="idp305184" href="javascript:showcite('cite-XMLSSE42','idp305184')">Lei 2008</a>.
445        The Parabix framework uses generic SIMD extensions and bit parallel methods to
446        process hundreds of XML input characters simultaneously <a class="xref" id="idp306096" href="javascript:showcite('cite-Cameron2009','idp306096')">Cameron and Herdy 2009</a> <a class="xref" id="idp306848" href="javascript:showcite('cite-cameron-EuroPar2011','idp306848')">Cameron and Amiri 2011</a>.
447        Parabix prototypes have also combined SIMD methods with thread-level parallelism to
448        achieve further acceleration on multicore systems <a class="xref" id="idp307760" href="javascript:showcite('cite-HPCA2012','idp307760')">Lin and Medforth 2012</a>.
449      </p>
450<p id="idp308528">
451        In this paper, we move beyond research prototypes to consider
452        the detailed integration of both SIMD and multicore parallelism into the
453        Xerces-C++ parser of the Apache Software Foundation, an existing
454        standards-compliant open-source parser that is widely used
455        in commercial practice.    The challenge of this work is
456        to parallelize the Xerces parser in such a way as to
457        preserve the existing APIs as well as offering worthwhile
458        end-to-end acceleration of XML processing.   
459        To achieve the best results possible, we undertook
460        a nine-month comprehensive restructuring of the Xerces-C++ parser,
461        seeking to expose as many critical aspects of XML parsing
462        as possible for parallelization, the result of which we named icXML.   
463        Overall, we employed Parabix-style methods of transcoding, tokenization
464        and tag parsing, parallel string comparison methods in symbol
465        resolution, bit parallel methods in namespace processing,
466        as well as staged processing using pipeline parallelism to take advantage of
467        multiple cores.
468      </p>
469<p id="idp309968">
470        The remainder of this paper is organized as follows.   
471          <a class="xref" href="#background" title="Background">section “Background”</a> discusses the structure of the Xerces and Parabix XML parsers and the fundamental
472        differences between the two parsing models.   
473        <a class="xref" href="#architecture" title="Architecture">section “Architecture”</a> then presents the icXML design based on a restructured Xerces architecture to
474        incorporate SIMD parallelism using Parabix methods.   
475        <a class="xref" href="#multithread" title="Multithreading with Pipeline Parallelism">section “Multithreading with Pipeline Parallelism”</a> moves on to consider the multithreading of the icXML architecture
476        using the pipeline parallelism model. 
477        <a class="xref" href="#performance" title="Performance">section “Performance”</a> analyzes the performance of both the single-threaded and
478        multi-threaded versions of icXML in comparison to original Xerces,
479        demonstrating substantial end-to-end acceleration of
480        a GML-to-SVG translation application written against the Xerces API.
481          <a class="xref" href="#conclusion" title="Conclusion and Future Work">section “Conclusion and Future Work”</a> concludes the paper with a discussion of future work and the potential for
482        applying the techniques discussed herein in other application domains.
483      </p>
485<div class="section" id="background">
486<h2 class="title" style="clear: both">Background</h2>
487<div class="section" id="background-xerces">
488<h3 class="title" style="clear: both">Xerces C++ Structure</h3>
489<p id="idp317232"> The Xerces C++ parser is a widely-used standards-conformant
490            XML parser produced as open-source software
491             by the Apache Software Foundation.
492            It features comprehensive support for a variety of character encodings both
493            commonplace (e.g., UTF-8, UTF-16) and rarely used (e.g., EBCDIC), support for multiple
494            XML vocabularies through the XML namespace mechanism, as well as complete
495            implementations of structure and data validation through multiple grammars declared
496            using either legacy DTDs (document type definitions) or modern XML Schema facilities.
497            Xerces also supports several APIs for accessing parser services, including event-based
498            parsing using either pull parsing or SAX/SAX2 push-style parsing as well as a DOM
499            tree-based parsing interface. </p>
500<p id="idp318496">
501            Xerces,
502            like all traditional parsers, processes XML documents sequentially a byte-at-a-time from
503            the first to the last byte of input data. Each byte passes through several processing
504            layers and is classified and eventually validated within the context of the document
505            state. This introduces implicit dependencies between the various tasks within the
506            application that make it difficult to optimize for performance. As a complex software
507              system, no one feature dominates the overall parsing performance. <a class="xref" href="#xerces-profile">Table I</a>
508            shows the execution time profile of the top ten functions in a
509            typical run. Even if it were possible, Amdahl's Law dictates that tackling any one of
510            these functions for parallelization in isolation would only produce a minute improvement
511            in performance. Unfortunately, early investigation into these functions found that
512            incorporating speculation-free thread-level parallelization was impossible and they were
513            already performing well in their given tasks; thus only trivial enhancements were
514            attainable. In order to obtain a systematic acceleration of Xerces, it should be
515            expected that a comprehensive restructuring is required, involving all aspects of the
516            parser. </p>
517<div class="table-wrapper" id="xerces-profile">
518<p class="title">Table I</p>
519<div class="caption"><p id="idp13600">Execution Time of Top 10 Xerces Functions</p></div>
520<table class="table" xml:id="xerces-profile">
521<colgroup span="1">
522<col align="left" valign="top" span="1">
523<col align="left" valign="top" span="1">
526<th>Time (%) </th>
527<th> Function Name </th>
530<tr valign="top">
531<td>13.29       </td>
532<td>XMLUTF8Transcoder::transcodeFrom </td>
534<tr valign="top">
535<td>7.45        </td>
536<td>IGXMLScanner::scanCharData </td>
538<tr valign="top">
539<td>6.83        </td>
540<td>memcpy </td>
542<tr valign="top">
543<td>5.83        </td>
544<td>XMLReader::getNCName </td>
546<tr valign="top">
547<td>4.67        </td>
548<td>IGXMLScanner::buildAttList </td>
550<tr valign="top">
551<td>4.54        </td>
552<td>RefHashTableO&lt;&gt;::findBucketElem </td>
554<tr valign="top">
555<td>4.20        </td>
556<td>IGXMLScanner::scanStartTagNS </td>
558<tr valign="top">
559<td>3.75        </td>
560<td>ElemStack::mapPrefixToURI </td>
562<tr valign="top">
563<td>3.58        </td>
564<td>ReaderMgr::getNextChar </td>
566<tr valign="top">
567<td>3.20        </td>
568<td>IGXMLScanner::basicAttrValueScan </td>
574<div class="section" id="idp359776">
575<h3 class="title" style="clear: both">The Parabix Framework</h3>
576<p id="idp360416"> The Parabix (parallel bit stream) framework is a transformative approach to XML
577            parsing (and other forms of text processing.) The key idea is to exploit the
578            availability of wide SIMD registers (e.g., 128-bit) in commodity processors to represent
579            data from long blocks of input data by using one register bit per single input byte. To
580            facilitate this, the input data is first transposed into a set of basis bit streams.
581              For example, <a class="xref" href="#xml-bytes">Table II</a> shows  the ASCII bytes for the string "<code class="code">b7&lt;A</code>" with
582                the corresponding  8 basis bit streams, b<sub>0</sub> through  b<sub>7</sub> shown in  <a class="xref" href="#xml-bits">Table III</a>.
583            The bits used to construct b<sub>7</sub> have been highlighted in this example.
584              Boolean-logic operations (∧, \√ and ¬ denote the
585              boolean AND, OR and NOT operators) are used to classify the input bits into a set of
586               <span class="ital">character-class bit streams</span>, which identify key
587            characters (or groups of characters) with a <code class="code">1</code>. For example, one of the
588            fundamental characters in XML is a left-angle bracket. A character is an
589               <code class="code">'&lt;' if and only if
590               Â¬(b<sub>0</sub> âˆš b<sub>1</sub>)
591               âˆ§ (b<sub>2</sub> âˆ§ b<sub>3</sub>)
592               âˆ§ (b<sub>4</sub> âˆ§ b<sub>5</sub>)
593               âˆ§ ¬ (b<sub>6</sub> âˆš
594               b<sub>7</sub>) = 1</code>. Similarly, a character is numeric, <code class="code">[0-9]
595               if and only if ¬(b<sub>0</sub> âˆš
596               b<sub>1</sub>) ∧ (b<sub>2</sub> âˆ§
597                  b<sub>3</sub>) ∧ ¬(b<sub>4</sub>
598               âˆ§ (b<sub>5</sub> âˆš
599            b<sub>6</sub>))</code>. An important observation here is that ranges of
600            characters may require fewer operations than individual characters and
601             multiple
602            classes can share the classification cost. </p>
603<div class="table-wrapper" id="xml-bytes">
604<p class="title">Table II</p>
605<div class="caption"><p id="idp374112">XML Source Data</p></div>
606<table class="table" xml:id="xml-bytes">
607<colgroup span="1">
608<col align="right" valign="top" span="1">
609<col align="centre" valign="top" span="1">
610<col align="centre" valign="top" span="1">
611<col align="centre" valign="top" span="1">
612<col align="centre" valign="top" span="1">
616<td>String </td>
617<td> <code class="code">b</code> </td>
618<td> <code class="code">7</code> </td>
619<td> <code class="code">&lt;</code> </td>
620<td> <code class="code">A</code> </td>
623<td>ASCII </td>
624<td> <code class="code">0110001<span class="bold">0</span></code> </td>
625<td> <code class="code">0011011<span class="bold">1</span></code> </td>
626<td> <code class="code">0011110<span class="bold">0</span></code> </td>
627<td> <code class="code">0100000<span class="bold">1</span></code> </td>
632<div class="table-wrapper" id="xml-bits">
633<p class="title">Table III</p>
634<div class="caption"><p id="idp390384">8-bit ASCII Basis Bit Streams</p></div>
635<table class="table" xml:id="xml-bits">
636<colgroup span="1">
637<col align="centre" valign="top" span="1">
638<col align="centre" valign="top" span="1">
639<col align="centre" valign="top" span="1">
640<col align="centre" valign="top" span="1">
641<col align="centre" valign="top" span="1">
642<col align="centre" valign="top" span="1">
643<col align="centre" valign="top" span="1">
644<col align="centre" valign="top" span="1">
648<td> b<sub>0</sub> </td>
649<td> b<sub>1</sub> </td>
650<td> b<sub>2</sub> </td>
651<td> b<sub>3</sub>
653<td> b<sub>4</sub> </td>
654<td> b<sub>5</sub> </td>
655<td> b<sub>6</sub> </td>
656<td> b<sub>7</sub> </td>
659<td> <code class="code">0</code> </td>
660<td> <code class="code">1</code> </td>
661<td> <code class="code">1</code> </td>
662<td> <code class="code">0</code> </td>
663<td> <code class="code">0</code> </td>
664<td> <code class="code">0</code> </td>
665<td> <code class="code">1</code> </td>
666<td> <span class="bold"><code class="code">0</code></span> </td>
669<td> <code class="code">0</code> </td>
670<td> <code class="code">0</code> </td>
671<td> <code class="code">1</code> </td>
672<td> <code class="code">1</code> </td>
673<td> <code class="code">0</code> </td>
674<td> <code class="code">1</code> </td>
675<td> <code class="code">1</code> </td>
676<td> <span class="bold"><code class="code">1</code></span> </td>
679<td> <code class="code">0</code> </td>
680<td> <code class="code">0</code> </td>
681<td> <code class="code">1</code> </td>
682<td> <code class="code">1</code> </td>
683<td> <code class="code">1</code> </td>
684<td> <code class="code">1</code> </td>
685<td> <code class="code">0</code> </td>
686<td> <span class="bold"><code class="code">0</code></span> </td>
689<td> <code class="code">0</code> </td>
690<td> <code class="code">1</code> </td>
691<td> <code class="code">0</code> </td>
692<td> <code class="code">0</code> </td>
693<td> <code class="code">0</code> </td>
694<td> <code class="code">0</code> </td>
695<td> <code class="code">0</code> </td>
696<td> <span class="bold"><code class="code">1</code></span> </td>
701<p id="idp430512"> Consider, for example, the XML source data stream shown in the first line of <a class="xref" href="#derived">Table IV</a>.
702The remaining lines of this figure show
703            several parallel bit streams that are computed in Parabix-style parsing, with each bit
704            of each stream in one-to-one correspondence to the source character code units of the
705            input stream. For clarity, 1 bits are denoted with 1 in each stream and 0 bits are
706            represented as underscores. The first bit stream shown is that for the opening angle
707            brackets that represent tag openers in XML. The second and third streams show a
708            partition of the tag openers into start tag marks and end tag marks depending on the
709            character immediately following the opener (i.e., "<code class="code">/</code>") or
710            not. The remaining three lines show streams that can be computed in subsequent parsing
711            (using the technique of bitstream addition <a class="xref" id="idp433616" href="javascript:showcite('cite-cameron-EuroPar2011','idp433616')">Cameron and Amiri 2011</a>), namely streams
712            marking the element names, attribute names and attribute values of tags. </p>
713<div class="table-wrapper" id="derived">
714<p class="title">Table IV</p>
715<div class="caption"><p id="idp435328">XML Source Data and Derived Parallel Bit Streams</p></div>
716<table class="table" xml:id="derived">
717<colgroup span="1">
718<col align="centre" valign="top" span="1">
719<col align="left" valign="top" span="1">
723<td> Source Data </td>
724<td> <code class="code"> &lt;document&gt;fee&lt;element a1='fie' a2 = 'foe'&gt;&lt;/element&gt;fum&lt;/document&gt; </code>
728<td> Tag Openers </td>
729<td> <code class="code">1____________1____________________________1____________1__________</code>
733<td> Start Tag Marks </td>
734<td> <code class="code">_1____________1___________________________________________________</code>
738<td> End Tag Marks </td>
739<td> <code class="code">___________________________________________1____________1_________</code>
743<td> Empty Tag Marks </td>
744<td> <code class="code">__________________________________________________________________</code>
748<td> Element Names </td>
749<td> <code class="code">_11111111_____1111111_____________________________________________</code>
753<td> Attribute Names </td>
754<td> <code class="code">______________________11_______11_________________________________</code>
758<td> Attribute Values </td>
759<td> <code class="code">__________________________111________111__________________________</code>
765<p id="idp448432"> Two intuitions may help explain how the Parabix approach can lead to improved XML
766            parsing performance. The first is that the use of the full register width offers a
767            considerable information advantage over sequential byte-at-a-time parsing. That is,
768            sequential processing of bytes uses just 8 bits of each register, greatly limiting the
769            processor resources that are effectively being used at any one time. The second is that
770            byte-at-a-time loop scanning loops are actually often just computing a single bit of
771            information per iteration: is the scan complete yet? Rather than computing these
772            individual decision-bits, an approach that computes many of them in parallel (e.g., 128
773            bytes at a time using 128-bit registers) should provide substantial benefit. </p>
774<p id="idp449680"> Previous studies have shown that the Parabix approach improves many aspects of XML
775            processing, including transcoding <a class="xref" id="idp450080" href="javascript:showcite('cite-Cameron2008','idp450080')">Cameron 2008</a>, character classification and
776            validation, tag parsing and well-formedness checking. The first Parabix parser used
777            processor bit scan instructions to considerably accelerate sequential scanning loops for
778            individual characters <a class="xref" id="idp451088" href="javascript:showcite('cite-CameronHerdyLin2008','idp451088')">Cameron and Herdy 2008</a>. Recent work has incorporated a method
779            of parallel scanning using bitstream addition <a class="xref" id="idp451952" href="javascript:showcite('cite-cameron-EuroPar2011','idp451952')">Cameron and Amiri 2011</a>, as well as
780            combining SIMD methods with 4-stage pipeline parallelism to further improve throughput
781            <a class="xref" id="idp452736" href="javascript:showcite('cite-HPCA2012','idp452736')">Lin and Medforth 2012</a>. Although these research prototypes handled the full syntax of
782            schema-less XML documents, they lacked the functionality required by full XML parsers. </p>
783<p id="idp453680"> Commercial XML processors support transcoding of multiple character sets and can
784            parse and validate against multiple document vocabularies. Additionally, they provide
785            API facilities beyond those found in research prototypes, including the widely used SAX,
786            SAX2 and DOM interfaces. </p>
788<div class="section" id="idp454528">
789<h3 class="title" style="clear: both">Sequential vs. Parallel Paradigm</h3>
790<p id="idp455216"> Xerces—like all traditional XML parsers—processes XML documents
791            sequentially. Each character is examined to distinguish between the XML-specific markup,
792            such as a left angle bracket <code class="code">&lt;</code>, and the content held within the
793            document. As the parser progresses through the document, it alternates between markup
794            scanning, validation and content processing modes. </p>
795<p id="idp456752"> In other words, Xerces belongs to an equivalence class of applications termed FSM
796           applications<sup class="fn-label"><a href="#FSM" class="footnoteref">[1]</a></sup>.<sup class="fn-label"><a href="#FSM" class="footnoteref" id="FSM-ref">[1]</a></sup> Each state transition indicates the processing context of
797            subsequent characters. Unfortunately, textual data tends to be unpredictable and any
798            character could induce a state transition. </p>
799<p id="idp459280"> Parabix-style XML parsers utilize a concept of layered processing. A block of source
800            text is transformed into a set of lexical bitstreams, which undergo a series of
801            operations that can be grouped into logical layers, e.g., transposition, character
802            classification, and lexical analysis. Each layer is pipeline parallel and require
803            neither speculation nor pre-parsing stages<a class="xref" id="idp459968" href="javascript:showcite('cite-HPCA2012','idp459968')">Lin and Medforth 2012</a>. To meet the API requirements
804            of the document-ordered Xerces output, the results of the Parabix processing layers must
805            be interleaved to produce the equivalent behaviour. </p>
808<div class="section" id="architecture">
809<h2 class="title" style="clear: both">Architecture</h2>
810<div class="section" id="idp462208">
811<h3 class="title" style="clear: both">Overview</h3>
812<p id="idp463264"> icXML is more than an optimized version of Xerces. Many components were grouped,
813            restructured and rearchitected with pipeline parallelism in mind. In this section, we
814            highlight the core differences between the two systems. As shown in Figure
815              <a class="xref" href="#xerces-arch" title="Xerces Architecture">Figure 1</a>, Xerces is comprised of five main modules: the transcoder, reader,
816            scanner, namespace binder, and validator. The <span class="ital">Transcoder</span> converts source data into UTF-16 before Xerces parses it as XML;
817            the majority of the character set encoding validation is performed as a byproduct of
818            this process. The <span class="ital">Reader</span> is responsible for the
819            streaming and buffering of all raw and transcoded (UTF-16) text. It tracks the current
820            line/column position,
822            performs line-break normalization and validates context-specific character set issues,
823            such as tokenization of qualified-names. The <span class="ital">Scanner</span>
824            pulls data through the reader and constructs the intermediate representation (IR) of the
825            document; it deals with all issues related to entity expansion, validates the XML
826            well-formedness constraints and any character set encoding issues that cannot be
827            completely handled by the reader or transcoder (e.g., surrogate characters, validation
828            and normalization of character references, etc.) The <span class="ital">Namespace
829               Binder</span> is a core piece of the element stack. It handles namespace scoping
830            issues between different XML vocabularies. This allows the scanner to properly select
831            the correct schema grammar structures. The <span class="ital">Validator</span>
832            takes the IR produced by the Scanner (and potentially annotated by the Namespace Binder)
833            and assesses whether the final output matches the user-defined DTD and schema grammar(s)
834            before passing it to the end-user. </p>
835<div class="figure" id="xerces-arch">
836<p class="title">Figure 1: Xerces Architecture</p>
837<div class="figure-contents">
838<div class="mediaobject" id="idp471232"><img alt="png image (xerces.png)" src="xerces.png" width="150cm"></div>
839<div class="caption"></div>
842<p id="idp473552"> In icXML functions are grouped into logical components. As shown in
843             <a class="xref" href="#xerces-arch" title="Xerces Architecture">Figure 1</a>, two major categories exist: (1) the Parabix Subsystem and (2) the
844               Markup Processor. All tasks in (1) use the Parabix Framework <a class="xref" id="idp474640" href="javascript:showcite('cite-HPCA2012','idp474640')">Lin and Medforth 2012</a>, which
845            represents data as a set of parallel bitstreams. The <span class="ital">Character Set
846              Adapter</span>, discussed in <a class="xref" href="#character-set-adapter" title="Character Set Adapters">section “Character Set Adapters”</a>, mirrors
847            Xerces's Transcoder duties; however instead of producing UTF-16 it produces a set of
848              lexical bitstreams, similar to those shown in . These lexical
849            bitstreams are later transformed into UTF-16 in the Content Stream Generator, after
850            additional processing is performed. The first precursor to producing UTF-16 is the
851               <span class="ital">Parallel Markup Parser</span> phase. It takes the lexical
852            streams and produces a set of marker bitstreams in which a 1-bit identifies significant
853            positions within the input data. One bitstream for each of the critical piece of
854            information is created, such as the beginning and ending of start tags, end tags,
855            element names, attribute names, attribute values and content. Intra-element
856            well-formedness validation is performed as an artifact of this process. Like Xerces,
857            icXML must provide the Line and Column position of each error. The <span class="ital">Line-Column Tracker</span> uses the lexical information to keep track of the
858            document position(s) through the use of an optimized population count algorithm,
859              described in <a class="xref" href="#errorhandling" title="Error Handling">section “Error Handling”</a>. From here, two data-independent
860            branches exist: the Symbol Resolver and Content Preparation Unit. </p>
861<p id="idp481088"> A typical XML file contains few unique element and attribute names—but
862            each of them will occur frequently. icXML stores these as distinct data structures,
863            called symbols, each with their own global identifier (GID). Using the symbol marker
864            streams produced by the Parallel Markup Parser, the <span class="ital">Symbol
865               Resolver</span> scans through the raw data to produce a sequence of GIDs, called
866            the <span class="ital">symbol stream</span>. </p>
867<p id="idp483744"> The final components of the Parabix Subsystem are the <span class="ital">Content
868               Preparation Unit</span> and <span class="ital">Content Stream
869            Generator</span>. The former takes the (transposed) basis bitstreams and selectively
870            filters them, according to the information provided by the Parallel Markup Parser, and
871            the latter transforms the filtered streams into the tagged UTF-16 <span class="ital">content stream</span>, discussed in <a class="xref" href="#contentstream" title="Content Stream">section “Content Stream”</a>. </p>
872<p id="idp487344"> Combined, the symbol and content stream form icXML's compressed IR of the XML
873            document. The <span class="ital">Markup Processor</span>~parses the IR to
874            validate and produce the sequential output for the end user. The <span class="ital">Final WF checker</span> performs inter-element well-formedness validation that
875            would be too costly to perform in bit space, such as ensuring every start tag has a
876            matching end tag. Xerces's namespace binding functionality is replaced by the <span class="ital">Namespace Processor</span>. Unlike Xerces, it is a discrete phase
877            that produces a series of URI identifiers (URI IDs), the <span class="ital">URI
878               stream</span>, which are associated with each symbol occurrence. This is
879                 discussed in <a class="xref" href="#namespace-handling" title="Namespace Handling">section “Namespace Handling”</a>. Finally, the <span class="ital">Validation</span> layer implements the Xerces's validator. However,
880            preprocessing associated with each symbol greatly reduces the work of this stage. </p>
881<div class="figure" id="icxml-arch">
882<p class="title">Figure 2: icXML Architecture</p>
883<div class="figure-contents">
884<div class="mediaobject" id="idp493808"><img alt="png image (icxml.png)" src="icxml.png" width="500cm"></div>
885<div class="caption"></div>
889<div class="section" id="character-set-adapter">
890<h3 class="title" style="clear: both">Character Set Adapters</h3>
891<p id="idp497296"> In Xerces, all input is transcoded into UTF-16 to simplify the parsing costs of
892            Xerces itself and provide the end-consumer with a single encoding format. In the
893            important case of UTF-8 to UTF-16 transcoding, the transcoding costs can be significant,
894            because of the need to decode and classify each byte of input, mapping variable-length
895            UTF-8 byte sequences into 16-bit UTF-16 code units with bit manipulation operations. In
896            other cases, transcoding may involve table look-up operations for each byte of input. In
897            any case, transcoding imposes at least a cost of buffer copying. </p>
898<p id="idp498352"> In icXML, however, the concept of Character Set Adapters (CSAs) is used to minimize
899            transcoding costs. Given a specified input encoding, a CSA is responsible for checking
900            that input code units represent valid characters, mapping the characters of the encoding
901            into the appropriate bitstreams for XML parsing actions (i.e., producing the lexical
902            item streams), as well as supporting ultimate transcoding requirements. All of this work
903            is performed using the parallel bitstream representation of the source input. </p>
904<p id="idp499328"> An important observation is that many character sets are an extension to the legacy
905            7-bit ASCII character set. This includes the various ISO Latin character sets, UTF-8,
906            UTF-16 and many others. Furthermore, all significant characters for parsing XML are
907            confined to the ASCII repertoire. Thus, a single common set of lexical item calculations
908            serves to compute lexical item streams for all such ASCII-based character sets. </p>
909<p id="idp500208"> A second observation is that—regardless of which character set is
910            used—quite often all of the characters in a particular block of input will be
911            within the ASCII range. This is a very simple test to perform using the bitstream
912            representation, simply confirming that the bit 0 stream is zero for the entire block.
913            For blocks satisfying this test, all logic dealing with non-ASCII characters can simply
914            be skipped. Transcoding to UTF-16 becomes trivial as the high eight bitstreams of the
915            UTF-16 form are each set to zero in this case. </p>
916<p id="idp501648"> A third observation is that repeated transcoding of the names of XML elements,
917            attributes and so on can be avoided by using a look-up mechanism. That is, the first
918            occurrence of each symbol is stored in a look-up table mapping the input encoding to a
919            numeric symbol ID. Transcoding of the symbol is applied at this time. Subsequent look-up
920            operations can avoid transcoding by simply retrieving the stored representation. As
921            symbol look up is required to apply various XML validation rules, there is achieves the
922            effect of transcoding each occurrence without additional cost. </p>
923<p id="idp502704"> The cost of individual character transcoding is avoided whenever a block of input is
924            confined to the ASCII subset and for all but the first occurrence of any XML element or
925            attribute name. Furthermore, when transcoding is required, the parallel bitstream
926            representation supports efficient transcoding operations. In the important case of UTF-8
927            to UTF-16 transcoding, the corresponding UTF-16 bitstreams can be calculated in bit
928              parallel fashion based on UTF-8 streams <a class="xref" id="idp503504" href="javascript:showcite('cite-Cameron2008','idp503504')">Cameron 2008</a>, and all but the final bytes
929            of multi-byte sequences can be marked for deletion as discussed in the following
930            subsection. In other cases, transcoding within a block only need be applied for
931            non-ASCII bytes, which are conveniently identified by iterating through the bit 0 stream
932            using bit scan operations. </p>
934<div class="section" id="par-filter">
935<h3 class="title" style="clear: both">Combined Parallel Filtering</h3>
936<p id="idp505856"> As just mentioned, UTF-8 to UTF-16 transcoding involves marking all but the last
937            bytes of multi-byte UTF-8 sequences as positions for deletion. For example, the two
938            Chinese characters <code class="code">䜠奜</code> are represented as two
939            three-byte UTF-8 sequences <code class="code">E4 BD A0</code> and <code class="code">E5 A5 BD</code> while the
940            UTF-16 representation must be compressed down to the two code units <code class="code">4F60</code>
941            and <code class="code">597D</code>. In the bit parallel representation, this corresponds to a
942            reduction from six bit positions representing UTF-8 code units (bytes) down to just two
943            bit positions representing UTF-16 code units (double bytes). This compression may be
944            achieved by arranging to calculate the correct UTF-16 bits at the final position of each
945            sequence and creating a deletion mask to mark the first two bytes of each 3-byte
946            sequence for deletion. In this case, the portion of the mask corresponding to these
947            input bytes is the bit sequence <code class="code">110110</code>. Using this approach, transcoding
948            may then be completed by applying parallel deletion and inverse transposition of the
949            UTF-16 bitstreams<a class="xref" id="idp509840" href="javascript:showcite('cite-Cameron2008','idp509840')">Cameron 2008</a>. </p>
950<p id="idp510640"> Rather than immediately paying the costs of deletion and transposition just for
951            transcoding, however, icXML defers these steps so that the deletion masks for several
952            stages of processing may be combined. In particular, this includes core XML requirements
953            to normalize line breaks and to replace character reference and entity references by
954            their corresponding text. In the case of line break normalization, all forms of line
955            breaks, including bare carriage returns (CR), line feeds (LF) and CR-LF combinations
956            must be normalized to a single LF character in each case. In icXML, this is achieved by
957            first marking CR positions, performing two bit parallel operations to transform the
958            marked CRs into LFs, and then marking for deletion any LF that is found immediately
959            after the marked CR as shown by the Pablo source code in
960              <a class="xref" href="#fig-LBnormalization">Figure 3</a>.
961              <div class="figure" id="fig-LBnormalization">
962<p class="title">Figure 3</p>
963<div class="figure-contents">
964<div class="caption">Line Break Normalization Logic</div>
965<pre class="programlisting" id="idp514592">
966# XML 1.0 line-break normalization rules.
967if lex.CR:
968# Modify CR (#x0D) to LF (#x0A)
969  u16lo.bit_5 ^= lex.CR
970  u16lo.bit_6 ^= lex.CR
971  u16lo.bit_7 ^= lex.CR
972  CRLF = pablo.Advance(lex.CR) &amp; lex.LF
973  callouts.delmask |= CRLF
974# Adjust LF streams for line/column tracker
975  lex.LF |= lex.CR
976  lex.LF ^= CRLF
980         </p>
981<p id="idp515936"> In essence, the deletion masks for transcoding and for line break normalization each
982            represent a bitwise filter; these filters can be combined using bitwise-or so that the
983            parallel deletion algorithm need only be applied once. </p>
984<p id="idp516592"> A further application of combined filtering is the processing of XML character and
985            entity references. Consider, for example, the references <code class="code">&amp;</code> or
986               <code class="code">&lt;</code>. which must be replaced in XML processing with the single
987               <code class="code">&amp;</code> and <code class="code">&lt;</code> characters, respectively. The
988            approach in icXML is to mark all but the first character positions of each reference for
989            deletion, leaving a single character position unmodified. Thus, for the references
990               <code class="code">&amp;</code> or <code class="code">&lt;</code> the masks <code class="code">01111</code> and
991               <code class="code">011111</code> are formed and combined into the overall deletion mask. After the
992            deletion and inverse transposition operations are finally applied, a post-processing
993            step inserts the proper character at these positions. One note about this process is
994            that it is speculative; references are assumed to generally be replaced by a single
995            UTF-16 code unit. In the case, that this is not true, it is addressed in
996            post-processing. </p>
997<p id="idp521408"> The final step of combined filtering occurs during the process of reducing markup
998            data to tag bytes preceding each significant XML transition as described in
999              <a class="xref" href="#contentstream" title="Content Stream">section “Content Stream”</a>. Overall, icXML avoids separate buffer copying
1000            operations for each of the these filtering steps, paying the cost of parallel deletion
1001            and inverse transposition only once. Currently, icXML employs the parallel-prefix
1002            compress algorithm of Steele~<a class="xref" id="idp522832" href="javascript:showcite('cite-HackersDelight','idp522832')">Warren 2002</a> Performance is independent of the
1003            number of positions deleted. Future versions of icXML are expected to take advantage of
1004            the parallel extract operation~<a class="xref" id="idp523840" href="javascript:showcite('cite-HilewitzLee2006','idp523840')">Hilewitz and Lee 2006</a> that Intel is now providing in its
1005            Haswell architecture. </p>
1007<div class="section" id="contentstream">
1008<h3 class="title" style="clear: both">Content Stream</h3>
1009<p id="idp525888"> A relatively-unique concept for icXML is the use of a filtered content stream.
1010            Rather that parsing an XML document in its original format, the input is transformed
1011            into one that is easier for the parser to iterate through and produce the sequential
1012            output. In , the source data
1014            is transformed into
1016            through the parallel filtering algorithm, described in <a class="xref" href="#par-filter" title="Combined Parallel Filtering">section “Combined Parallel Filtering”</a>. </p>
1017<p id="idp529072"> Combined with the symbol stream, the parser traverses the content stream to
1018            effectively reconstructs the input document in its output form. The initial <span class="ital">0</span> indicates an empty content string. The following
1019               <code class="code">&gt;</code> indicates that a start tag without any attributes is the first
1020            element in this text and the first unused symbol, <code class="code">document</code>, is the element
1021            name. Succeeding that is the content string <code class="code">fee</code>, which is null-terminated
1022            in accordance with the Xerces API specification. Unlike Xerces, no memory-copy
1023            operations are required to produce these strings, which as
1024              <a class="xref" href="#xerces-profile">Table I</a> shows accounts for 6.83% of Xerces's execution time.
1025            Additionally, it is cheap to locate the terminal character of each string: using the
1026            String End bitstream, the Parabix Subsystem can effectively calculate the offset of each
1027            null character in the content stream in parallel, which in turn means the parser can
1028            directly jump to the end of every string without scanning for it. </p>
1029<p id="idp533104"> Following <code class="code">'fee'</code> is a <code class="code">=</code>, which marks the
1030            existence of an attribute. Because all of the intra-element was performed in the Parabix
1031            Subsystem, this must be a legal attribute. Since attributes can only occur within start
1032            tags and must be accompanied by a textual value, the next symbol in the symbol stream
1033            must be the element name of a start tag, and the following one must be the name of the
1034            attribute and the string that follows the <code class="code">=</code> must be its value. However, the
1035            subsequent <code class="code">=</code> is not treated as an independent attribute because the parser
1036            has yet to read a <code class="code">&gt;</code>, which marks the end of a start tag. Thus only
1037            one symbol is taken from the symbol stream and it (along with the string value) is added
1038            to the element. Eventually the parser reaches a <code class="code">/</code>, which marks the
1039            existence of an end tag. Every end tag requires an element name, which means they
1040            require a symbol. Inter-element validation whenever an empty tag is detected to ensure
1041            that the appropriate scope-nesting rules have been applied. </p>
1043<div class="section" id="namespace-handling">
1044<h3 class="title" style="clear: both">Namespace Handling</h3>
1045<p id="idp538672"> In XML, namespaces prevents naming conflicts when multiple vocabularies are used
1046            together. It is especially important when a vocabulary application-dependant meaning,
1047            such as when XML or SVG documents are embedded within XHTML files. Namespaces are bound
1048            to uniform resource identifiers (URIs), which are strings used to identify specific
1049            names or resources. On line 1 in <a class="xref" href="#namespace-ex">Table V</a>, the <code class="code">xmlns</code>
1050            attribute instructs the XML processor to bind the prefix <code class="code">p</code> to the URI
1051               '<code class="code"></code>' and the default (empty) prefix to
1052               <code class="code"></code>. Thus to the XML processor, the <code class="code">title</code> on line 2
1053            and <code class="code">price</code> on line 4 both read as
1054            <code class="code">"":title</code> and
1055               <code class="code">"":price</code> respectively, whereas on line 3 and
1056            5, <code class="code">p:name</code> and <code class="code">price</code> are seen as
1057               <code class="code">"":name</code> and
1058               <code class="code">"":price</code>. Even though the actual element name
1059               <code class="code">price</code>, due to namespace scoping rules they are viewed as two
1060            uniquely-named items because the current vocabulary is determined by the namespace(s)
1061            that are in-scope. </p>
1062<div class="table-wrapper" id="namespace-ex">
1063<p class="title">Table V</p>
1064<div class="caption"><p id="idp547456">XML Namespace Example</p></div>
1065<table class="table" xml:id="namespace-ex">
1066<colgroup span="1">
1067<col align="centre" valign="top" span="1">
1068<col align="left" valign="top" span="1">
1072<td>1. </td>
1073<td>&lt;book xmlns:p="" xmlns=""&gt; </td>
1076<td>2. </td>
1077<td>  &lt;title&gt;BOOK NAME&lt;/title&gt; </td>
1080<td>3. </td>
1081<td>  &lt;p:name&gt;PUBLISHER NAME&lt;/p:name&gt; </td>
1084<td>4. </td>
1085<td>  &lt;price&gt;X&lt;/price&gt; </td>
1088<td>5. </td>
1089<td>  &lt;price xmlns=""&gt;Y&lt;/price&gt; </td>
1092<td>6. </td>
1093<td>&lt;/book&gt; </td>
1098<p id="idp556448"> In both Xerces and icXML, every URI has a one-to-one mapping to a URI ID. These
1099            persist for the lifetime of the application through the use of a global URI pool. Xerces
1100            maintains a stack of namespace scopes that is pushed (popped) every time a start tag
1101            (end tag) occurs in the document. Because a namespace declaration affects the entire
1102            element, it must be processed prior to grammar validation. This is a costly process
1103            considering that a typical namespaced XML document only comes in one of two forms: (1)
1104            those that declare a set of namespaces upfront and never change them, and (2) those that
1105            repeatedly modify the namespaces in predictable patterns. </p>
1106<p id="idp557584"> For that reason, icXML contains an independent namespace stack and utilizes bit
1107            vectors to cheaply perform
1108             When a prefix is
1109            declared (e.g., <code class="code">xmlns:p=""</code>), a namespace binding
1110            is created that maps the prefix (which are assigned Prefix IDs in the symbol resolution
1111            process) to the URI. Each unique namespace binding has a unique namespace id (NSID) and
1112            every prefix contains a bit vector marking every NSID that has ever been associated with
1113              it within the document. For example, in <a class="xref" href="#namespace-ex">Table V</a>, the prefix binding
1114            set of <code class="code">p</code> and <code class="code">xmlns</code> would be <code class="code">01</code> and
1115            <code class="code">11</code> respectively. To resolve the in-scope namespace binding for each prefix,
1116            a bit vector of the currently visible namespaces is maintained by the system. By ANDing
1117            the prefix bit vector with the currently visible namespaces, the in-scope NSID can be
1118            found using a bit-scan intrinsic. A namespace binding table, similar to
1119            <a class="xref" href="#namespace-binding">Table VI</a>, provides the actual URI ID. </p>
1120<div class="table-wrapper" id="namespace-binding">
1121<p class="title">Table VI</p>
1122<div class="caption"><p id="idp564112">Namespace Binding Table Example</p></div>
1123<table class="table" xml:id="namespace-binding">
1124<colgroup span="1">
1125<col align="centre" valign="top" span="1">
1126<col align="centre" valign="top" span="1">
1127<col align="centre" valign="top" span="1">
1128<col align="centre" valign="top" span="1">
1129<col align="centre" valign="top" span="1">
1132<th>NSID </th>
1133<th> Prefix </th>
1134<th> URI </th>
1135<th> Prefix ID </th>
1136<th> URI ID </th>
1140<td>0 </td>
1141<td> <code class="code"> p</code> </td>
1142<td> <code class="code"></code> </td>
1143<td> 0 </td>
1144<td> 0 </td>
1147<td>1 </td>
1148<td> <code class="code"> xmlns</code> </td>
1149<td> <code class="code"></code> </td>
1150<td> 1 </td>
1151<td> 1 </td>
1154<td>2 </td>
1155<td> <code class="code"> xmlns</code> </td>
1156<td> <code class="code"></code> </td>
1157<td> 1 </td>
1158<td> 0 </td>
1163<p id="idp580432">
1168         </p>
1169<p id="idp582336"> To ensure that scoping rules are adhered to, whenever a start tag is encountered,
1170            any modification to the currently visible namespaces is calculated and stored within a
1171            stack of bit vectors denoting the locally modified namespace bindings. When an end tag
1172            is found, the currently visible namespaces is XORed with the vector at the top of the
1173            stack. This allows any number of changes to be performed at each scope-level with a
1174            constant time.
1176         </p>
1178<div class="section" id="errorhandling">
1179<h3 class="title" style="clear: both">Error Handling</h3>
1180<p id="idp584768">
1182            Xerces outputs error messages in two ways: through the programmer API and as thrown
1183            objects for fatal errors. As Xerces parses a file, it uses context-dependant logic to
1184            assess whether the next character is legal; if not, the current state determines the
1185            type and severity of the error. icXML emits errors in the similar manner—but
1186            how it discovers them is substantially different. Recall that in Figure
1187            <a class="xref" href="#icxml-arch" title="icXML Architecture">Figure 2</a>, icXML is divided into two sections: the Parabix Subsystem and
1188            Markup Processor, each with its own system for detecting and producing error messages. </p>
1189<p id="idp587264"> Within the Parabix Subsystem, all computations are performed in parallel, a block at
1190            a time. Errors are derived as artifacts of bitstream calculations, with a 1-bit marking
1191            the byte-position of an error within a block, and the type of error is determined by the
1192            equation that discovered it. The difficulty of error processing in this section is that
1193            in Xerces the line and column number must be given with every error production. Two
1194            major issues exist because of this: (1) line position adheres to XML white-normalization
1195            rules; as such, some sequences of characters, e.g., a carriage return followed by a line
1196            feed, are counted as a single new line character. (2) column position is counted in
1197            characters, not bytes or code units; thus multi-code-unit code-points and surrogate
1198            character pairs are all counted as a single column position. Note that typical XML
1199            documents are error-free but the calculation of the line/column position is a constant
1200            overhead in Xerces.  To
1201            reduce this, icXML pushes the bulk cost of the line/column calculation to the occurrence
1202            of the error and performs the minimal amount of book-keeping necessary to facilitate it.
1203            icXML leverages the byproducts of the Character Set Adapter (CSA) module and amalgamates
1204            the information within the Line Column Tracker (LCT). One of the CSA's major
1205            responsibilities is transcoding an input text.
1206             During this process,
1207            white-space normalization rules are applied and multi-code-unit and surrogate characters
1208            are detected and validated. A <span class="ital">line-feed bitstream</span>,
1209            which marks the positions of the normalized new lines characters, is a natural
1210            derivative of this process. Using an optimized population count algorithm, the line
1211            count can be summarized cheaply for each valid block of text.
1212             Column position is more
1213            difficult to calculate. It is possible to scan backwards through the bitstream of new
1214            line characters to determine the distance (in code-units) between the position between
1215            which an error was detected and the last line feed. However, this distance may exceed
1216            than the actual character position for the reasons discussed in (2). To handle this, the
1217            CSA generates a <span class="ital">skip mask</span> bitstream by ORing together
1218            many relevant bitstreams, such as all trailing multi-code-unit and surrogate characters,
1219            and any characters that were removed during the normalization process. When an error is
1220            detected, the sum of those skipped positions is subtracted from the distance to
1221            determine the actual column number. </p>
1222<p id="idp592784"> The Markup Processor is a state-driven machine. As such, error detection within it
1223            is very similar to Xerces. However, reporting the correct line/column is a much more
1224            difficult problem. The Markup Processor parses the content stream, which is a series of
1225            tagged UTF-16 strings. Each string is normalized in accordance with the XML
1226            specification. All symbol data and unnecessary whitespace is eliminated from the stream;
1227            thus its impossible to derive the current location using only the content stream. To
1228            calculate the location, the Markup Processor borrows three additional pieces of
1229            information from the Parabix Subsystem: the line-feed, skip mask, and a <span class="ital">deletion mask stream</span>, which is a bitstream denoting the
1230            (code-unit) position of every datum that was suppressed from the source during the
1231            production of the content stream. Armed with these, it is possible to calculate the
1232            actual line/column using the same system as the Parabix Subsystem until the sum of the
1233            negated deletion mask stream is equal to the current position. </p>
1236<div class="section" id="multithread">
1237<h2 class="title" style="clear: both">Multithreading with Pipeline Parallelism</h2>
1238<p id="idp596320"> As discussed in section <a class="xref" href="#background-xerces" title="Xerces C++ Structure">section “Xerces C++ Structure”</a>, Xerces can be considered a FSM
1239         application. These are "embarrassingly
1240         sequential."<a class="xref" id="idp597472" href="javascript:showcite('cite-Asanovic-EECS-2006-183','idp597472')">Asanovic and others 2006</a> and notoriously difficult to
1241         parallelize. However, icXML is designed to organize processing into logical layers. In
1242         particular, layers within the Parabix Subsystem are designed to operate over significant
1243         segments of input data before passing their outputs on for subsequent processing. This fits
1244         well into the general model of pipeline parallelism, in which each thread is in charge of a
1245         single module or group of modules. </p>
1246<p id="idp598784"> The most straightforward division of work in icXML is to separate the Parabix Subsystem
1247         and the Markup Processor into distinct logical layers into two separate stages. The
1248         resultant application, <span class="ital">icXML-p</span>, is a course-grained
1249         software-pipeline application. In this case, the Parabix Subsystem thread
1250               <code class="code">T<sub>1</sub></code> reads 16k of XML input <code class="code">I</code> at a
1251         time and produces the content, symbol and URI streams, then stores them in a pre-allocated
1252         shared data structure <code class="code">S</code>. The Markup Processor thread
1253            <code class="code">T<sub>2</sub></code> consumes <code class="code">S</code>, performs well-formedness
1254         and grammar-based validation, and the provides parsed XML data to the application through
1255         the Xerces API. The shared data structure is implemented using a ring buffer, where every
1256         entry contains an independent set of data streams. In the examples of
1257           <a class="xref" href="#threads_timeline1" title="Thread Balance in Two-Stage Pipelines: Stage 1 Dominant">Figure 4</a>, the ring buffer has four entries. A
1258         lock-free mechanism is applied to ensure that each entry can only be read or written by one
1259         thread at the same time. In  <a class="xref" href="#threads_timeline1" title="Thread Balance in Two-Stage Pipelines: Stage 1 Dominant">Figure 4</a> the processing time of
1260               <code class="code">T<sub>1</sub></code> is longer than
1261         <code class="code">T<sub>2</sub></code>; thus <code class="code">T<sub>2</sub></code> always
1262         waits for <code class="code">T<sub>1</sub></code> to write to the shared memory. 
1263         <a class="xref" href="#threads_timeline2" title="Thread Balance in Two-Stage Pipelines: Stage 2 Dominant">Figure 5</a> illustrates the scenario in which
1264         <code class="code">T<sub>1</sub></code> is faster and must wait for
1265            <code class="code">T<sub>2</sub></code> to finish reading the shared data before it can
1266         reuse the memory space. </p>
1267<p id="idp609952">
1268        <div class="figure" id="threads_timeline1">
1269<p class="title">Figure 4: Thread Balance in Two-Stage Pipelines: Stage 1 Dominant</p>
1270<div class="figure-contents"><div class="mediaobject" id="idp611280"><img alt="png image (threads_timeline1.png)" src="threads_timeline1.png" width="500cm"></div></div>
1272        <div class="figure" id="threads_timeline2">
1273<p class="title">Figure 5: Thread Balance in Two-Stage Pipelines: Stage 2 Dominant</p>
1274<div class="figure-contents"><div class="mediaobject" id="idp614336"><img alt="png image (threads_timeline2.png)" src="threads_timeline2.png" width="500cm"></div></div>
1276      </p>
1277<p id="idp616368"> Overall, our design is intended to benefit a range of applications. Conceptually, we
1278         consider two design points. The first, the parsing performed by the Parabix Subsystem
1279         dominates at 67% of the overall cost, with the cost of application processing (including
1280         the driver logic within the Markup Processor) at 33%. The second is almost the opposite
1281         scenario, the cost of application processing dominates at 60%, while the cost of XML
1282         parsing represents an overhead of 40%. </p>
1283<p id="idp617280"> Our design is predicated on a goal of using the Parabix framework to achieve a 50% to
1284         100% improvement in the parsing engine itself. In a best case scenario, a 100% improvement
1285         of the Parabix Subsystem for the design point in which XML parsing dominates at 67% of the
1286         total application cost. In this case, the single-threaded icXML should achieve a 1.5x
1287         speedup over Xerces so that the total application cost reduces to 67% of the original.
1288         However, in icXML-p, our ideal scenario gives us two well-balanced threads each performing
1289         about 33% of the original work. In this case, Amdahl's law predicts that we could expect up
1290         to a 3x speedup at best. </p>
1291<p id="idp618400"> At the other extreme of our design range, we consider an application in which core
1292         parsing cost is 40%. Assuming the 2x speedup of the Parabix Subsystem over the
1293         corresponding Xerces core, single-threaded icXML delivers a 25% speedup. However, the most
1294         significant aspect of our two-stage multi-threaded design then becomes the ability to hide
1295         the entire latency of parsing within the serial time required by the application. In this
1296         case, we achieve an overall speedup in processing time by 1.67x. </p>
1297<p id="idp619344"> Although the structure of the Parabix Subsystem allows division of the work into
1298         several pipeline stages and has been demonstrated to be effective for four pipeline stages
1299         in a research prototype <a class="xref" id="idp619824" href="javascript:showcite('cite-HPCA2012','idp619824')">Lin and Medforth 2012</a>, our analysis here suggests that the further
1300         pipelining of work within the Parabix Subsystem is not worthwhile if the cost of
1301         application logic is little as 33% of the end-to-end cost using Xerces. To achieve benefits
1302         of further parallelization with multi-core technology, there would need to be reductions in
1303         the cost of application logic that could match reductions in core parsing cost. </p>
1305<div class="section" id="performance">
1306<h2 class="title" style="clear: both">Performance</h2>
1307<p id="idp622208"> We evaluate Xerces-C++ 3.1.1, icXML, icXML-p against two benchmarking applications: the
1308         Xerces C++ SAXCount sample application, and a real world GML to SVG transformation
1309         application. We investigated XML parser performance using an Intel Core i7 quad-core (Sandy
1310         Bridge) processor (3.40GHz, 4 physical cores, 8 threads (2 per core), 32+32 kB (per core)
1311         L1 cache, 256 kB (per core) L2 cache, 8 MB L3 cache) running the 64-bit version of Ubuntu
1312         12.04 (Linux). </p>
1313<p id="idp623120"> We analyzed the execution profiles of each XML parser using the performance counters
1314         found in the processor. We chose several key hardware events that provide insight into the
1315         profile of each application and indicate if the processor is doing useful work. The set of
1316         events included in our study are: processor cycles, branch instructions, branch
1317         mispredictions, and cache misses. The Performance Application Programming Interface (PAPI)
1318         Version 5.5.0 <a class="xref" id="idp623888" href="javascript:showcite('cite-papi','idp623888')">Innovative Computing Laboratory</a> toolkit was installed on the test system to facilitate the
1319         collection of hardware performance monitoring statistics. In addition, we used the Linux
1320         perf <a class="xref" id="idp624816" href="javascript:showcite('cite-perf','idp624816')">Eranian and Gouriou</a> utility to collect per core hardware events. </p>
1321<div class="section" id="idp625760">
1322<h3 class="title" style="clear: both">Xerces C++ SAXCount</h3>
1323<p id="idp626400"> Xerces comes with sample applications that demonstrate salient features of the
1324            parser. SAXCount is the simplest such application: it counts the elements, attributes
1325            and characters of a given XML file using the (event based) SAX API and prints out the
1326            totals. </p>
1327<p id="idp627104"> <a class="xref" href="#XMLdocs">Table VII</a> shows the document characteristics of the XML input files
1328            selected for the Xerces C++ SAXCount benchmark. The jaw.xml represents document-oriented
1329            XML inputs and contains the three-byte and four-byte UTF-8 sequence required for the
1330            UTF-8 encoding of Japanese characters. The remaining data files are data-oriented XML
1331            documents and consist entirely of single byte encoded ASCII characters.
1332  <div class="table-wrapper" id="XMLdocs">
1333<p class="title">Table VII</p>
1334<div class="caption"><p id="idp629440">XML Document Characteristics</p></div>
1335<table class="table" xml:id="XMLdocs">
1336<colgroup span="1">
1337<col align="left" valign="top" span="1">
1338<col align="centre" valign="top" span="1">
1339<col align="centre" valign="top" span="1">
1340<col align="centre" valign="top" span="1">
1341<col align="centre" valign="top" span="1">
1345<td>File Name           </td>
1346<td> jaw.xml            </td>
1347<td> road.gml   </td>
1348<td> po.xml     </td>
1349<td> soap.xml </td>
1352<td>File Type           </td>
1353<td> document           </td>
1354<td> data               </td>
1355<td> data               </td>
1356<td> data        </td>
1359<td>File Size (kB)              </td>
1360<td> 7343                       </td>
1361<td> 11584      </td>
1362<td> 76450              </td>
1363<td> 2717 </td>
1366<td>Markup Item Count   </td>
1367<td> 74882              </td>
1368<td> 280724     </td>
1369<td> 4634110    </td>
1370<td> 18004 </td>
1373<td>Markup Density              </td>
1374<td> 0.13                       </td>
1375<td> 0.57       </td>
1376<td> 0.76               </td>
1377<td> 0.87       </td>
1383<p id="idp644944"> A key predictor of the overall parsing performance of an XML file is markup
1384           density<sup class="fn-label"><a href="#idp645312" class="footnoteref" id="idp645312-ref">[2]</a></sup>. This metric has substantial influence on the
1385            performance of traditional recursive descent XML parsers because it directly corresponds
1386            to the number of state transitions that occur when parsing a document. We use a mixture
1387            of document-oriented and data-oriented XML files to analyze performance over a spectrum
1388            of markup densities. </p>
1389<p id="idp646480"> <a class="xref" href="#perf_SAX" title="SAXCount Performance Comparison">Figure 6</a> compares the performance of Xerces, icXML and pipelined icXML
1390            in terms of CPU cycles per byte for the SAXCount application. The speedup for icXML over
1391            Xerces is 1.3x to 1.8x. With two threads on the multicore machine, icXML-p can achieve
1392            speedup up to 2.7x. Xerces is substantially slowed by dense markup but icXML is less
1393            affected through a reduction in branches and the use of parallel-processing techniques.
1394            icXML-p performs better as markup-density increases because the work performed by each
1395            stage is well balanced in this application. </p>
1396<p id="idp648224">
1397        <div class="figure" id="perf_SAX">
1398<p class="title">Figure 6: SAXCount Performance Comparison</p>
1399<div class="figure-contents">
1400<div class="mediaobject" id="idp649536"><img alt="png image (perf_SAX.png)" src="perf_SAX.png" width="500cm"></div>
1401<div class="caption"></div>
1404         </p>
1406<div class="section" id="idp652080">
1407<h3 class="title" style="clear: both">GML2SVG</h3>
1408<p id="idp652752">       As a more substantial application of XML processing, the GML-to-SVG (GML2SVG) application
1409was chosen.   This application transforms geospatially encoded data represented using
1410an XML representation in the form of Geography Markup Language (GML) <a class="xref" id="idp653280" href="javascript:showcite('cite-lake2004geography','idp653280')">Lake and Burggraf 2004</a> 
1411into a different XML format  suitable for displayable maps:
1412Scalable Vector Graphics (SVG) format<a class="xref" id="idp654128" href="javascript:showcite('cite-lu2007advances','idp654128')">Lu and Dos Santos 2007</a>. In the GML2SVG benchmark, GML feature elements
1413and GML geometry elements tags are matched. GML coordinate data are then extracted
1414and transformed to the corresponding SVG path data encodings.
1415Equivalent SVG path elements are generated and output to the destination
1416SVG document.  The GML2SVG application is thus considered typical of a broad
1417class of XML applications that parse and extract information from
1418a known XML format for the purpose of analysis and restructuring to meet
1419the requirements of an alternative format.</p>
1420<p id="idp655552">Our GML to SVG data translations are executed on GML source data
1421modelling the city of Vancouver, British Columbia, Canada.
1422The GML source document set
1423consists of 46 distinct GML feature layers ranging in size from approximately 9 KB to 125.2 MB
1424and with an average document size of 18.6 MB. Markup density ranges from approximately 0.045 to 0.719
1425and with an average markup density of 0.519. In this performance study,
1426213.4 MB of source GML data generates 91.9 MB of target SVG data.</p>
1427<div class="figure" id="perf_GML2SVG">
1428<p class="title">Figure 7: Performance Comparison for GML2SVG</p>
1429<div class="figure-contents">
1430<div class="mediaobject" id="idp657552"><img alt="png image (Throughput.png)" src="Throughput.png" width="500cm"></div>
1431<div class="caption"></div>
1434<p id="idp659888"><a class="xref" href="#perf_GML2SVG" title="Performance Comparison for GML2SVG">Figure 7</a> compares the performance of the GML2SVG application linked against
1435the Xerces, icXML and icXML-p.   
1436On the GML workload with this application, single-thread icXML
1437achieved about a 50% acceleration over Xerces,
1438increasing throughput on our test machine from 58.3 MB/sec to 87.9 MB/sec.   
1439Using icXML-p, a further throughput increase to 111 MB/sec was recorded,
1440approximately a 2X speedup.</p>
1441<p id="idp661296">An important aspect of icXML is the replacement of much branch-laden
1442sequential code inside Xerces with straight-line SIMD code using far
1443fewer branches.  <a class="xref" href="#branchmiss_GML2SVG" title="Comparative Branch Misprediction Rate">Figure 8</a> shows the corresponding
1444improvement in branching behaviour, with a dramatic reduction in branch misses per kB.
1445It is also interesting to note that icXML-p goes even further.   
1446In essence, in using pipeline parallelism to split the instruction
1447stream onto separate cores, the branch target buffers on each core are
1448less overloaded and able to increase the successful branch prediction rate.</p>
1449<div class="figure" id="branchmiss_GML2SVG">
1450<p class="title">Figure 8: Comparative Branch Misprediction Rate</p>
1451<div class="figure-contents">
1452<div class="mediaobject" id="idp664080"><img alt="png image (BM.png)" src="BM.png" width="500cm"></div>
1453<div class="caption"></div>
1456<p id="idp666368">The behaviour of the three versions with respect to L1 cache misses per kB is shown
1457in <a class="xref" href="#cachemiss_GML2SVG" title="Comparative Cache Miss Rate">Figure 9</a>.   Improvements are shown in both instruction-
1458and data-cache performance with the improvements in instruction-cache
1459behaviour the most dramatic.   Single-threaded icXML shows substantially improved
1460performance over Xerces on both measures.   
1461Although icXML-p is slightly worse with respect to data-cache performance,
1462this is more than offset by a further dramatic reduction in instruction-cache miss rate.
1463Again partitioning the instruction stream through the pipeline parallelism model has
1464significant benefit.</p>
1465<div class="figure" id="cachemiss_GML2SVG">
1466<p class="title">Figure 9: Comparative Cache Miss Rate</p>
1467<div class="figure-contents">
1468<div class="mediaobject" id="idp669168"><img alt="png image (CM.png)" src="CM.png" width="500cm"></div>
1469<div class="caption"></div>
1472<p id="idp671456">One caveat with this study is that the GML2SVG application did not exhibit
1473a relative balance of processing between application code and Xerces library
1474code reaching the 33% figure.  This suggests that for this application and
1475possibly others, further separating the logical layers of the
1476icXML engine into different pipeline stages could well offer significant benefit.
1477This remains an area of ongoing work.</p>
1480<div class="section" id="conclusion">
1481<h2 class="title" style="clear: both">Conclusion and Future Work</h2>
1482<p id="idp673616"> This paper is the first case study documenting the significant performance benefits
1483         that may be realized through the integration of parallel bitstream technology into existing
1484         widely-used software libraries. In the case of the Xerces-C++ XML parser, the combined
1485         integration of SIMD and multicore parallelism was shown capable of dramatic producing
1486         dramatic increases in throughput and reductions in branch mispredictions and cache misses.
1487         The modified parser, going under the name icXML is designed to provide the full
1488         functionality of the original Xerces library with complete compatibility of APIs. Although
1489         substantial re-engineering was required to realize the performance potential of parallel
1490         technologies, this is an important case study demonstrating the general feasibility of
1491         these techniques. </p>
1492<p id="idp674896"> The further development of icXML to move beyond 2-stage pipeline parallelism is
1493         ongoing, with realistic prospects for four reasonably balanced stages within the library.
1494         For applications such as GML2SVG which are dominated by time spent on XML parsing, such a
1495         multistage pipelined parsing library should offer substantial benefits. </p>
1496<p id="idp675664"> The example of XML parsing may be considered prototypical of finite-state machines
1497         applications which have sometimes been considered "embarassingly
1498         sequential" and so difficult to parallelize that "nothing
1499         works." So the case study presented here should be considered an important data
1500         point in making the case that parallelization can indeed be helpful across a broad array of
1501         application types. </p>
1502<p id="idp677040"> To overcome the software engineering challenges in applying parallel bitstream
1503         technology to existing software systems, it is clear that better library and tool support
1504         is needed. The techniques used in the implementation of icXML and documented in this paper
1505         could well be generalized for applications in other contexts and automated through the
1506         creation of compiler technology specifically supporting parallel bitstream programming.
1507      </p>
1509<div class="bibliography" id="idp678048">
1510<h2 class="title" style="clear:both">Bibliography</h2>
1511<p class="bibliomixed" id="CameronHerdyLin2008"><a href="#idp451088">[Cameron and Herdy 2008] </a>Cameron, Robert D., Herdy, Kenneth S. and Lin, Dan. High performance XML parsing using parallel bit stream technology. CASCON'08: Proc. 2008 conference of the center for advanced studies on collaborative research. 2008 New York, NY, USA</p>
1512<p class="bibliomixed" id="papi"><a href="#idp623888">[Innovative Computing Laboratory] </a>Innovative Computing Laboratory, University of Texas. Performance Application Programming Interface.<a href="" class="link" target="_new"></a></p>
1513<p class="bibliomixed" id="perf"><a href="#idp624816">[Eranian and Gouriou] </a>Eranian, Stephane, Gouriou, Eric, Moseley, Tipp and Bruijn, Willem de. Linux kernel profiling with perf.<a href="" class="link" target="_new"></a></p>
1514<p class="bibliomixed" id="Cameron2008"><a href="#idp450080">[Cameron 2008] </a>Cameron, Robert D.. A case study in SIMD text processing with parallel bit streams: UTF-8 to UTF-16 transcoding. Proc. 13th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming. 2008 New York, NY, USA</p>
1515<p class="bibliomixed" id="ParaDOM2009"><a href="#idp302032">[Shah and Rao 2009] </a>Shah, Bhavik, Rao, Praveen, Moon, Bongki and Rajagopalan, Mohan. A Data Parallel Algorithm for XML DOM Parsing. Database and XML Technologies. 2009</p>
1516<p class="bibliomixed" id="XMLSSE42"><a href="#idp305184">[Lei 2008] </a>Lei, Zhai. XML Parsing Accelerator with Intel Streaming SIMD Extensions 4 (Intel SSE4). 2008<a href="Intel%20Software%20Network" class="link" target="_new">Intel Software Network</a></p>
1517<p class="bibliomixed" id="Cameron2009"><a href="#idp306096">[Cameron and Herdy 2009] </a>Cameron, Rob, Herdy, Ken and Amiri, Ehsan Amiri. Parallel Bit Stream Technology as a Foundation for XML Parsing Performance. Int'l Symposium on Processing XML Efficiently: Overcoming Limits on Space, Time, or Bandwidth. 2009</p>
1518<p class="bibliomixed" id="HilewitzLee2006"><a href="#idp523840">[Hilewitz and Lee 2006] </a>Hilewitz, Yedidya and Lee, Ruby B.. Fast Bit Compression and Expansion with Parallel Extract and Parallel Deposit Instructions. ASAP '06: Proc. IEEE 17th Int'l Conference on Application-specific Systems, Architectures and Processors. 2006 Washington, DC, USA</p>
1519<p class="bibliomixed" id="Asanovic-EECS-2006-183"><a href="#idp597472">[Asanovic and others 2006] </a>Asanovic, Krste and others. The Landscape of Parallel Computing Research: A View from Berkeley. 2006</p>
1520<p class="bibliomixed" id="GRID2006"><a href="#idp286848">[Lu and Chiu 2006] </a>Lu, Wei, Chiu, Kenneth and Pan, Yinfei. A Parallel Approach to XML Parsing. Proceedings of the 7th IEEE/ACM International Conference on Grid Computing. 2006 Washington, DC, USA</p>
1521<p class="bibliomixed" id="cameron-EuroPar2011"><a href="#idp306848">[Cameron and Amiri 2011] </a>Cameron, Robert D., Amiri, Ehsan, Herdy, Kenneth S., Lin, Dan, Shermer, Thomas C. and Popowich, Fred P.. Parallel Scanning with Bitstream Addition: An XML Case Study. Euro-Par 2011, LNCS 6853, Part II. 2011 Berlin, Heidelberg</p>
1522<p class="bibliomixed" id="HPCA2012"><a href="#idp304240">[Lin and Medforth 2012] </a>Lin, Dan, Medforth, Nigel, Herdy, Kenneth S., Shriraman, Arrvindh and Cameron, Rob. Parabix: Boosting the efficiency of text processing on commodity processors. International Symposium on High-Performance Computer Architecture. 2012 Los Alamitos, CA, USA</p>
1523<p class="bibliomixed" id="HPCC2011"><a href="#idp301200">[You and Wang 2011] </a>You, Cheng-Han and Wang, Sheng-De. A Data Parallel Approach to XML Parsing and Query. 10th IEEE International Conference on High Performance Computing and Communications. 2011 Los Alamitos, CA, USA</p>
1524<p class="bibliomixed" id="E-SCIENCE2007"><a href="#idp299760">[Pan and Zhang 2007] </a>Pan, Yinfei, Zhang, Ying, Chiu, Kenneth and Lu, Wei. Parallel XML Parsing Using Meta-DFAs. International Conference on e-Science and Grid Computing. 2007 Los Alamitos, CA, USA</p>
1525<p class="bibliomixed" id="ICWS2008"><a href="#idp302896">[Pan and Zhang 2008] </a>Pan, Yinfei, Zhang, Ying and Chiu, Kenneth. Hybrid Parallelism for XML SAX Parsing. IEEE International Conference on Web Services. 2008 Los Alamitos, CA, USA</p>
1526<p class="bibliomixed" id="IPDPS2008"><a href="#idp300352">[Pan and Zhang 2008] </a>Pan, Yinfei, Zhang, Ying and Chiu, Kenneth. Simultaneous transducers for data-parallel XML parsing. International Parallel and Distributed Processing Symposium. 2008 Los Alamitos, CA, USA</p>
1527<p class="bibliomixed" id="HackersDelight"><a href="#idp522832">[Warren 2002] </a>Warren, Henry S.. Hacker's Delight. 2002</p>
1528<p class="bibliomixed" id="lu2007advances"><a href="#idp654128">[Lu and Dos Santos 2007] </a>Lu, C.T., Dos Santos, R.F., Sripada, L.N. and Kou, Y.. Advances in GML for geospatial applications. 2007</p>
1529<p class="bibliomixed" id="lake2004geography"><a href="#idp653280">[Lake and Burggraf 2004] </a>Lake, R., Burggraf, D.S., Trninic, M. and Rae, L.. Geography mark-up language (GML) [foundation for the geo-web]. 2004</p>
1531<div class="footnotes">
1532<br><hr width="100" align="left">
1533<div id="FSM" class="footnote"><p><sup class="fn-label"><a href="#FSM-ref" class="footnoteref">[1]</a></sup> Herein FSM applications are considered software systems whose
1534            behaviour is defined by the inputs, current state and the events associated with
1535              transitions of states.</p></div>
1536<div id="idp645312" class="footnote"><p><sup class="fn-label"><a href="#idp645312-ref" class="footnoteref">[2]</a></sup> Markup Density: the ratio of markup bytes used to define the structure
1537             of the document vs. its file size.</p></div>
1540<div id="balisage-footer"><h3 style="font-family: serif; margin:0.25em; font-style: italic">Balisage Series on Markup Technologies</h3></div>
1544<div id="balisage-footer"><h3 style="font-family: serif; margin:0.25em">
1545<i>Balisage:</i> <small>The Markup Conference</small>
Note: See TracBrowser for help on using the repository browser.