Hide menu

Lab Assignment 3: Cache Memories

Objective

The purpose of this lab is to understand the functionality of cache memories, and to get an insight into various trade-offs related to the design of systems with cache memories.

Theoretical background

You should review the following resources before you start working on this lab:

Assignments

  1. Cache basics
    Solve the following problems

  2. Locality of data
    This assignment requires you to use sim-cache for the simulations on two different architectures.
    You need to run two test programs on each of the two architectures.
    The source code and the binaries of the test programs are of the .c and .ss suffix, respectively.
    The configuration files for simulations are of the .cfg suffix.
    You can download the test programs and the configuration files for simulations from this URL,
    or you can copy the files from the following directory.
      ~TDTS10/www-pub/lab/cache_memories/2
    To complete this assignment, please follow the instructions listed below.
    • Create a directory (e.g. lab1) in your home directory, and copy the test programs and configuration files to the created directory.
      Run simulations of both test programs (test1.ss and test2.ss) with both configuration files (cache1.cfg and cache22.cfg).
    • Look into the configuration files, cache1.cfg and cache2.cfg, used for the simulations.
      Compare the architectures on which the test programs were run.
    • Analyze the C source code of both test programs, namely test1.c and test2.c.
      Understand how the data are accessed.
      Identify the spatial and temporal locality of the data from the source code.
      Are the two test programs functionally equivalent?
    • Extract the miss rates from the output files of the simulations.
      Explain the differences in hit/miss rates in each case.
      Based on these results, think of a relation between the cache associativity and the locality of data.

  3. Evaluation of cache configurations

    This assignment requires you to use sim-cheetah in order to evaluate the performance of several cache configurations. To get the initial configuration, run the following command sim-cheetah -dumpconfig configfile

    • Create a configuration file for sim-cheetah, so that the simulations cover the following cache configurations:
      • caches with a number of sets between 128 and 4096,
      • caches with a level of associativity between 1 and 8,
      • caches with a line size of 32 bytes and a LRU replacement policy.
      ATTENTION: For those arguments that are commented with "log base 2", you should use the value of power instead of the original value. For example, if you want to set the line size of the cache to be 64, you should set 6 instead of 64 in the line with a leading switch -l.

      Using the go.ss benchmark, run the simulation for the three cases in which the cache stores either only data (data cache), or only intructions (instruction cache), or both (unified cache). To specify whether the cache stores only data, instructions or both, modify the -refs parametar (# reference stream to analyze, i.e., {inst|data|unified})in the configuartion file.

      Here is an example of runnning go.ss on SimpleScalar:

        sim-cheetah -config config-file ~TDTS10/spec95-big/go.ss 3 7
      where go.ss is a simple program that makes the computer run the game "Go" against itself.
      The first parameter (3) indicates the level of the player, while the second parameter (7) sets the go table size.

    • For each of the three simulations, extract the results from the output files, and create a plot graph which shows how the miss ratio depends on the associativity.
    • Answer the following questions.
      • What is the relation between the miss ratio and: the associativity, number of sets, cache size?
      • Compare the overall performance of the data, instruction, and unified caches.
      • In your opinion, why are such cache evaluations necessary for a designer?
        Give a numeric example based on the results obtained from the simulation.

What to report

  • For step 1 (Cache basics), report the results for the problems you have solved with sufficient explanations
  • For step 2 (Locality of data), report where do you observe the spatial and temporal locality of the data from the source code in both test porgrams. Explain the difference between both configuration files. Explain the differences in miss ratio for each case. Based on the results, motivate a relation between cache associativity and the locality of data.
  • For step 3 (Evaluation of cache configuration), report the answers (with sufficient explanations) for the questions you find there. You should use figures when necessary.

Resources


Page responsible: Unmesh Bordoloi
Last updated: 2012-12-04