Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

INDIAN INSTITUTE OF TECHNOLOGY KANPUR

CS 622A Semester 2020–2021-I: Assignment 1

Multi Level Cache Simulator

GROUP-17
Members
Mayank Bansal
Professor: Roll-20111032
Dr. Mainak Chaudhury
Department of Computer Science
Hirak Mondal
Roll-20111022
Multi Level Cache Simulator Mayank Bansal, Hirak Mondal

INTRODUCTION

A program to simulate L1 cache misses through L2, L3 cache hierarchy for various
applications. There are 3 inclusion policies which are Inclusive, Exclusive and NINE.
We have implemented 2 parts in this assignment.

• Part 1: 8 way LRU Level 2 cache and 16 way LRU level 3 cache
• Part 2: 8 way LRU Level 2 cache and Fully Associative LRU level 3 cache

COMPILATION AND RUN TIME INSTRUCTIONS

Include the trace files

At first u need to paste all the trace files within the traces directory.

Generate the Readable Output Trace Files

To generate the readable trace files you need to run the read.cpp code present
under the main directory which will generate all the trace files in .out format
inside the given directory named output. In Linux environment use the following
commands to run the file, but first you have to set your working directory path to
the location where the read.cpp file is.

To compile use g++ read.cpp

To run it use ./a.out

Note that, read.cpp file is reading the traces from directory named traces, so
DO NOT MOVE or DELETE the traces directory.

PROBLEM 1

• There are 3 separate code files provided. One for INCLUSIVE named
INCLUSIVE.py, another one for EXCLUSIVE named EXCLUSIVE.py and
the last one is for NINE named NINE.py They are provided inside the directory
named output, the same location where all the .out files are generated by

1
Multi Level Cache Simulator Mayank Bansal, Hirak Mondal

read.cpp.

• In Linux environment use the following commands to run the files, but first you
have to set your working directory path to the location where these files are saved.

To run INCLUSIVE file use python INCLUSIVE.py

To run EXCLUSIVE file use python EXCLUSIVE.py

To run NINE file use python NINE.py

Note that, these 3 files MUST be present in the output directory which contains
the .out files. So Do NOT MOVE or DELETE these files from the output
directory.

PROBLEM 2 (LRU)

The code for the second question Problem2.cpp is provided inside the traces
directory, since it is directly reading from the trace files. In Linux environment use
the following commands to run the file, but first you have to set your working
directory path to the location where the Problem2.cpp file is.

Note that, Problem2.cpp file is reading the traces from the directory named
traces, so DO NOT MOVE or DELETE the Problem2.cpp from the traces
directory.

To compile use g++ Problem2.cpp

To run it use ./a.out

2
Multi Level Cache Simulator Mayank Bansal, Hirak Mondal

RESULTS PROBLEM 1

INCLUSIVE LEVEL 2 LEVEL 3


Hits Misses Hits Misses
bzip2 5259461 5398166 3951778 1446388
gcc 11574350 3036461 1663059 1373402
gromacs 3094660 336851 166320 170531
h264ref 1378895 969678 627532 342146
hmmer 1766344 1743421 1352195 391226
sphinx3 1933098 8820349 612987 8207362

EXCLUSIVE LEVEL 2 LEVEL 3


Hits Misses Hits Misses
bzip2 5260051 5397576 4508355 889221
gcc 11581002 3029809 1786985 1242824
gromacs 3094787 336724 177422 159302
h264ref 1382949 965624 821943 143681
hmmer 1774443 1735322 1435276 300046
sphinx3 1938317 8815130 1594354 7220776

3
Multi Level Cache Simulator Mayank Bansal, Hirak Mondal

NINE LEVEL 2 LEVEL 3


Hits Misses Hits Misses
bzip2 5260051 5397576 3951730 1445846
gcc 11581002 3029809 1663561 1366248
gromacs 3094787 336724 166265 170459
h264ref 1382949 965624 632041 333583
hmmer 1774443 1735322 1358978 376344
sphinx3 1938317 8815130 609986 8205144

RESULTS PROBLEM 2 (LRU)

INCLUSIVE LEVEL 3 CACHE


Cold Capacity Conflict
bzip2 119753 1241577 85058
gcc 773053 596546 3803
gromacs 107962 61367 1202
h264ref 63703 271120 7323
hmmer 75884 297539 17803
sphinx3 122069 8265188 -179895

4
Multi Level Cache Simulator Mayank Bansal, Hirak Mondal

OBSERVATIONS IN PROBLEM 1

1. L2 Hits/Misses (Exclusive) is SAME as L2 Hits/Misses (NINE)

This is the case because the blocks present in the L2 cache in case of EXCLUSIVE
and in case of NINE are same. This is NOT the case for INCLUSIVE because of
the eviction policy. When a block is evicted from the L3 cache in INCLUSIVE
then it must also be invalidated in the L2 cache which is NOT the case for NINE
and in case of EXCLUSIVE we have completely different strategy to fill L3 cache,
only when a block is evicted from L2. So L3 eviction does not effect in NINE and
EXCLUSIVE unlike INCLUSIVE. That is why the Hits and Misses of NINE and
EXCLUSIVE is same.

2. L2 Misses (INCLUSIVE) > L2 Misses (NINE and EXCLUSIVE)

This is because in INCLUSIVE policy if we evict a block from the L3 cache then
we also have to invalidate it from the L2 cache despite whether its the LRU block
or not. This leads to greater misses in inclusive policy as compared to other two
policies.

3. Exclusive L3 Cache Policy Has The Lowest Miss Rate

In case of Exclusive cache replacement, we do not posses 2 copies of the same block
in both the cache at a same time. So L3 cache of Exclusive cache replacement policy
has all unique blocks in it, which are not present in L2 cache. So total number of
blocks present in L2 and L3 cache combined in Exclusive is more than other two
replacement policies. Hence the miss of L3 cache in Exclusive is relatively less than
NINE and Inclusive.

5
Multi Level Cache Simulator Mayank Bansal, Hirak Mondal

EXPLANATION OF PROBLEM 2 (LRU)

FA L3 CACHE MISSES CALCULATION

COLD MISSES: The Number Of Blocks Which Are Referenced For The First
Time

CAPACITY MISSES: Total Misses - Cold Misses

CONFLICT MISSES: 16-way L3 misses - FA L3 misses

NEGATIVE CONFLICT MISS IN sphinx3

Negative Conflict miss for FA L3 cache signifies that the cache misses in FA L3 cache
is much higher than cache miss in 16-way set associative L3 cache. In such cases
conflict misses are negative.

You might also like