[llvm-commits] [poolalloc] r106156 - in /poolalloc/trunk/test: Makefile TEST.FL2.Makefile TEST.FL2.report

John Criswell criswell at uiuc.edu
Wed Jun 16 15:04:21 PDT 2010


Author: criswell
Date: Wed Jun 16 17:04:21 2010
New Revision: 106156

URL: http://llvm.org/viewvc/llvm-project?rev=106156&view=rev
Log:
Added the progalloc test to test the FL2 allocator.

Added:
    poolalloc/trunk/test/TEST.FL2.Makefile
    poolalloc/trunk/test/TEST.FL2.report
Modified:
    poolalloc/trunk/test/Makefile

Modified: poolalloc/trunk/test/Makefile
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/Makefile?rev=106156&r1=106155&r2=106156&view=diff
==============================================================================
--- poolalloc/trunk/test/Makefile (original)
+++ poolalloc/trunk/test/Makefile Wed Jun 16 17:04:21 2010
@@ -37,12 +37,12 @@
 
 
 NORMAL_PROBLEM_SIZE_DIRS := \
-   External/SPEC/CINT2000/175.vpr \
+   MultiSource/Benchmarks/Olden/bh \
+   #MultiSource/Benchmarks/Olden \
+   #External/SPEC/CINT2000/175.vpr \
    #External/SPEC/CINT2000 \
    #External/SPEC/CINT2000/181.mcf \
    #External/SPEC/CINT2000/186.crafty \
-   #MultiSource/Benchmarks/Olden \
-   #MultiSource/Benchmarks/Olden/bh \
    #External/FPGrowth \
    #External/Namd \
    #External/Povray \
@@ -110,6 +110,30 @@
         done
 	@printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a"
 
+# Program tests for the allocator
+progalloc::
+	for dir in $(LARGE_PROBLEM_SIZE_DIRS); do \
+            (cd $$dir; \
+               PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=FL2 \
+                   LARGE_PROBLEM_SIZE=1 report.html) \
+        done
+	for dir in $(NORMAL_PROBLEM_SIZE_DIRS); do \
+	    (cd $$dir; \
+               PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=FL2 \
+                   report.html) \
+        done
+	@for dir in $(LARGE_PROBLEM_SIZE_DIRS); do \
+            (cd $$dir; \
+               PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -s -j1 TEST=FL2 \
+                   LARGE_PROBLEM_SIZE=1 report) \
+        done
+	@for dir in $(NORMAL_PROBLEM_SIZE_DIRS); do \
+	    (cd $$dir; \
+               PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -s -j1 TEST=FL2 \
+                   report) \
+        done
+	@printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a"
+
 # Program tests for Pool Allocation
 progtest::
 	for dir in $(LARGE_PROBLEM_SIZE_DIRS); do \

