[pypy-commit] extradoc extradoc: Add a table showing the relative numbers of all operation types to explain the motivation

bivab noreply at buildbot.pypy.org
Fri Jul 27 10:23:08 CEST 2012


Author: David Schneider <david.schneider at picle.org>
Branch: extradoc
Changeset: r4378:6f18f6682abc
Date: 2012-07-26 22:11 +0200
http://bitbucket.org/pypy/extradoc/changeset/6f18f6682abc/

Log:	Add a table showing the relative numbers of all operation types to
	explain the motivation

diff --git a/talk/vmil2012/Makefile b/talk/vmil2012/Makefile
--- a/talk/vmil2012/Makefile
+++ b/talk/vmil2012/Makefile
@@ -1,5 +1,5 @@
 
-jit-guards.pdf: paper.tex paper.bib figures/log.tex figures/example.tex figures/benchmarks_table.tex figures/backend_table.tex
+jit-guards.pdf: paper.tex paper.bib figures/log.tex figures/example.tex figures/benchmarks_table.tex figures/backend_table.tex figures/ops_count_table.tex
 	pdflatex paper
 	bibtex paper
 	pdflatex paper
diff --git a/talk/vmil2012/paper.tex b/talk/vmil2012/paper.tex
--- a/talk/vmil2012/paper.tex
+++ b/talk/vmil2012/paper.tex
@@ -103,12 +103,19 @@
 %___________________________________________________________________________
 \section{Introduction}
 
+
 \todo{add page numbers (draft) for review}
 In this paper we describe and analyze how deoptimization works in the context
 of tracing just-in-time compilers. What instructions are used in the
 intermediate and low-level representation of the JIT instructions and how these
 are implemented.
 
+\begin{figure*}
+    \include{figures/ops_count_table}
+    \caption{Relative numbers of operations in the traces generated for
+    different benchmarks}
+    \label{fig:ops_count}
+\end{figure*}
 Although there are several publications about tracing just-in-time compilers, to
 our knowledge, there are none that describe the use and implementation of
 guards in this context. With the following contributions we aim to shed some
@@ -480,9 +487,9 @@
 is most effective for numeric kernels, so the benchmarks presented here are not
 affected much by its absence.}
 
-Figure~\ref{fig:ops_count} shows the total number of operations that are
+Figure~\ref{fig:benchmarks} shows the total number of operations that are
 recorded during tracing for each of the benchmarks on what percentage of these
-are guards. Figure~\ref{fig:ops_count} also shows the number of operations left
+are guards. Figure~\ref{fig:benchmarks} also shows the number of operations left
 after performing the different trace optimizations done by the trace optimizer,
 such as xxx. The last columns show the overall optimization rate and the
 optimization rate specific for guard operations, showing what percentage of the
@@ -491,14 +498,14 @@
 \begin{figure*}
     \include{figures/benchmarks_table}
     \caption{Benchmark Results}
-    \label{fig:ops_count}
+    \label{fig:benchmarks}
 \end{figure*}
 
 \todo{resume data size estimates on 64bit}
 \todo{figure about failure counts of guards (histogram?)}
 \todo{integrate high level resume data size into Figure \ref{fig:backend_data}}
-\todo{count number of guards with bridges for \ref{fig:ops_count}}
 \todo{add resume data sizes without sharing}
+\todo{add a footnote about why guards have a threshold of 100}
 
 Figure~\ref{fig:backend_data} shows
 the total memory consumption of the code and of the data generated by the machine code
@@ -544,6 +551,7 @@
 
 \todo{look into tracing papers for information about guards and deoptimization}
 LuaJIT \todo{link to mailing list discussion}
+http://lua-users.org/lists/lua-l/2009-11/msg00089.html
 
 % subsection Guards in Other Tracing JITs (end)
 
diff --git a/talk/vmil2012/tool/build_tables.py b/talk/vmil2012/tool/build_tables.py
--- a/talk/vmil2012/tool/build_tables.py
+++ b/talk/vmil2012/tool/build_tables.py
@@ -16,6 +16,35 @@
 
 
 def build_ops_count_table(csvfiles, texfile, template):
+    assert len(csvfiles) == 1
+    lines = getlines(csvfiles[0])
+    keys = 'numeric set get rest new guard '.split()
+    table = []
+    head = ['Benchmark']
+    head += ['%s b' % k for k in keys]
+    head += ['%s a' % k for k in keys]
+
+    for bench in lines:
+        ops = {'before': sum(int(bench['%s before' % s]) for s in keys),
+                'after': sum(int(bench['%s after' % s]) for s in keys)}
+
+        res = [bench['bench'].replace('_', '\\_'),]
+        for t in ('before', 'after'):
+            values = []
+            for key in keys:
+                o = int(bench['%s %s' % (key, t)])
+                values.append(o / ops[t] * 100)
+
+            assert 100.0 - sum(values) < 0.0001
+            res.extend(['%.2f ' % v for v in values])
+        table.append(res)
+    output = render_table(template, head, sorted(table))
+    write_table(output, texfile)
+
+
+
+def build_benchmarks_table(csvfiles, texfile, template):
+    assert len(csvfiles) == 2
     lines = getlines(csvfiles[0])
     bridge_lines = getlines(csvfiles[1])
     bridgedata = {}
@@ -33,12 +62,16 @@
 
     table = []
     # collect data
+    keys = 'numeric guard set get rest new'.split()
     for bench in lines:
-        keys = 'numeric guard set get rest new'.split()
         ops_bo = sum(int(bench['%s before' % s]) for s in keys)
         ops_ao = sum(int(bench['%s after' % s]) for s in keys)
         guards_bo = int(bench['guard before'])
         guards_ao = int(bench['guard after'])
+        # the guard count collected from jit-summary counts more guards than
+        # actually emitted, so the number collected from parsing the logfiles
+        # will probably be lower
+        assert guards_ao <= bridgedata[bench['bench']]['guards']
         res = [
                 bench['bench'].replace('_', '\\_'),
                 ops_bo,
@@ -91,9 +124,11 @@
 
 tables = {
         'benchmarks_table.tex':
-            (['summary.csv', 'bridge_summary.csv'], build_ops_count_table),
+            (['summary.csv', 'bridge_summary.csv'], build_benchmarks_table),
         'backend_table.tex':
-            (['backend_summary.csv'], build_backend_count_table)
+            (['backend_summary.csv'], build_backend_count_table),
+        'ops_count_table.tex':
+            (['summary.csv'], build_ops_count_table),
         }
 
 


More information about the pypy-commit mailing list