

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Professor: Mahlke; Class: Advanced Compilers; Subject: Electrical Engineering And Computer Science; University: University of Michigan - Ann Arbor; Term: Fall 2007;
Typology: Assignments
1 / 2
This page cannot be seen from the preview
Don't miss anything!


Setup and install the Trimaran compiler system under Linux as was explained in class. We have 3 machines available for class [andrew, hugo, wilma].eecs.umich.edu. Login to one of these, create a directory for yourself on /z (everyone should have write permission), and install it there. Try to spread out across the 3 machines so 1 disk does not become the bottleneck. You can also install on your CAEN account or your own system. The Trimaran source code is available on the 583 webpage, trimaranf07.tgz (Do NOT use the version on http://www.trimaran.org).
Verify that your installation is correct by running the benchmarks strcpy and wc through the whole system, i.e., “tcc –bench strcpy”, make sure they profile and simulate correctly by looking at the screen output of tcc. Remember setup your environment variables properly before installing, i.e., scripts/envrc or scripts/envrc.bash
Generate the basic block control flow graph for the function _execute for the benchmark grep in Postscript format using Dot.
Modify the statistics gathering portion of Trimaran to gather simple data cache stall statistics. To accomplish this, you need to fill in the function stall_cycle_count() in elcor/src/Stats/el_dcache_stats.cpp. We will assume a simplistic model: each cache miss is 10 cycles, and all misses are handled sequentially. I have gotten you started in this function, and the amount of code that you need to write is minimal (< 10 lines). After you have implemented this new statistic, compute the number of cycles for the benchmark grep for 3 machine configurations specified by the following 6-tuple configuration, (Int units, FP units, Mem units, Branch units, GPR registers, load latency): (1,1,1,1,32,2) this is the initial configuration, (4,2,2,1,64,3), and (2,1,1,1,64,1). Leave all other machine parameters at their default value.
You should submit a single .tgz file via anonymous ftp to www.eecs.umich.edu, log in as anonymous, cd /groups/eecs583, put your tar file named uniquename_hw1.tgz. Note that you will not be able to perform any gets from this directory. Your tar file should contain:
Trimaran is a retargetable compiler system, which means you can target the compiler to different processor configurations rather easily. To change the target configuration, go into elcor/mdes and look at the file hpl_pd_elcor_std.hmdes2. If you want to change any of the values, edit the hpl_pd_elcor_std.hmdes2 file, save it, then type make. Make converts from hmdes2 (user friendly) to lmdes2 (compiler friendly) versions of the machine description database. Lmdes2 files are what is eventually read in by the compiler backend. Remember to remake your mdes’s whenever you change them.
Trimaran exposes all of its compiler switches through parameter files. You can find the parameter files in the elcor/parms directory. The parm files are organized into sections with a DEFAULTS file for each section. To compute the estimated cycles using Trimaran, you just need to set the compiler switch do_cycle_count in STATS_DEFAULTS to yes (its already on). The compiler creates statistics for each procedure that it compiles and stores them in a file called ELCOR_STATS. ELCOR_STATS is kept in the elcor_intermediate directory of the benchmark (e.g., grep_O/elcor_intermediate). Note Elcor just appends to this file, so be careful about running the same benchmark multiple times without deleting the benchmark directory. There is a utility called Sumstat that is built when you make elcor. Sumstat simply totals the stats for all procedures in the benchmark. To run Sumstat, cd grep_O/elcor_intermediate, and run “Sumstat –total –i ELCOR_STATS”. You are interested in Dynamic_dcache_stall_cycles and Dynamic_total_cycles.
To display the control flow graph, Elcor uses the Dot graphing tool. So, the first thing you need to do is install Dot if it is not already on your system. After you have Dot installed, make sure the executable is in your path. To generate a CFG, you first need to insert a small amount of source code into the function common_process_function() in elcor/src/Main/process_function.cpp. At the top of this function add, if (f->get_name() == “_execute”) el_dot_display_cfg(f); Then remake elcor. You also need to turn on another parameter, in elcor/parms/DEBUG_DEFAULTS, set print_dot_graph to yes. Now you can run tcc and generate the graph. It places the PS file (DOT_GRAPH_0.ps) in the elcor_intermediate directory, which should be viewable in ghostview.
To generate the data cache stall statistics, you simply want to multiply the profiled miss ratio by the frequency of each load, and then sum them up. The code provided in el_dcache_stats.cpp is a guide (and is actually most of the work, you need to add about 5 more lines to complete the job). The code handles all the printing of the statistics in the ELCOR_STATS file, so you don’t need to worry about this. One change that is necessary is with running tcc, you must enable cache/memory profiling. This done by adding the argument ‘-mdep_profile’, so to run grep, you run ‘tcc –bench grep – mdep_profile’.