Instruction Profiling Using M-Sim

 

In this exercise, we shall run some Alpha Benchmarks to find out the distribution of instructions they execute. We shall use sim-outorder for this purpose. 

 

Part 1: Obtain Benchmarks

 

Because the M-Sim tarball doesn’t come with a set of benchmarks, you can either use your own, or use those included in benchmarks.tar.gz from http://www.ecs.umass.edu/ece/koren/architecture/Simplescalar/lab1.htm.

You should be able to download the file from this site.  After downloading the benchmarks file, transfer it to your ECS machine (if applicable) in a folder named ‘Benchmarks.’  Untarring should create a benchmarks directory, whose contents should look like Figure 1.

 

Figure 1: Benchmarks contents

 

As you can see, there are 5 alpha benchmarks present: anagram.alpha, cc1.alpha, compress95.alpha, go.alpha, and perl.alpha.  The README file gives the command line description for running each benchmark (See Figure 2).

 

Figure 2: README output

 

These benchmarks can be moved under your msim directory by creating a directory “benchmarks” under your msim directory, navigating to ~/Benchmarks/benchmarks (where the benchmark files are) and executing:

mv *.* ../../benchmarks.

 

Part 2: Argument File Creation

 

Rather than using individual command line arguments, the way simplescalar does, M-Sim uses “argument files” with command line arguments embedded in the file.  This simplifies the process of running multi-threaded simulations, by allowing you to easily separate programs which may require different arguments.  This way, a multithreaded simulation will consist of running sim-outorder with one or more argument files.

 

We will create argument files for the four files of the README, as well as the perl.alpha file.  A description of each follows.

 

1)      anagram: a program for finding anagrams for a phrase, based on a dictionary.

2)    compress95: (SPEC) compresses and decompresses a file in memory.

3)    go: Artificial intelligence; plays the game of go against itself.

4)    cc1: (SPEC) limited version of gcc.

5) perl: A scripting program

 

*IMPORTANT NOTE: Compress95 (an old compression algorithm) may give you problems while running on newer machines.  If you encounter problems later, please skip the use of this benchmark

 

We will now create the argument files.  The general format is:

1)      Number of instructions to be fast-forwarded (some number of instructions at the beginning of the program that won’t be included in the timing calculations).  This is useful if simulating the entire set of instructions is too time consuming.  By beginning timing calculations at a point beyond which is still a representative sample of the entire program speeds things up without sacrificing accuracy.

2)    The delimiter “#”

3)    The executable (ex. anagram.alpha)

4)    Arguments (ex. words)

5)    And optionally, one input redirection (ex. < anagram.in) and one output redirection (ex. > anagram.out)

 

See [1] section 4 “Installation and Use” for more information on argument files.

 

Create a file “cc1-your_name.arg” within your m-sim_v2.0 directory. Copy the README entry for gcc into the file (sim-safe cc1.alpha –O 1stmt.i).  Delete “sim-safe”. Now adjust for your directory structure.  If your directory structure is msim/m-sim_v2.0/, and your benchmarks folder is under msim, your file should contain this line:

../benchmarks/cc1.alpha –O ../benchmarks/1stmt.i

 

Propend ‘0’ for the number of instructions to fast-forward, followed by ‘#’.

 

The resultant string should look like:

0 # ../benchmarks/cc1.alpha –O ../benchmarks/1stmt.i

 

Now create 4 similar files.  They should resemble the entries of Table 1:

 

 

Argument File

Content

anagram-your_name.arg

0 # ../benchmarks/anagram.alpha ../benchmarks/words < ../benchmarks/anagram.in > ../benchmarks/anagram.out

compress95-your_name.arg

0 # ../benchmarks/compress95.alpha < ../benchmarks/compress95.in > ../benchmarks/compress95.out

go-your_name.arg

0 # ../benchmarks/go.alpha 50 9 ../benchmarks/2stone9.in > ../benchmarks/go.out

cc1-your_name.arg

0 # ../benchmarks/cc1.alpha –O ../benchmarks/1stmt.i

perl-your_name.arg

0 # ../benchmarks/perl.alpha < ../benchmarks/perl-tests.pl > ../benchmarks/perl-tests.out

Table 1: Argument file list

 

Part 3: Instruction Profiling

 

In this section, we’ll do some instruction profiling with M-Sim.

Quick fact about sim-outorder simulator

It is a detailed timing simulator which means it collects information about instructions and explicitly records timing information as they are executed by the simulator.

 

Go to home/m-sim_v2.0 directory and type the following to seek help about sim-outorder.

home/m-sim_v2.0$./sim-outorder –h

 

Help can also be invoked just by typing ‘./sim-outorder’. 

 

Now create a directory “results” under the m-sim_v2.0 directory.  This will house all of your simulation output files in future. 

 

Execution is performed as shown in the example below, where simulation output is redirected to an output file named “simoutput_benchmark.alpha”.  To find the statistical profile, open the output file and search (Control-s in emacs) for “simulation statistics”

 

Example simulation run:

 

~/msim/msim_v2.0/$ ./sim-outorder –redir:sim results/anagram_profile.out anagram-your_name.arg

 

Now fill out the following table:

 

 

Benchmark

Total

# Of Insts Commit

Total

# Of Insts Exec

Total # of Loads & Stores Commit

Total # of Loads & Stores Exec

Total # of Branch Commit

Total # of BranchExec

Total # of Cycles

IPC

anagram.

alpha

 

 

 

 

 

 

 

 

go.alpha

 

 

 

 

 

 

 

 

compress95.alpha

 

 

 

 

 

 

 

 

cc1.alpha

 

 

 

 

 

 

 

 

perl.alpha

 

 

 

 

 

 

 

 

Table 2: Instruction Profile Table

 

Now answer the following questions:

 

1)      For each benchmark above, is the benchmark memory intensive or computation intensive?

2)    For each benchmark above, what is the percentage of instructions committed? What is the percentage of loads & stores committed? What is the percentage of branches committed?

3)    Is IPC (and thus CPI) a function of the number of instructions committed or executed?