Computer Architecture | My Assignment Tutor

Computer ArchitectureProject 3Understanding gem5 Cache structureSource: https://www.gem5.org/documentation/general_docs/memory_system/replacement_policies/You can find the different functions in cache replacement policies from the website above. Thereare five main function called in each cache replacement policy.A replacement policy consists of a reset(), touch(), invalidate() and getVictim() methods. Each ofwhich handles the replacement data differently.1. reset() is used to initialize a replacement data (i.e., validate). It should be called only onentry insertion, and must not be called again until invalidation. The first touch to anentry must always be a reset().2. touch() is used on accesses to the replacement data, and as such should be called onentry accesses. It updates the replacement data.3. invalidate() is called whenever an entry is invalidated. It makes the entry as likely to beevicted as possible on the next victim search.4. getVictim() is called when there is a miss, and an eviction must be done. It searchesamong all replacement candidates for an entry with the worst replacement data.Note: Please read the above functions carefully to understand how each policy is implemented.Understanding LRU PolicyIn the design of set associative caches, an important design parameter to analyze – is the blockreplacement policy. Block replacement policy essentially determines which block (out of all theblocks in the set) must be evicted from the cache, when it is time to bring in new data.One of the most popular cache replacement policies is Least Recently Used (LRU). In this scheme,we evict the block that has been unused for the longest period. While it seems to be one of themost intuitively promising block replacement schemes, implementation complexity is its maindisadvantage. LRU must maintain an access history for each block, which slows down the cache.Thus, most caches implement only an approximation of LRU.Note: You will find the cache replacement policies implementation in the gem5 source directory– /src/mem/cache/replacement_policies/lru_rp.cc and lru_rp.hhProblem 1 [7 points] – Understanding and Implementing LRU-IPVDaniel A. Jiménez proposed the Insertion and Promotion for Tree-Based PseudoLRU Last Levelcaches in 2013. Link to paper http://taco.cse.tamu.edu/pdfs/p284-jimenez.pdf. You need tounderstand the Figure 3 in the paper and implement the graph with IPV [0 0 1 0 3 0 1 2 1 0 5 1 00 1 11 13], same as the paper.You have to create two files namely lru_ipv.cc and lru_ipv.hh in the – /src/mem/cache/replacement_policies/ directories. Have the five main functions namelyreset(), touch(), invalidate() and getVictim() methods to implement the IPV. You can hard codethe IPV vector in either the hh or cc file.Change 1: Change to ReplacementPolicies.pyName your class as LRUIPVRP() and add the following in yoursrc/mem/cache/replacement_policies/ReplacementPolicies.pyclass LRUIPVRP(BaseReplacementPolicy):type = ‘LRUIPVRP’cxx_class = ‘LRUIPVRP’cxx_header = “mem/cache/replacement_policies/lru_ipv.hh”Change 2: Change to SConscriptAdd the following line at the end of src/mem/cache/replacement_polices/SConscriptSource(‘lru_ipv.cc’)Note: After all the above modifications recompile gem5 by running the following command:$> scons build/ARM/gem5.optChange 3: Adding repl_policy flag to the gem5 options.$> vim configs/common/Option.pyAdd the repl_policy flag in the options python file under Cache options.Change 4: Adding repl_policy options to the Cache config.For the repl_policy input string to be accepted as l2 cache config you need to include thefollowing change:Pass repl_policy from option to the l2_cache_class in configs/common/CacheConfig.pyat line 100 by modifying l2_cache_classfrom:system.l2 = l2_cache_class(clk_domain=system.cpu_clk_domain,size=options.l2_size,assoc=options.l2_assoc)to:system.l2 = l2_cache_class(clk_domain=system.cpu_clk_domain,size=options.l2_size,assoc=options.l2_assoc,replacement_policy=eval(options.repl_policy))this will allow the input –repl_policy=”LRUIPVRP()” input command to be passed tothe l2 cache configuration.Problem 2 [3 points] – Running your implementationThe gem5 provided to you has been modified to include the command line to call thereplacement policies. Command line option is –repl_policy (dash dash or minus minus). Youhave to run the LRU IPV implemented gem5 for dijkstra and basicmath. Here is the table forexecution ConfigL1 cacheL2 cacheL2 associativityBenchmarks132 Kb data cache,32 Kb Instructioncache256 Kb16 dijkstra basicmath qsort232 Kb data cache,32 Kb Instructioncache1 Mb16 dijkstra basicmath qsort The gem5 commandline options you will be using for the assignment is the followingbuild/ARM/gem5.opt –outdir=Problem2/basicmath-Conf1configs/example/se.py –cpu-type=DerivO3CPU –caches —l1i_size=32kB –l1d_size=32kB –l2cache –l2_assoc=16 —repl_policy=”LRUIPVRP()” –l2_size=256kB –c/basicmath/basicmath_smallProject Deliverables1. For this project, you will create a patch file, which is portable and easy to apply yourgem5 modifications and remove them by the graders. You will have to follow thefollowing instructions to create a correct patch.a. If you have followed the getting started with gem5 document then you shouldhave two copies of gem5. One with name gem5 and one with gem5-cse-ca. Youshould have modified the gem5-cse-ca directory.b. To create a correct patch run the following command;diff –ruN gem5/src/mem/cache/replacement_policies/ /src/mem/cache/replacement_policies/ > project3.patchNote: Make sure the “N” in -ruN is uppercase. You can open project3.patch and locate all yourmodifications to ReplacementPolicies.py, SConscript, lru_ipv.hh and lru_ipv.cc with a “+” signat the beginning of each line modified.2. Like project 1, you will submit the config.ini, config.json and stats.txt along with thepatch file created. The file directory should look like this—Project3-Submission+—Problem1| +—project3.patch| —Problem2+—dijkstra-Conf1| config.ini| config.json| stats.txt|+—dijkstra-Conf2| config.ini| config.json| stats.txt|+—basicmath-Conf1| config.ini| config.json| stats.txt|+—basicmath-Conf2 |||config.iniconfig.jsonstats.txt+—qsort-Conf1|||config.iniconfig.jsonstats.txt —qsort-Conf2config.iniconfig.jsonstats.txtSubmission Instructions1) Submit single zip file containing all the files. Please follow the naming conventions correctly.2) In case where you are doing project in a group, only one group member should makesubmission through Canvas. All the team members of the group will receive the same score.3) Please make sure your directory names and structure match the Project Deliverables.4) The rubric is given below and your project will be graded by the rubric. Comments will beprovided to the student that submitted the project. Please keep in touch with your teammates.Rubric1. Problem 1 [7 points]a. Correct patch file, grader should have no problem in applying the patch andrunning gem5 with your implementation [2 points]b. Correct implementation of LRU IPV according to the paper, with comments inthe cc and hh files. [3 points]c. Correct class names, according to the Project deliverables [2 points]2. Problem 2 [3 points]a. Correct configuration from the table from config.ini file. [1 points]b. Correct stats in the stats.txt file [2 points]

QUALITY: 100% ORIGINAL PAPER – NO PLAGIARISM – CUSTOM PAPER

Leave a Reply

Your email address will not be published.