Add cache sets histogram script, update gather plot script and add results for icx32
Signed-off-by: Rafael Ravedutti <rafaelravedutti@gmail.com>
This commit is contained in:
parent
57041ceed2
commit
effd961f29
39
util/cache_sets_histogram.py
Normal file
39
util/cache_sets_histogram.py
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
import sys
|
||||||
|
from cachesim import CacheSimulator, Cache, MainMemory
|
||||||
|
|
||||||
|
def get_set_id(cache, addr):
|
||||||
|
return (addr >> cache.cl_bits) % cache.sets
|
||||||
|
|
||||||
|
filename = sys.argv[1]
|
||||||
|
N = sys.argv[2]
|
||||||
|
mem = MainMemory()
|
||||||
|
|
||||||
|
# Cascade Lake
|
||||||
|
l3 = Cache("L3", 14336, 16, 64, "LRU", write_allocate=False)
|
||||||
|
l2 = Cache("L2", 1024, 16, 64, "LRU", store_to=l3, victims_to=l3)
|
||||||
|
l1 = Cache("L1", 64, 8, 64, "LRU", store_to=l2, load_from=l2)
|
||||||
|
mem.load_to(l2)
|
||||||
|
mem.store_from(l3)
|
||||||
|
cs = CacheSimulator(l1, mem)
|
||||||
|
|
||||||
|
sets_hist = {
|
||||||
|
'l1': {s: 0 for s in range(l1.sets)},
|
||||||
|
'l2': {s: 0 for s in range(l2.sets)},
|
||||||
|
'l3': {s: 0 for s in range(l3.sets)}
|
||||||
|
}
|
||||||
|
|
||||||
|
with open(filename, 'r') as fp:
|
||||||
|
for line in fp.readlines():
|
||||||
|
op, addr = line.split(": ")
|
||||||
|
op = op[0]
|
||||||
|
addr = int(addr, 16)
|
||||||
|
sets_hist['l1'][get_set_id(l1, addr)] += 1
|
||||||
|
sets_hist['l2'][get_set_id(l2, addr)] += 1
|
||||||
|
sets_hist['l3'][get_set_id(l3, addr)] += 1
|
||||||
|
|
||||||
|
for cache_level, data in sets_hist.items():
|
||||||
|
if cache_level != 'l3':
|
||||||
|
print(cache_level, ": ")
|
||||||
|
for set_id in data:
|
||||||
|
if data[set_id] > 0:
|
||||||
|
print(set_id, " -> ", data[set_id])
|
@ -10,6 +10,7 @@ plot_data = {}
|
|||||||
|
|
||||||
status = 0 # No header found
|
status = 0 # No header found
|
||||||
md_case = False
|
md_case = False
|
||||||
|
cut_cls_case = False
|
||||||
stride = None
|
stride = None
|
||||||
dims = None
|
dims = None
|
||||||
freq = None
|
freq = None
|
||||||
@ -21,7 +22,7 @@ with open(filename, 'r') as fp:
|
|||||||
for line in fp.readlines():
|
for line in fp.readlines():
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
|
|
||||||
if len(line) <= 0 or "likwid-pin" in line:
|
if len(line) <= 0 or "likwid-pin" in line or "INFO:" in line:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if line.startswith("ISA,"):
|
if line.startswith("ISA,"):
|
||||||
@ -31,6 +32,7 @@ with open(filename, 'r') as fp:
|
|||||||
|
|
||||||
if line.startswith("N,"):
|
if line.startswith("N,"):
|
||||||
status = 2
|
status = 2
|
||||||
|
cut_cls_case = True if "cut CLs" in line else False
|
||||||
continue
|
continue
|
||||||
|
|
||||||
assert status == 1 or status == 2, "Invalid input!"
|
assert status == 1 or status == 2, "Invalid input!"
|
||||||
@ -45,9 +47,15 @@ with open(filename, 'r') as fp:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if md_case:
|
if md_case:
|
||||||
|
if cut_cls_case:
|
||||||
|
N, size, cut_cls, total_time, time_per_it, cy_per_iter, cy_per_gather, cy_per_elem = line.split(',')
|
||||||
|
else:
|
||||||
|
print(line)
|
||||||
N, size, total_time, time_per_it, cy_per_iter, cy_per_gather, cy_per_elem = line.split(',')
|
N, size, total_time, time_per_it, cy_per_iter, cy_per_gather, cy_per_elem = line.split(',')
|
||||||
|
cut_cls = 0
|
||||||
else:
|
else:
|
||||||
N, size, total_time, time_per_it, cy_per_gather, cy_per_elem = line.split(',')
|
N, size, total_time, time_per_it, cy_per_gather, cy_per_elem = line.split(',')
|
||||||
|
cut_cls = 0
|
||||||
|
|
||||||
size = float(size)
|
size = float(size)
|
||||||
cycles = float(cy_per_iter) if md_case else float(cy_per_gather)
|
cycles = float(cy_per_iter) if md_case else float(cy_per_gather)
|
||||||
@ -96,7 +104,7 @@ with open(raw_output_file, 'w') as wp:
|
|||||||
wp.write("\n")
|
wp.write("\n")
|
||||||
|
|
||||||
cy_label = "Cycles per iteration" if md_case else "Cycles per gather"
|
cy_label = "Cycles per iteration" if md_case else "Cycles per gather"
|
||||||
ax.vlines([32, 1000], 0, 1, transform=ax.get_xaxis_transform(), linestyles='dashed', color=['#444444', '#777777'])
|
ax.vlines([48, 1000, 48000], 0, 1, transform=ax.get_xaxis_transform(), linestyles='dashed', color=['#444444', '#777777'])
|
||||||
#ax.vlines([32, 1000, 28000], 0, 1, transform=ax.get_xaxis_transform(), linestyles='dashed', color=['#444444', '#777777', '#aaaaaa'])
|
#ax.vlines([32, 1000, 28000], 0, 1, transform=ax.get_xaxis_transform(), linestyles='dashed', color=['#444444', '#777777', '#aaaaaa'])
|
||||||
ax.set(xlabel='Array size (kB)', ylabel=cy_label)
|
ax.set(xlabel='Array size (kB)', ylabel=cy_label)
|
||||||
ax.set_xscale('log')
|
ax.set_xscale('log')
|
||||||
|
Loading…
Reference in New Issue
Block a user