From 5b44eca64e6901abe0a524e269ed4e9acd8baa84 Mon Sep 17 00:00:00 2001 From: Jarvis Jia Date: Mon, 10 Jun 2024 13:58:24 -0500 Subject: [PATCH 1/4] Adding functions to choose replacement policies for GPU Adding RP_choose functions to change replacement policies among TreePLRU, LRU, FIFO, LFU, LIP, MRU, NRU, RRIP, SecondChance AND ShiPMem replacement policies for TCC, TCP and SQC caches for GPU --- configs/example/apu_se.py | 10 ++++++++++ configs/ruby/GPU_VIPER.py | 32 +++++++++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/configs/example/apu_se.py b/configs/example/apu_se.py index 17e46268ef..95ca2df0ad 100644 --- a/configs/example/apu_se.py +++ b/configs/example/apu_se.py @@ -380,6 +380,16 @@ parser.add_argument( help="Gfx version for gpuNote: gfx902 is not fully supported by ROCm", ) +parser.add_argument("--tcp-rp", type=str, default="TreePLRURP", help="cache replacement policy" + "policy for tcp") + +parser.add_argument("--tcc-rp", type=str, default="TreePLRURP", help="cache replacement policy" + "policy for tcc") + +# sqc rp both changes sqc rp and scalar cache rp +parser.add_argument("--sqc-rp", type=str, default="TreePLRURP", help="cache replacement policy" + "policy for sqc") + Ruby.define_options(parser) # add TLB options to the parser diff --git a/configs/ruby/GPU_VIPER.py b/configs/ruby/GPU_VIPER.py index d0a0c61083..e453578e15 100644 --- a/configs/ruby/GPU_VIPER.py +++ b/configs/ruby/GPU_VIPER.py @@ -149,7 +149,7 @@ class TCPCache(RubyCache): self.size = MemorySize(options.tcp_size) self.assoc = options.tcp_assoc self.resourceStalls = options.no_tcc_resource_stalls - self.replacement_policy = TreePLRURP() + self.replacement_policy = RP_choose(options.tcp_rp) class TCPCntrl(TCP_Controller, CntrlBase): @@ -241,7 +241,7 @@ class SQCCache(RubyCache): def create(self, options): self.size = MemorySize(options.sqc_size) self.assoc = options.sqc_assoc - self.replacement_policy = TreePLRURP() + self.replacement_policy = RP_choose(options.tcp_rp) class SQCCntrl(SQC_Controller, CntrlBase): @@ -303,7 +303,7 @@ class TCC(RubyCache): self.start_index_bit = math.log(options.cacheline_size, 2) + math.log( options.num_tccs, 2 ) - self.replacement_policy = TreePLRURP() + self.replacement_policy = RP_choose(options.tcp_rp) class TCCCntrl(TCC_Controller, CntrlBase): @@ -1124,3 +1124,29 @@ def create_system( ruby_system.network.number_of_virtual_networks = 11 return (cpu_sequencers, dir_cntrl_nodes, mainCluster) + +def RP_choose(test_name): + if test_name == 'TreePLRURP': + replacement_policy = TreePLRURP() + elif test_name == 'LRURP': + replacement_policy = LRURP() + elif test_name == 'FIFORP': + replacement_policy = FIFORP() + elif test_name == 'LRURP': + replacement_policy = LRURP() + elif test_name == 'LFURP': + replacement_policy = LFURP() + elif test_name == 'LIPRP': + replacement_policy = LIPRP() + elif test_name == 'MRURP': + replacement_policy = MRURP() + elif test_name == 'NRURP': + replacement_policy = NRURP() + elif test_name == 'RRIPRP': + replacement_policy = RRIPRP() + elif test_name == 'SecondChanceRP': + replacement_policy = SecondChanceRP() + elif test_name == 'SHiPMemRP': + replacement_policy = SHiPMemRP() + + return replacement_policy From 7c410797d1fb2705034667ffe2f728f340bf466d Mon Sep 17 00:00:00 2001 From: Jarvis Jia Date: Mon, 10 Jun 2024 14:09:09 -0500 Subject: [PATCH 2/4] Adding functions to choose replacement policies for GPU Adding RP_choose functions to change replacement policies among TreePLRU, LRU, FIFO, LFU, LIP, MRU, NRU, RRIP, SecondChance AND ShiPMem replacement policies for TCC, TCP and SQC caches for GPU --- configs/ruby/GPU_VIPER.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/configs/ruby/GPU_VIPER.py b/configs/ruby/GPU_VIPER.py index e453578e15..529ecac1b2 100644 --- a/configs/ruby/GPU_VIPER.py +++ b/configs/ruby/GPU_VIPER.py @@ -1132,8 +1132,6 @@ def RP_choose(test_name): replacement_policy = LRURP() elif test_name == 'FIFORP': replacement_policy = FIFORP() - elif test_name == 'LRURP': - replacement_policy = LRURP() elif test_name == 'LFURP': replacement_policy = LFURP() elif test_name == 'LIPRP': From c158ce22bf4827394708824539f5905c7ea16681 Mon Sep 17 00:00:00 2001 From: Jarvis Jia Date: Mon, 10 Jun 2024 14:09:09 -0500 Subject: [PATCH 3/4] gpu-compute: Added functions to choose replacement policies for GPU Adding RP_choose function to change replacement policies among TreePLRU, LRU, FIFO, LFU, LIP, MRU, NRU, RRIP, SecondChance AND ShiPMem replacement policies for TCC, TCP and SQC caches for GPU --- configs/ruby/GPU_VIPER.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/configs/ruby/GPU_VIPER.py b/configs/ruby/GPU_VIPER.py index e453578e15..529ecac1b2 100644 --- a/configs/ruby/GPU_VIPER.py +++ b/configs/ruby/GPU_VIPER.py @@ -1132,8 +1132,6 @@ def RP_choose(test_name): replacement_policy = LRURP() elif test_name == 'FIFORP': replacement_policy = FIFORP() - elif test_name == 'LRURP': - replacement_policy = LRURP() elif test_name == 'LFURP': replacement_policy = LFURP() elif test_name == 'LIPRP': From cf5e316a925bedeb362d01410549b7c1c178c729 Mon Sep 17 00:00:00 2001 From: Jarvis Jia Date: Mon, 10 Jun 2024 16:33:18 -0500 Subject: [PATCH 4/4] Change black format Change-Id: I3733b31baf187e0d3d38d971d9423a1b1afe2296 --- configs/example/apu_se.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/example/apu_se.py b/configs/example/apu_se.py index d686ecb919..2d3a849df0 100644 --- a/configs/example/apu_se.py +++ b/configs/example/apu_se.py @@ -892,9 +892,9 @@ gpu_port_idx = gpu_port_idx - args.num_cp * 2 token_port_idx = 0 for i in range(len(system.ruby._cpu_ports)): if isinstance(system.ruby._cpu_ports[i], VIPERCoalescer): - system.cpu[shader_idx].CUs[token_port_idx].gmTokenPort = ( - system.ruby._cpu_ports[i].gmTokenPort - ) + system.cpu[shader_idx].CUs[ + token_port_idx + ].gmTokenPort = system.ruby._cpu_ports[i].gmTokenPort token_port_idx += 1 wavefront_size = args.wf_size