|
@@ -23,65 +23,42 @@
|
|
|
#include "MaxSLiCInterface.h"
|
|
|
#define SIZE (192/sizeof(int32_t))
|
|
|
|
|
|
-void fpga_impl(void *buffers[], void *cl_arg)
|
|
|
+static max_file_t *maxfile;
|
|
|
+static max_engine_t *engine;
|
|
|
+
|
|
|
+void fpga_impl1(void *buffers[], void *cl_arg)
|
|
|
{
|
|
|
(void)cl_arg;
|
|
|
|
|
|
int32_t *ptrA = (int32_t*) STARPU_VECTOR_GET_PTR(buffers[0]);
|
|
|
int32_t *ptrB = (int32_t*) STARPU_VECTOR_GET_PTR(buffers[1]);
|
|
|
- int32_t *ptrC = (int32_t*) STARPU_VECTOR_GET_PTR(buffers[2]);
|
|
|
+ size_t ptrC = (size_t) STARPU_VECTOR_GET_PTR(buffers[2]); /* FPGA */
|
|
|
|
|
|
int size = STARPU_VECTOR_GET_NX(buffers[0]);
|
|
|
|
|
|
- // XXX: would rather use a scratch buffer
|
|
|
- size_t ptrCT1 = 0x00000000000000c0;
|
|
|
-
|
|
|
- size_t ptrAT2 = ptrCT1;
|
|
|
- size_t ptrBT2 = ptrCT1;
|
|
|
- size_t ptrCT2 = 0x0000000000000180;
|
|
|
-
|
|
|
- size_t ptrAT3 = ptrCT2;
|
|
|
- size_t ptrBT3 = ptrCT2;
|
|
|
-
|
|
|
- printf("Loading DFE memory.\n");
|
|
|
-
|
|
|
- /* C = A+B */
|
|
|
- MyTasks_interfaceT1(size, ptrCT1, ptrA, ptrB);
|
|
|
- printf("T1 finished\n");
|
|
|
-
|
|
|
- /* C = A*B */
|
|
|
- MyTasks_interfaceT2(size, ptrAT2, ptrBT2, ptrCT2);
|
|
|
- printf("T2 finished\n");
|
|
|
-
|
|
|
+ printf("T1 with %p %p %zu\n", ptrA, ptrB, ptrC);
|
|
|
/* C = A+B */
|
|
|
- MyTasks_interfaceT3(size, ptrAT3, ptrBT3, ptrC);
|
|
|
- printf("T3 finished\n");
|
|
|
|
|
|
- printf("Running DFE.\n");
|
|
|
-}
|
|
|
+ max_actions_t *acts = max_actions_init(maxfile, NULL);
|
|
|
+ max_set_ticks(acts, "Task1", size);
|
|
|
+ max_ignore_scalar(acts, "Task2", "run_cycle_count");
|
|
|
+ max_ignore_scalar(acts, "Task3", "run_cycle_count");
|
|
|
|
|
|
-static struct starpu_codelet cl =
|
|
|
-{
|
|
|
- .fpga_funcs = {fpga_impl},
|
|
|
- .nbuffers = 3,
|
|
|
- .modes = {STARPU_R, STARPU_R, STARPU_W},
|
|
|
- .specific_nodes = 1,
|
|
|
- .nodes = {STARPU_SPECIFIC_NODE_CPU, STARPU_SPECIFIC_NODE_CPU, STARPU_SPECIFIC_NODE_CPU},
|
|
|
-};
|
|
|
+ max_queue_input(acts, "inAT1", ptrA, size * sizeof(uint32_t));
|
|
|
+ max_queue_input(acts, "inBT1", ptrB, size * sizeof(uint32_t));
|
|
|
+ max_memctl_linear(acts, "MemoryControllerPro0", "outCT1", ptrC, size * sizeof(uint32_t));
|
|
|
|
|
|
-void fpga_impl1(void *buffers[], void *cl_arg)
|
|
|
-{
|
|
|
- (void)cl_arg;
|
|
|
+ max_ignore_memctl(acts, "MemoryControllerPro0", "inAT2");
|
|
|
+ max_ignore_memctl(acts, "MemoryControllerPro0", "inBT2");
|
|
|
+ max_ignore_memctl(acts, "MemoryControllerPro0", "outCT2");
|
|
|
|
|
|
- int32_t *ptrA = (int32_t*) STARPU_VECTOR_GET_PTR(buffers[0]);
|
|
|
- int32_t *ptrB = (int32_t*) STARPU_VECTOR_GET_PTR(buffers[1]);
|
|
|
- size_t ptrC = (size_t) STARPU_VECTOR_GET_PTR(buffers[2]); /* FPGA */
|
|
|
+ max_ignore_memctl(acts, "MemoryControllerPro0", "inAT3");
|
|
|
+ max_ignore_memctl(acts, "MemoryControllerPro0", "inBT3");
|
|
|
+ max_ignore_stream(acts, "outCT3");
|
|
|
|
|
|
- int size = STARPU_VECTOR_GET_NX(buffers[0]);
|
|
|
+ max_run(engine, acts);
|
|
|
+ max_actions_free(acts);
|
|
|
|
|
|
- printf("T1 with %p %p %zu\n", ptrA, ptrB, ptrC);
|
|
|
- /* C = A+B */
|
|
|
- MyTasks_interfaceT1(size, ptrC, ptrA, ptrB);
|
|
|
printf("T1 finished\n");
|
|
|
}
|
|
|
|
|
@@ -106,7 +83,27 @@ void fpga_impl2(void *buffers[], void *cl_arg)
|
|
|
|
|
|
printf("T2 with %zu %zu %zu\n", ptrA, ptrB, ptrC);
|
|
|
/* C = A*B */
|
|
|
- MyTasks_interfaceT2(size, ptrA, ptrB, ptrC);
|
|
|
+
|
|
|
+ max_actions_t *acts = max_actions_init(maxfile, NULL);
|
|
|
+ max_ignore_scalar(acts, "Task1", "run_cycle_count");
|
|
|
+ max_set_ticks(acts, "Task2", size);
|
|
|
+ max_ignore_scalar(acts, "Task3", "run_cycle_count");
|
|
|
+
|
|
|
+ max_ignore_stream(acts, "inAT1");
|
|
|
+ max_ignore_stream(acts, "inBT1");
|
|
|
+ max_ignore_memctl(acts, "MemoryControllerPro0", "outCT1");
|
|
|
+
|
|
|
+ max_memctl_linear(acts, "MemoryControllerPro0", "inAT2", ptrA, size * sizeof(uint32_t));
|
|
|
+ max_memctl_linear(acts, "MemoryControllerPro0", "inBT2", ptrB, size * sizeof(uint32_t));
|
|
|
+ max_memctl_linear(acts, "MemoryControllerPro0", "outCT2", ptrC, size * sizeof(uint32_t));
|
|
|
+
|
|
|
+ max_ignore_memctl(acts, "MemoryControllerPro0", "inAT3");
|
|
|
+ max_ignore_memctl(acts, "MemoryControllerPro0", "inBT3");
|
|
|
+ max_ignore_stream(acts, "outCT3");
|
|
|
+
|
|
|
+ max_run(engine, acts);
|
|
|
+ max_actions_free(acts);
|
|
|
+
|
|
|
printf("T2 finished\n");
|
|
|
}
|
|
|
|
|
@@ -130,7 +127,27 @@ void fpga_impl3(void *buffers[], void *cl_arg)
|
|
|
|
|
|
printf("T3 with %zu %zu %p\n", ptrA, ptrB, ptrC);
|
|
|
/* C = A+B */
|
|
|
- MyTasks_interfaceT3(size, ptrA, ptrB, ptrC);
|
|
|
+
|
|
|
+ max_actions_t *acts = max_actions_init(maxfile, NULL);
|
|
|
+ max_ignore_scalar(acts, "Task1", "run_cycle_count");
|
|
|
+ max_ignore_scalar(acts, "Task2", "run_cycle_count");
|
|
|
+ max_set_ticks(acts, "Task3", size);
|
|
|
+
|
|
|
+ max_ignore_stream(acts, "inAT1");
|
|
|
+ max_ignore_stream(acts, "inBT1");
|
|
|
+ max_ignore_memctl(acts, "MemoryControllerPro0", "outCT1");
|
|
|
+
|
|
|
+ max_ignore_memctl(acts, "MemoryControllerPro0", "inAT2");
|
|
|
+ max_ignore_memctl(acts, "MemoryControllerPro0", "inBT2");
|
|
|
+ max_ignore_memctl(acts, "MemoryControllerPro0", "outCT2");
|
|
|
+
|
|
|
+ max_memctl_linear(acts, "MemoryControllerPro0", "inAT3", ptrA, size * sizeof(uint32_t));
|
|
|
+ max_memctl_linear(acts, "MemoryControllerPro0", "inBT3", ptrB, size * sizeof(uint32_t));
|
|
|
+ max_queue_output(acts, "outCT3", ptrC, size * sizeof(uint32_t));
|
|
|
+
|
|
|
+ max_run(engine, acts);
|
|
|
+ max_actions_free(acts);
|
|
|
+
|
|
|
printf("T3 finished\n");
|
|
|
}
|
|
|
|
|
@@ -153,6 +170,9 @@ int main(int argc, char **argv)
|
|
|
int ret;
|
|
|
int size=1234;
|
|
|
|
|
|
+ maxfile = MyTasks_init();
|
|
|
+ engine = max_load(maxfile, "*");
|
|
|
+
|
|
|
starpu_conf_init(&conf);
|
|
|
conf.sched_policy_name = "eager";
|
|
|
conf.calibrate = 0;
|
|
@@ -180,17 +200,12 @@ int main(int argc, char **argv)
|
|
|
|
|
|
starpu_vector_data_register(&handle_c, STARPU_MAIN_RAM, (uintptr_t) &c, SIZE, sizeof(c[0]));
|
|
|
|
|
|
-#if 0
|
|
|
- ret = starpu_task_insert(&cl, STARPU_R, handle_a, STARPU_R, handle_b, STARPU_W, handle_c, STARPU_TASK_SYNCHRONOUS, 1, 0);
|
|
|
- fprintf(stderr,"task submitted %d\n", ret);
|
|
|
-#else
|
|
|
ret = starpu_task_insert(&cl1, STARPU_R, handle_a, STARPU_R, handle_b, STARPU_W, handle_ct1, 0);
|
|
|
fprintf(stderr,"task submitted %d\n", ret);
|
|
|
ret = starpu_task_insert(&cl2, STARPU_R, handle_ct1, STARPU_R, handle_ct1, STARPU_W, handle_ct2, 0);
|
|
|
fprintf(stderr,"task submitted %d\n", ret);
|
|
|
ret = starpu_task_insert(&cl3, STARPU_R, handle_ct2, STARPU_R, handle_ct2, STARPU_W, handle_c, 0);
|
|
|
fprintf(stderr,"task submitted %d\n", ret);
|
|
|
-#endif
|
|
|
|
|
|
starpu_data_unregister(handle_a);
|
|
|
starpu_data_unregister(handle_b);
|
|
@@ -220,5 +235,7 @@ int main(int argc, char **argv)
|
|
|
if (ret == EXIT_SUCCESS)
|
|
|
printf("OK!\n");
|
|
|
|
|
|
+ max_unload(engine);
|
|
|
+
|
|
|
return ret;
|
|
|
}
|