From dff48c32d751268cc1cbb40a2ba1ee08e543efc2 Mon Sep 17 00:00:00 2001
From: Yifan Zhao <yifanz16@illinois.edu>
Date: Sat, 18 Jan 2020 10:46:38 -0600
Subject: [PATCH] Added pipeline output in cava

---
 hpvm/test/parboil/benchmarks/hpvm-cava/src/main.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/hpvm/test/parboil/benchmarks/hpvm-cava/src/main.c b/hpvm/test/parboil/benchmarks/hpvm-cava/src/main.c
index e43bbb4f25..c1c0130b4c 100644
--- a/hpvm/test/parboil/benchmarks/hpvm-cava/src/main.c
+++ b/hpvm/test/parboil/benchmarks/hpvm-cava/src/main.c
@@ -17,6 +17,11 @@ int NUM_CLASSES;
 int INPUT_DIM;
 int NUM_WORKER_THREADS;
 
+// Type of struct holding the return value from the last node.
+struct RetStruct {
+  size_t bytesRet;
+}; 
+
 // Type of struct that is used to pass arguments to the HPVM dataflow graph
 // using the hpvm launch operation
 typedef struct __attribute__((__packed__)) {
@@ -34,7 +39,8 @@ typedef struct __attribute__((__packed__)) {
     float*coefs; size_t bytes_coefs;
     float *l2_dist; size_t bytes_l2_dist;
     float *tone_map; size_t bytes_tone_map;
-    size_t row_size; size_t col_size;
+    int row_size; int col_size;
+    struct RetStruct ret; // Instance of RetStruct holding the return value.
 } 
 RootIn;
 
@@ -807,6 +813,10 @@ int main(int argc, char* argv[]) {
     __visc__wait(camPipeDFG);
 
     printf("\n\nPipeline execution completed!\n");
+    printf(
+      "Pipeline final stage returned %lu; should be %lu\n",
+      rootArgs->ret.bytesRet, bytes_image
+    );
     printf("\n\nRequesting memory!\n");
 
     // Request data from graph.    
-- 
GitLab