LSU EE 7700-3 -- Advanced Computer Implementation -- Spring 2005

Lecture Set 3

Simulation and Instrumentation

 Material will be added to this set.
 Time-stamp: <11 February 2005, 15:26:54 CST, koppel@drop>

====================


Definitions

 Target
   System (real or made up) being evaluated.

 Host
   System (real) that simulator or instrumentation system runs on.

 Benchmark
   Program that runs on target.

 Instrumentation
   Modifications to a system for collecting data, e.g., number of cache misses.

 Simulation
   A method of obtaining performance data on some target system without using
   the target system.


Instrumentation Summary

 Kinds of Data Typically Obtained
   Execution time. (Trivial.)
   Number of cache misses.
   Number of branch mispredictions.
   Number of ROB full stalls.

 Uses
   Analyze execution to tune programs.
   Analyze programs to guide design of new microarchitectures.
    (Complete design would use simulation.)
   Calibrate a simulator.

Instrumentation Techniques

 Event Registers -- Widely Used Now
   Processor designed with special event registers.
   Registers count events such as cache misses.
   Interrupt can be triggered when count reaches zero.
   + Widely available, simple to use.
   - Can only count events, cannot provide more detail.

 Microcode Hacks
   Modified microcode records information in a buffer.
   Can provide more information than event registers.
   + More flexibility on what can be collected.
   - Few processors use microcoded controllers.
   - Collection of detailed information would perturb system.

 Hardware Event Tracing
   Connect probes to system and record information.
   For example, watch instructions being fetched or addresses being loaded.
   Difficult to do with modern processors because many wires only in chip package.
   - Impractical on modern systems.
   - Requires an expensive logic analyzer.


Simulation Definitions

 Functional Simulator
   A system that simulates program execution but provides no timing data.

 Timing Simulator
   A system that simulates program execution and provides timing data.
  
 Cycle-Accurate Simulator
   A more accurate timing simulator.
   (More accurate in the same way that user-friendly software is easier to use.)

 User-Mode Simulation
   Simulating user-mode instructions, not operating system instructions.

 System-Mode Simulation
   Simulating both user- and system-mode instructions.

 IO Hardware Simulation
   Accurately simulate IO hardware, including disk drives.

Using a Simulator

 Step 1: Come up with idea.
 Step 2: Modify simulator.
 Step 3: Choose benchmarks
 Step 4: Run.


Common Simulators

 SimpleScalar
  Developed at the University of Wisconsin.
  Simulates enough of system to run user-mode code.
  Very widely used.
  Can simulate a variety of systems (called models).
    sim-outorder:  (out of order) A dynamically scheduled system.
    sim-bpred: Evaluate branch prediction schemes.
    sim-fast: Functional simulation only.
  
 SimOS
  Developed at Stanford.
  Simulates enough of system to run the OS.
  Rarely used, but results probably accurate because OS is simulated.
  Also can simulate a variety of models, and can switch during execution.

 Shade
  Developed by Sun
  Functional Simulator
  Comes with cache simulators, instruction analyzers.

 RSIM
  Developed at RICE.
  Timing simulation:
    Dynamically scheduled multiprocessor.