Permalink
Browse files

(graph coloring project)

* initial support for interference graphs
  • Loading branch information...
chunhualiao committed May 15, 2012
1 parent ff03b60 commit edf68927596960d96bb773efa25af5e090168f4a
View
@@ -2001,6 +2001,7 @@ projects/DatalogAnalysis/tests/Makefile
projects/DistributedMemoryAnalysisCompass/Makefile
projects/DocumentationGenerator/Makefile
projects/FiniteStateModelChecker/Makefile
+projects/graphColoring/Makefile
projects/HeaderFilesInclusion/HeaderFilesGraphGenerator/Makefile
projects/HeaderFilesInclusion/HeaderFilesNotIncludedList/Makefile
projects/HeaderFilesInclusion/Makefile
@@ -0,0 +1,48 @@
+include $(top_srcdir)/config/Makefile.for.ROSE.includes.and.libs
+
+bin_PROGRAMS = graphColoringMain
+graphColoringMain_SOURCES = graphColoringMain.cpp interferenceGraph.cpp interferenceGraph.h
+
+INCLUDES = $(ROSE_INCLUDES)
+LDADD = $(LIBS_WITH_RPATH) $(ROSE_LIBS)
+
+C_TESTCODES_REQUIRED_TO_PASS = \
+ test1.c
+
+CXX_TESTCODES_REQUIRED_TO_PASS =
+
+TESTCODE_CURRENTLY_FAILING =
+
+
+ROSE_FLAGS = --edg:no_warnings -w -rose:verbose 0 --edg:restrict #-rose:wave
+
+PASSING_C_TEST_Objects = $(C_TESTCODES_REQUIRED_TO_PASS:.c=.o)
+
+PASSING_CXX_TEST_Objects = $(CXX_TESTCODES_REQUIRED_TO_PASS:.cpp=.o)
+
+$(PASSING_C_TEST_Objects): %.o: $(srcdir)/%.c graphColoringMain
+ ./graphColoringMain $(ROSE_FLAGS) $(TESTCODE_INCLUDES) -c $<
+
+$(PASSING_CXX_TEST_Objects): %.o: $(srcdir)/%.cpp graphColoringMain
+ ./graphColoringMain ${ROSE_FLAGS} ${TESTCODE_INCLUDES} -c $<
+
+ALL_TESTCODES = \
+$(C_TESTCODES_REQUIRED_TO_PASS) \
+$(CXX_TESTCODES_REQUIRED_TO_PASS) \
+$(TESTCODE_CURRENTLY_FAILING)
+
+check-local:
+ @echo "Test for Graph Coloring ..."
+ @$(MAKE) $(PASSING_C_TEST_Objects)
+ @$(MAKE) $(PASSING_CXX_TEST_Objects)
+ @echo "***********************************************************************************************************"
+ @echo "****** ROSE/projects/graphColoring: make check rule complete (terminated normally) ******"
+ @echo "***********************************************************************************************************"
+
+EXTRA_DIST = $(ALL_TESTCODES) README
+
+clean-local:
+ rm -f *.o rose_*.* *.out
+ rm -rf QMTest
+
+
@@ -0,0 +1,21 @@
+This is an experimental project to use a graph coloring algorithm to optimize scratch pad memory usage.
+The basic idea is to reproduce and improve on the work described by:
+* LI, L., GAO, L., AND XUE, J. 2005. Memory coloring: A compiler approach for scratch-pad memory management. In Proceedings of the 14th International Conference on Parallel Architectures and Compilation Techniques (PACT’05). IEEE, Los Alamitos, CA, 329–338.
+
+The paper in turn uses other algorithms mentioned by
+* Lal George and Andrew W. Appel. 1996. Iterated register coalescing. ACM Trans. Program. Lang. Syst. 18, 3 (May 1996), 300-324.,
+* PARK, J. AND MOON, S.-M. 2004. Optimistic register coalescing. ACM Trans. Program. Lang. Syst. 26, 4, 735–765.
+* M. D. Smith, N. Ramsey, and G. Holloway. A generalized algorithm for graph-coloring register allocation. In Proceedings of the ACMSIGPLAN 2004 conference on Programming language design and implementation, pages 277–288. ACM Press, 2004.
+
+
+The entire work is rather sophisticated so this project is structured to go through several major phases:
+* Phase 1: implement the baseline iterated register allocation algorithm proposed by George'96.
+* Phase 2: implement the generalized register allocation algorithm described by Smith'04.
+* Phase 3: implement the graph coloring-based scratch-pad memory management described in Li'05.
+* Phase 4: implement the optimistic register coalescing described by iPark'04.
+
+
+==Baseline iterated register allocation==
+
+
+by Chunhua (Leo) Liao, May 14, 2012
@@ -0,0 +1,13 @@
+#include "interferenceGraph.h"
+
+using namespace graphColoring;
+int main()
+{
+ // randomly generate a graph with 20 nodes, 20% completeness in terms of edges
+ Graph g (20, 0.2);
+ g.adj_matrix->print();
+ g.regenerateAdjacentNeighbors();
+ g.toDotGraph("1.dot");
+
+ return 0;
+}
Oops, something went wrong.

0 comments on commit edf6892

Please sign in to comment.