gpu-compute: Added 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

Change-Id: If84a13babf1006ad41a557747c45d48ce2ce22a9
This commit is contained in:
Jarvis Jia
2024-06-10 15:13:05 -05:00
2 changed files with 32 additions and 19 deletions

View File

@@ -380,15 +380,27 @@ parser.add_argument(
help="Gfx version for gpuNote: gfx902 is not fully supported by ROCm", 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" parser.add_argument(
"policy for tcp") "--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" parser.add_argument(
"policy for tcc") "--tcc-rp",
type=str,
default="TreePLRURP",
help="cache replacement policy" "policy for tcc",
)
# sqc rp both changes sqc rp and scalar cache rp # sqc rp both changes sqc rp and scalar cache rp
parser.add_argument("--sqc-rp", type=str, default="TreePLRURP", help="cache replacement policy" parser.add_argument(
"policy for sqc") "--sqc-rp",
type=str,
default="TreePLRURP",
help="cache replacement policy" "policy for sqc",
)
Ruby.define_options(parser) Ruby.define_options(parser)
@@ -880,9 +892,9 @@ gpu_port_idx = gpu_port_idx - args.num_cp * 2
token_port_idx = 0 token_port_idx = 0
for i in range(len(system.ruby._cpu_ports)): for i in range(len(system.ruby._cpu_ports)):
if isinstance(system.ruby._cpu_ports[i], VIPERCoalescer): if isinstance(system.ruby._cpu_ports[i], VIPERCoalescer):
system.cpu[shader_idx].CUs[ system.cpu[shader_idx].CUs[token_port_idx].gmTokenPort = (
token_port_idx system.ruby._cpu_ports[i].gmTokenPort
].gmTokenPort = system.ruby._cpu_ports[i].gmTokenPort )
token_port_idx += 1 token_port_idx += 1
wavefront_size = args.wf_size wavefront_size = args.wf_size

View File

@@ -1125,26 +1125,27 @@ def create_system(
return (cpu_sequencers, dir_cntrl_nodes, mainCluster) return (cpu_sequencers, dir_cntrl_nodes, mainCluster)
def RP_choose(test_name): def RP_choose(test_name):
if test_name == 'TreePLRURP': if test_name == "TreePLRURP":
replacement_policy = TreePLRURP() replacement_policy = TreePLRURP()
elif test_name == 'LRURP': elif test_name == "LRURP":
replacement_policy = LRURP() replacement_policy = LRURP()
elif test_name == 'FIFORP': elif test_name == "FIFORP":
replacement_policy = FIFORP() replacement_policy = FIFORP()
elif test_name == 'LFURP': elif test_name == "LFURP":
replacement_policy = LFURP() replacement_policy = LFURP()
elif test_name == 'LIPRP': elif test_name == "LIPRP":
replacement_policy = LIPRP() replacement_policy = LIPRP()
elif test_name == 'MRURP': elif test_name == "MRURP":
replacement_policy = MRURP() replacement_policy = MRURP()
elif test_name == 'NRURP': elif test_name == "NRURP":
replacement_policy = NRURP() replacement_policy = NRURP()
elif test_name == 'RRIPRP': elif test_name == "RRIPRP":
replacement_policy = RRIPRP() replacement_policy = RRIPRP()
elif test_name == 'SecondChanceRP': elif test_name == "SecondChanceRP":
replacement_policy = SecondChanceRP() replacement_policy = SecondChanceRP()
elif test_name == 'SHiPMemRP': elif test_name == "SHiPMemRP":
replacement_policy = SHiPMemRP() replacement_policy = SHiPMemRP()
return replacement_policy return replacement_policy