Added: poolalloc/trunk/test/TEST.FL2.Makefile
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/TEST.FL2.Makefile?rev=106156&view=auto
==============================================================================
--- poolalloc/trunk/test/TEST.FL2.Makefile (added)
+++ poolalloc/trunk/test/TEST.FL2.Makefile Wed Jun 16 17:04:21 2010
@@ -0,0 +1,171 @@
+##===- poolalloc/test/TEST.FL2.Makefile --------------------*- Makefile -*-===##
+#
+# This test uses simple pool allocation to test the FL2 allocator.
+#
+##===----------------------------------------------------------------------===##
+
+CFLAGS = -O2 -fno-strict-aliasing
+
+EXTRA_PA_FLAGS := 
+
+# HEURISTIC can be set to:
+#   AllNodes
+ifdef HEURISTIC
+EXTRA_PA_FLAGS += -poolalloc-heuristic=$(HEURISTIC)
+endif
+
+CURDIR  := $(shell cd .; pwd)
+PROGDIR := $(shell cd $(LLVM_SRC_ROOT)/projects/test-suite; pwd)/
+RELDIR  := $(subst $(PROGDIR),,$(CURDIR))
+PADIR   := $(LLVM_OBJ_ROOT)/projects/poolalloc
+
+# Watchdog utility
+WATCHDOG := $(LLVM_OBJ_ROOT)/projects/poolalloc/$(CONFIGURATION)/bin/watchdog
+
+# Bits of runtime to improve analysis
+PA_PRE_RT := $(PADIR)/$(CONFIGURATION)/lib/libpa_pre_rt.bca
+
+# Pool allocator pass shared object
+PA_SO    := $(PADIR)/$(CONFIGURATION)/lib/libpoolalloc$(SHLIBEXT)
+DSA_SO   := $(PADIR)/$(CONFIGURATION)/lib/libLLVMDataStructure$(SHLIBEXT)
+ASSIST_SO := $(PADIR)/$(CONFIGURATION)/lib/libAssistDS$(SHLIBEXT)
+
+# Pool allocator runtime library
+#PA_RT    := $(PADIR)/$(CONFIGURATION)/lib/libpoolalloc_fl_rt.bc
+#PA_RT_O  := $(PROJECT_DIR)/lib/$(CONFIGURATION)/poolalloc_rt.o
+PA_RT_O  := $(PADIR)/$(CONFIGURATION)/lib/libpoolalloc_rt.a
+#PA_RT_O  := $(PROJECT_DIR)/lib/$(CONFIGURATION)/poolalloc_fl_rt.o
+
+# Command to run opt with the pool allocator pass loaded
+OPT_PA := $(WATCHDOG) $(LOPT) -load $(DSA_SO) -load $(PA_SO)
+
+# OPT_PA_STATS - Run opt with the -stats and -time-passes options, capturing the
+# output to a file.
+OPT_PA_STATS = $(OPT_PA) -info-output-file=$(CURDIR)/$@.info -stats -time-passes
+
+OPTZN_PASSES := -globaldce -ipsccp -deadargelim -adce -instcombine -simplifycfg
+
+
+$(PROGRAMS_TO_TEST:%=Output/%.temp.bc): \
+Output/%.temp.bc: Output/%.llvm.bc 
+	-$(LLVMLD) -link-as-library $< $(PA_PRE_RT) -o $@
+
+$(PROGRAMS_TO_TEST:%=Output/%.base.bc): \
+Output/%.base.bc: Output/%.temp.bc $(LOPT) $(ASSIST_SO)
+	-$(LOPT) -load $(ASSIST_SO) -instnamer -internalize -indclone -funcspec -ipsccp -deadargelim -instcombine -globaldce -stats $< -f -o $@ 
+
+# This rule runs the pool allocator on the .base.bc file to produce a new .bc
+# file
+$(PROGRAMS_TO_TEST:%=Output/%.poolalloc.bc): \
+Output/%.poolalloc.bc: Output/%.base.bc $(PA_SO) $(LOPT)
+	- at rm -f $(CURDIR)/$@.info
+	-$(OPT_PA_STATS) -poolalloc-simple $(EXTRA_PA_FLAGS) $(OPTZN_PASSES) $< -o $@ -f 2>&1 > $@.out
+
+$(PROGRAMS_TO_TEST:%=Output/%.nonpa.bc): \
+Output/%.nonpa.bc: Output/%.base.bc $(LOPT)
+	- at rm -f $(CURDIR)/$@.info
+	-$(LOPT) $(OPTZN_PASSES) $< -o $@ -f 2>&1 > $@.out
+
+# This rule compiles the new .bc file into a .s file
+$(PROGRAMS_TO_TEST:%=Output/%.poolalloc.s): \
+Output/%.poolalloc.s: Output/%.poolalloc.bc $(LLC)
+	-$(LLC) -f $< -o $@
+
+$(PROGRAMS_TO_TEST:%=Output/%.nonpa.s): \
+Output/%.nonpa.s: Output/%.nonpa.bc $(LLC)
+	-$(LLC) -f $< -o $@
+
+# Compile the .s file into an executable
+$(PROGRAMS_TO_TEST:%=Output/%.poolalloc): \
+Output/%.poolalloc: Output/%.poolalloc.s $(PA_RT_O)
+	-$(CC) $(CFLAGS) $< $(PA_RT_O) $(LLCLIBS) $(LDFLAGS) -o $@
+
+$(PROGRAMS_TO_TEST:%=Output/%.nonpa): \
+Output/%.nonpa: Output/%.nonpa.s $(PA_RT_O)
+	-$(CC) $(CFLAGS) $< $(PA_RT_O) $(LLCLIBS) $(LDFLAGS) -o $@
+
+
+ifndef PROGRAMS_HAVE_CUSTOM_RUN_RULES
+
+# This rule runs the generated executable, generating timing information, for
+# normal test programs
+$(PROGRAMS_TO_TEST:%=Output/%.poolalloc.out): \
+Output/%.poolalloc.out: Output/%.poolalloc
+	-$(RUNSAFELY) $(STDIN_FILENAME) $@ $< $(RUN_OPTIONS)
+
+$(PROGRAMS_TO_TEST:%=Output/%.nonpa.out): \
+Output/%.nonpa.out: Output/%.nonpa
+	-$(RUNSAFELY) $(STDIN_FILENAME) $@ $< $(RUN_OPTIONS)
+else
+
+# This rule runs the generated executable, generating timing information, for
+# SPEC
+$(PROGRAMS_TO_TEST:%=Output/%.poolalloc.out): \
+Output/%.poolalloc.out: Output/%.poolalloc
+	-$(SPEC_SANDBOX) poolalloc-$(RUN_TYPE) $@ $(REF_IN_DIR) \
+             $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \
+                  ../../$< $(RUN_OPTIONS)
+	-(cd Output/poolalloc-$(RUN_TYPE); cat $(LOCAL_OUTPUTS)) > $@
+	-cp Output/poolalloc-$(RUN_TYPE)/$(STDOUT_FILENAME).time $@.time
+
+$(PROGRAMS_TO_TEST:%=Output/%.nonpa.out): \
+Output/%.nonpa.out: Output/%.nonpa
+	-$(SPEC_SANDBOX) nonpa-$(RUN_TYPE) $@ $(REF_IN_DIR) \
+             $(RUNSAFELY) $(STDIN_FILENAME) $(STDOUT_FILENAME) \
+                  ../../$< $(RUN_OPTIONS)
+	-(cd Output/nonpa-$(RUN_TYPE); cat $(LOCAL_OUTPUTS)) > $@
+	-cp Output/nonpa-$(RUN_TYPE)/$(STDOUT_FILENAME).time $@.time
+
+endif
+
+
+# This rule diffs the post-poolallocated version to make sure we didn't break
+# the program!
+$(PROGRAMS_TO_TEST:%=Output/%.poolalloc.diff-nat): \
+Output/%.poolalloc.diff-nat: Output/%.out-nat Output/%.poolalloc.out
+	@cp Output/$*.out-nat Output/$*.poolalloc.out-nat
+	-$(DIFFPROG) nat $*.poolalloc $(HIDEDIFF)
+
+$(PROGRAMS_TO_TEST:%=Output/%.nonpa.diff-nat): \
+Output/%.nonpa.diff-nat: Output/%.out-nat Output/%.nonpa.out
+	@cp Output/$*.out-nat Output/$*.nonpa.out-nat
+	-$(DIFFPROG) nat $*.nonpa $(HIDEDIFF)
+
+
+# This rule wraps everything together to build the actual output the report is
+# generated from.
+$(PROGRAMS_TO_TEST:%=Output/%.$(TEST).report.txt): \
+Output/%.$(TEST).report.txt: Output/%.out-nat                \
+                             Output/%.nonpa.diff-nat         \
+                             Output/%.poolalloc.diff-nat     \
+                             Output/%.LOC.txt
+	@-cat $<
+	@echo > $@
+	@echo "---------------------------------------------------------------" >> $@
+	@echo ">>> ========= '$(RELDIR)/$*' Program" >> $@
+	@echo "---------------------------------------------------------------" >> $@
+	@echo >> $@
+	@-if test -f Output/$*.nonpa.diff-nat; then \
+	  printf "GCC-RUN-TIME: " >> $@;\
+	  grep "^program" Output/$*.out-nat.time >> $@;\
+        fi
+	@-if test -f Output/$*.nonpa.diff-nat; then \
+	  printf "RUN-TIME-NORMAL: " >> $@;\
+	  grep "^program" Output/$*.nonpa.out.time >> $@;\
+        fi
+	@-if test -f Output/$*.poolalloc.diff-nat; then \
+	  printf "RUN-TIME-POOLALLOC: " >> $@;\
+	  grep "^program" Output/$*.poolalloc.out.time >> $@;\
+	fi
+	-printf "LOC: " >> $@
+	-cat Output/$*.LOC.txt >> $@
+	@-cat Output/$*.$(TEST).bc.info >> $@
+
+$(PROGRAMS_TO_TEST:%=test.$(TEST).%): \
+test.$(TEST).%: Output/%.$(TEST).report.txt
+	@echo "---------------------------------------------------------------"
+	@echo ">>> ========= '$(RELDIR)/$*' Program"
+	@echo "---------------------------------------------------------------"
+	@-cat $<
+
+REPORT_DEPENDENCIES := $(PA_RT_O) $(PA_SO) $(PROGRAMS_TO_TEST:%=Output/%.llvm.bc) $(LLC) $(LOPT)

