summaryrefslogtreecommitdiff
path: root/TS/include
diff options
context:
space:
mode:
Diffstat (limited to 'TS/include')
-rw-r--r--TS/include/common.h47
-rw-r--r--TS/include/dfatool_host.ah25
-rw-r--r--TS/include/params.h67
-rw-r--r--TS/include/timer.h5
4 files changed, 144 insertions, 0 deletions
diff --git a/TS/include/common.h b/TS/include/common.h
new file mode 100644
index 0000000..6d37bdc
--- /dev/null
+++ b/TS/include/common.h
@@ -0,0 +1,47 @@
+#ifndef _COMMON_H_
+#define _COMMON_H_
+
+// Transfer size between MRAM and WRAM
+#ifdef BL
+#define BLOCK_SIZE_LOG2 BL
+#define BLOCK_SIZE (1 << BLOCK_SIZE_LOG2)
+#else
+#define BLOCK_SIZE_LOG2 8
+#define BLOCK_SIZE (1 << BLOCK_SIZE_LOG2)
+#endif
+
+// Data type
+#define DTYPE int32_t
+#define DTYPE_MAX INT32_MAX
+
+enum kernels {
+ kernel1 = 0,
+ nr_kernels = 1,
+} kernel;
+
+typedef struct {
+ uint32_t ts_length;
+ uint32_t query_length;
+ DTYPE query_mean;
+ DTYPE query_std;
+ uint32_t slice_per_dpu;
+ int32_t exclusion_zone;
+ enum kernels kernel;
+} dpu_arguments_t;
+
+typedef struct {
+ DTYPE minValue;
+ uint32_t minIndex;
+ DTYPE maxValue;
+ uint32_t maxIndex;
+} dpu_result_t;
+
+#ifndef ENERGY
+#define ENERGY 0
+#endif
+#define PRINT 0
+
+#define ANSI_COLOR_RED "\x1b[31m"
+#define ANSI_COLOR_GREEN "\x1b[32m"
+#define ANSI_COLOR_RESET "\x1b[0m"
+#endif
diff --git a/TS/include/dfatool_host.ah b/TS/include/dfatool_host.ah
new file mode 100644
index 0000000..2a45918
--- /dev/null
+++ b/TS/include/dfatool_host.ah
@@ -0,0 +1,25 @@
+#pragma once
+
+#include <sys/time.h>
+#include "dfatool_host_dpu.ah"
+
+aspect DfatoolHostTiming : public DfatoolHostDPUTiming {
+
+ DfatoolHostTiming() {
+ element_size = sizeof(DTYPE);
+ }
+
+ advice call("% input_params(...)") : after() {
+ Params* p = tjp->result();
+ input_size = p->input_size_n;
+ printf("[>>] TS | n_dpus=%u n_elements=%lu\n", NR_DPUS, input_size);
+ }
+
+ advice call("% streamp(...)") : before() {
+ printf("[--] TS | n_dpus=%u n_elements=%lu\n", NR_DPUS, input_size);
+ }
+
+ advice execution("% main(...)") : after() {
+ printf("[<<] TS | n_dpus=%u n_elements=%lu\n", NR_DPUS, input_size);
+ }
+};
diff --git a/TS/include/params.h b/TS/include/params.h
new file mode 100644
index 0000000..b7d9763
--- /dev/null
+++ b/TS/include/params.h
@@ -0,0 +1,67 @@
+#ifndef _PARAMS_H_
+#define _PARAMS_H_
+
+#include "common.h"
+
+// Params ---------------------------------------------------------------------
+typedef struct Params {
+ unsigned long input_size_n;
+ unsigned long input_size_m;
+ int n_warmup;
+ int n_reps;
+} Params;
+
+void usage()
+{
+ fprintf(stderr,
+ "\nUsage: ./program [options]"
+ "\n"
+ "\nGeneral options:"
+ "\n -h help"
+ "\n -w <W> # of untimed warmup iterations (default=1)"
+ "\n -e <E> # of timed repetition iterations (default=3)"
+ "\n"
+ "\nBenchmark-specific options:"
+ "\n -n <n> n (TS length. Default=64K elements)"
+ "\n -m <m> m (Query length. Default=256 elements)" "\n");
+}
+
+struct Params input_params(int argc, char **argv)
+{
+ struct Params p;
+ p.input_size_n = 1 << 16;
+ p.input_size_m = 1 << 8;
+
+ p.n_warmup = 1;
+ p.n_reps = 3;
+
+ int opt;
+ while ((opt = getopt(argc, argv, "hw:e:n:m:")) >= 0) {
+ switch (opt) {
+ case 'h':
+ usage();
+ exit(0);
+ break;
+ case 'w':
+ p.n_warmup = atoi(optarg);
+ break;
+ case 'e':
+ p.n_reps = atoi(optarg);
+ break;
+ case 'n':
+ p.input_size_n = atol(optarg);
+ break;
+ case 'm':
+ p.input_size_m = atol(optarg);
+ break;
+ default:
+ fprintf(stderr, "\nUnrecognized option!\n");
+ usage();
+ exit(0);
+ }
+ }
+ assert(NR_DPUS > 0 && "Invalid # of dpus!");
+
+ return p;
+}
+#endif
diff --git a/TS/include/timer.h b/TS/include/timer.h
new file mode 100644
index 0000000..7b80823
--- /dev/null
+++ b/TS/include/timer.h
@@ -0,0 +1,5 @@
+#pragma once
+
+#define N_TIMERS 7
+#include "../../include/timer_base.h"
+#undef N_TIMERS