From 050e7dfaf11b18951561a38440a006e6d88f9387 Mon Sep 17 00:00:00 2001
From: Praneet Rathi <prrathi10@gmail.com>
Date: Fri, 17 Jan 2025 10:42:18 -0600
Subject: [PATCH] sm

---
 hercules_cg/src/gpu.rs | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/hercules_cg/src/gpu.rs b/hercules_cg/src/gpu.rs
index 89155109..37f0cd31 100644
--- a/hercules_cg/src/gpu.rs
+++ b/hercules_cg/src/gpu.rs
@@ -155,7 +155,7 @@ pub fn gpu_codegen<W: Write>(
         (NodeID::new(pos), *data)
     };
 
-    let return_type_id = &typing[return_node_id.idx()];
+    let return_type_id = &typing[data_node_id.idx()];
     let return_type = &types[return_type_id.idx()];
     if return_type.is_array() || return_type.is_product() || return_type.is_summation() {
         let objects = &collection_objects.objects(data_node_id);
@@ -520,12 +520,13 @@ namespace cg = cooperative_groups;
 
     fn codegen_launch_code(&self, run_debug: bool, num_blocks: usize, num_threads: usize, dynamic_shared_offset: &str, w: &mut String) -> Result<(), Error> {
         write!(w, "
-int main() {{
-")?;
+int main(")?;
         // The following steps are for host-side C function arguments, but we also
         // need to pass arguments to kernel, so we keep track of the arguments here.
         let mut pass_args = String::new();
         if run_debug {
+            write!(w, ") {{
+")?;
             // The first set of parameters are dynamic constants.
             let mut first_param = true;
             for idx in 0..self.function.num_dynamic_constants {
-- 
GitLab