From 2b2b2ea58ce976029b911e0b2d06346f6e889857 Mon Sep 17 00:00:00 2001
From: Russel Arbore <russel.jma@gmail.com>
Date: Tue, 25 Feb 2025 14:23:33 -0600
Subject: [PATCH] Use same align in GPU

---
 hercules_cg/src/gpu.rs | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/hercules_cg/src/gpu.rs b/hercules_cg/src/gpu.rs
index 5f2feedd..14341756 100644
--- a/hercules_cg/src/gpu.rs
+++ b/hercules_cg/src/gpu.rs
@@ -2101,19 +2101,7 @@ namespace cg = cooperative_groups;
     }
 
     fn get_alignment(&self, type_id: TypeID) -> usize {
-        match &self.types[type_id.idx()] {
-            Type::Array(element_type, _) => self.get_alignment(*element_type),
-            Type::Product(fields) | Type::Summation(fields) => fields
-                .iter()
-                .map(|field| self.get_alignment(*field))
-                .max()
-                .unwrap_or(0),
-            Type::Boolean | Type::Integer8 | Type::UnsignedInteger8 | Type::Float8 => 1,
-            Type::Integer16 | Type::UnsignedInteger16 | Type::BFloat16 => 2,
-            Type::Integer32 | Type::UnsignedInteger32 | Type::Float32 => 4,
-            Type::Integer64 | Type::UnsignedInteger64 | Type::Float64 => 8,
-            _ => panic!("Unsupported type for alignment"),
-        }
+        get_type_alignment(&self.types, type_id)
     }
 
     fn codegen_intrinsic(&self, intrinsic: &Intrinsic, ty: &Type) -> String {
-- 
GitLab