Added: poolalloc/trunk/test/TEST.FL2.report
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/TEST.FL2.report?rev=106156&view=auto
==============================================================================
--- poolalloc/trunk/test/TEST.FL2.report (added)
+++ poolalloc/trunk/test/TEST.FL2.report Wed Jun 16 17:04:21 2010
@@ -0,0 +1,89 @@
+##=== TEST.poolalloc.report - Report description for poolalloc -*- perl -*-===##
+#
+# This file defines a report to be generated for the pool allocator tests.
+#
+##===----------------------------------------------------------------------===##
+
+# Sort by program name
+$SortCol = 0;
+$TrimRepeatedPrefix = 1;
+
+# FormatTime - Convert a time from 1m23.45 into 83.45
+sub FormatTime {
+  my $Time = shift;
+  if ($Time =~ m/([0-9]+)[m:]([0-9.]+)/) {
+    return sprintf("%7.3f", $1*60.0+$2);
+  }
+
+  return sprintf("%6.2f", $Time);
+}
+
+
+sub RuntimePercent {
+  my ($Cols, $Col) = @_;
+  if ($Cols->[$Col-1] ne "*" and $Cols->[4] ne "*" and
+      $Cols->[4] != "0") {
+    return sprintf "%7.2f", 100*$Cols->[$Col-1]/$Cols->[4];
+  } else {
+    return "n/a";
+  }
+}
+
+ at LatexColumns = (1, 5, 8, 12, 9, 13, 14, 15, 2, 16);
+
+my $FREEBENCH = 'MultiSource/Benchmarks/FreeBench';
+my $PTRDIST   = 'MultiSource/Benchmarks/Ptrdist';
+
+ at LatexRowMapOrder = (
+                     '164.gzip/164.gzip' => '164.gzip',
+                     '175.vpr/175.vpr' => '175.vpr',
+                     '181.mcf/181.mcf' => '181.mcf',
+                     '186.crafty/186.crafty' => '186.crafty',
+                     '197.parser/197.parser' => '197.parser',
+                     '197.parser.hacked/197.parser.hacked' => '197.parser(b)',
+                     '255.vortex/255.vortex' => '255.vortex',
+                     '256.bzip2/256.bzip2' => '256.bzip2',
+                     '300.twolf/300.twolf' => '300.twolf',
+                     '-' => '-',
+                     "anagram/anagram"       => 'anagram',
+                     "bc/bc"                 => 'bc',
+                     "ft/ft"                 => 'ft',
+                     "ks/ks"                 => 'ks',
+                     "yacr2/yacr2"           => 'yacr2',
+                     '-' => '-',
+                     "analyzer"     => 'analyzer',
+                     "neural"       => 'neural',
+                     "pcompress2"   => 'pcompress2',
+                     "piff2"        => 'piff2',
+                     '-' => '-',
+                     "bh/bh" => 'bh',
+                     "bisort/bisort" => 'bisort',
+                     "em3d/em3d" => 'em3d',
+                     "health/health" => 'health',
+                     "mst/mst" => 'mst',
+                     "perimeter/perimeter" => 'perimeter',
+                     "power/power" => 'power',
+                     "treeadd/treeadd" => 'treeadd',
+                     "tsp/tsp" => 'tsp',
+                     '-' => '-',
+                     "llu"          => 'llu-bench',
+                  );
+
+
+# These are the columns for the report.  The first entry is the header for the
+# column, the second is the regex to use to match the value.  Empty list create
+# seperators, and closures may be put in for custom processing.
+(
+# Name
+ ["Name:" , '\'([^\']+)\' Program'],
+ ["LOC"   , 'LOC:\s*([0-9]+)'],
+ [],
+# Times
+ ["GCC",            'GCC-RUN-TIME: program\s*([.0-9m:]+)', \&FormatTime],
+ ["NonPATime",      'RUN-TIME-NORMAL: program\s*([.0-9m:]+)', \&FormatTime],
+ [],
+ ["FL2 Time",        'RUN-TIME-POOLALLOC: program\s*([.0-9m:]+)', \&FormatTime],
+ ["FL2 run%",        \&RuntimePercent],
+ []
+);
+





More information about the llvm-commits mailing list