aboutsummaryrefslogtreecommitdiff
path: root/arch/v1
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2026-04-11 14:07:37 +0200
committerPaul Oliver <contact@pauloliver.dev>2026-04-14 23:05:25 +0200
commitb1f78f2cddbcf1e137acb13c31b46e06d3012c58 (patch)
treef16ff77de4ddbb06aac2a8497ba2448d3846def9 /arch/v1
parent0eadabbd642de773ce3187310eb4a52fd5dcd455 (diff)
Adds heatmaps
Diffstat (limited to 'arch/v1')
-rw-r--r--arch/v1/arch.c40
-rw-r--r--arch/v1/arch_vars.py10
2 files changed, 25 insertions, 25 deletions
diff --git a/arch/v1/arch.c b/arch/v1/arch.c
index 152a97d..49d9db5 100644
--- a/arch/v1/arch.c
+++ b/arch/v1/arch.c
@@ -47,7 +47,7 @@ void arch_core_save(FILE *f, const struct Core *core) {
fwrite(&core->wdea, sizeof(uint64_t), 1, f);
#if defined(DATA_PUSH_PATH)
- //fwrite(core->weva, sizeof(uint64_t), MVEC_SIZE, f);
+ fwrite(core->weva, sizeof(uint64_t), MVEC_SIZE, f);
#endif
}
#endif
@@ -64,7 +64,7 @@ void arch_core_load(FILE *f, struct Core *core) {
fread(&core->wdea, sizeof(uint64_t), 1, f);
#if defined(DATA_PUSH_PATH)
- //fread(core->weva, sizeof(uint64_t), MVEC_SIZE, f);
+ fread(core->weva, sizeof(uint64_t), MVEC_SIZE, f);
#endif
}
#endif
@@ -626,19 +626,22 @@ void _write(struct Core *core, uint64_t pix) {
if (_is_writeable_by(core, *regs[0], pix)) {
// Store write event
uint8_t inst = *regs[1] % INST_COUNT;
+ uint8_t inst_rep = *regs[1] % INST_CAP;
+ uint64_t addr = *regs[0];
++core->iwrt[inst];
+ ++core->weva[addr];
- if (mvec_is_in_mb0_of_proc(core, *regs[0], pix)) {
+ if (mvec_is_in_mb0_of_proc(core, addr, pix)) {
++core->wmb0;
- } else if (mvec_is_in_mb1_of_proc(core, *regs[0], pix)) {
+ } else if (mvec_is_in_mb1_of_proc(core, addr, pix)) {
++core->wmb1;
} else {
++core->wdea;
}
// Write instruction
- mvec_set_inst(core, *regs[0], *regs[1] % INST_CAP);
+ mvec_set_inst(core, addr, inst_rep);
}
_increment_ip(core, pix);
@@ -860,7 +863,7 @@ void arch_push_data_header() {
}
// Memory events
- char *eprefs[] = { /* "wev" */ };
+ char *eprefs[] = { "wev" };
int eprefs_cnt = sizeof(eprefs) / sizeof(eprefs[0]);
for (int i = 0; i < CORES; ++i) {
@@ -984,16 +987,16 @@ void arch_push_data_line() {
}
// TODO: insert write memory events
- char *eprefs[] = { /* "wev" */ };
+ char *eprefs[] = { "wev" };
int eprefs_cnt = sizeof(eprefs) / sizeof(eprefs[0]);
for (int i = 0; i < CORES; ++i) {
for (int j = 0; j < eprefs_cnt; ++j) {
uint64_t *in = NULL;
- //if (!strcmp("wev", eprefs[j])) {
- // in = g_cores[i].weva;
- //}
+ if (!strcmp("wev", eprefs[j])) {
+ in = g_cores[i].weva;
+ }
// Compress event data
size_t size = sizeof(uint64_t) * MVEC_SIZE;
@@ -1001,18 +1004,7 @@ void arch_push_data_line() {
assert(out);
z_stream strm = { 0 };
- strm.zalloc = NULL;
- strm.zfree = NULL;
- strm.opaque = NULL;
-
- deflateInit(&strm, Z_DEFAULT_COMPRESSION);
-
- strm.avail_in = size;
- strm.avail_out = size;
- strm.next_in = (Bytef *)in;
- strm.next_out = (Bytef *)out;
-
- deflate(&strm, Z_FINISH);
+ salis_deflate(&strm, size, (Bytef *)in, (Bytef *)out);
// Insert blob
const void *blob = out;
@@ -1039,7 +1031,7 @@ void arch_push_data_line() {
blob_size, g_steps
);
- deflateEnd(&strm);
+ salis_deflate_end(&strm);
free(out);
}
}
@@ -1055,7 +1047,7 @@ void arch_push_data_line() {
core->wmb1 = 0;
core->wdea = 0;
- //memset(core->weva, 0, sizeof(uint64_t) * MVEC_SIZE);
+ memset(core->weva, 0, sizeof(uint64_t) * MVEC_SIZE);
}
}
#endif
diff --git a/arch/v1/arch_vars.py b/arch/v1/arch_vars.py
index 65c5e87..b9d4c4f 100644
--- a/arch/v1/arch_vars.py
+++ b/arch/v1/arch_vars.py
@@ -83,7 +83,7 @@ class ArchVars:
("uint64_t", "wmb1", ""), # writes within mb1 counter
("uint64_t", "wdea", ""), # writes within dead code counter
- #("uint64_t", "weva", f"[{2 ** args.mvec_pow}]"), # write events array
+ ("uint64_t", "weva", f"[{2 ** args.mvec_pow}]"), # write events array
]
self.data_is_compressed = True
@@ -138,3 +138,11 @@ class ArchVars:
} for i in range(args.cores)
},
}
+
+ self.heatmaps = {
+ "Events": {
+ f"wev_{i}": {
+ "table": f"wev_{i}",
+ } for i in range(args.cores)
+ }
+ }